USB Tx Double Buffer not working
Company  
ST Home | Microcontrollers

Index  »  USB  »  USB Tx Double Buffer not working
     
   USB Tx Double Buffer not working
 Moderated by :   »  aNt  -  AnisAS  -  AnisAS

Author
beginning argument    ( Replies received: 1 )
rgreenthal   Posted 25-09-2008 at 00:07   



Registered on :
02-07-2009

Messages : 43

 OFF-Line

Help

I can't get the USB Double Buffering working for Transmit
I have it working for a single transmit buffer of 1024 bytes
I am using End Point 6 as the Transmit

I setup double buffering by:
// *********************************************
// Initialize Endpoint 6 IN
// Transmit, Kick off the USB data to be sent
// Do a Double buffer of 512 Bytes
// *********************************************
_SetEPAddress(ENDP6, 6);
// setup USB_EP6R
_SetEPType(ENDP6, EP_BULK);

// Set up USB_Counter6, do Tx for Double Buffered
// set Double Buffer register for larger packets
SetEPDoubleBuff(ENDP6); // Make a Double buffer endpoint
SetEPDblBuffAddr(ENDP6, ENDP6_TXADDR1, ENDP6_TXADDR2);
SetEPDblBuffCount(ENDP6, EP_DBUF_IN, 0); // Set Count & BLsize
_ClearDTOG_RX(ENDP6);
_ToggleDTOG_RX(ENDP6);
_ClearDTOG_TX(ENDP6);

// Sets the Endpoint Tx Status as Not valid
_SetEPRxStatus(ENDP6, EP_RX_DIS);
_SetEPTxStatus(ENDP6, EP_TX_DIS);




I setup the Transmit by checking the DTOG flag
Copy my buffer (ucUSBMirrorBuffer) with a count of usUSBMirrorTailIndx
and then make it VALID

It does this once & crashes


// ***********************************
// Check to do Double Buffering
// Ping-Pong between the two Buffers
// ***********************************
Endpoint_DTOG_Status = GetENDPOINT(ENDP6) & EP_DTOG_TX;

if (Endpoint_DTOG_Status)
{
// Transmit to buffer 1
// Reset buffer 1
UserToPMABufferCopy(ucUSBMirrorBuffer, ENDP6_TXADDR2, usUSBMirrorTailIndx);
SetEPDblBuf1Count(ENDP6, EP_DBUF_IN, usUSBMirrorTailIndx);
_SetEPRxStatus(ENDP6, EP_RX_VALID); // Data Valid so USB can now Transmit it
}
else
{
// Reset buffer 0
UserToPMABufferCopy(ucUSBMirrorBuffer, ENDP6_TXADDR1, usUSBMirrorTailIndx);
SetEPDblBuf0Count(ENDP6, EP_DBUF_IN, usUSBMirrorTailIndx);
_SetEPTxStatus(ENDP6, EP_TX_VALID); // Data Valid so USB can now Transmit it
}




 Profile   Quote  
rgreenthal   Posted 25-09-2008 at 19:12   



Registered on :
02-07-2009

Messages : 43

 OFF-Line

Do I need to add the function CTR_HP() to the USB IRQ handlers?
I Just found this in the NEW USB SW (10/2006)
We have been using the 05/2006 USB Lib

Why does ST Micro wrap everything in a Function call? (Way too much overhead)
Don't they know about macros, especially in an IRQ handler?
Some code is good other is very poor.
Do they do code reviews or customer reviews before issuing the code?



 Profile   Quote  
On Top

Search in the forums
 
Jump To