
Registered on : 02-07-2009
Messages : 43
OFF-Line
|
Please Help!
I have gotten Simple Tx for this EndPoint working
And Added all the code to do Double Buffering
When I do an EP_KIND, i.e. SetEPDoubleBuff(ENDP6); // Make a Double buffer endpoint
I also added the IRQ for USBHP_IRQHandler() calling CTR_HP()
The code STOPS WORKING
What am I doing wrong?
The Init code for EP6
// *********************************************
// Initialize Endpoint 6 IN
// Transmit, Kick off the USB data to be sent
// Need to change Packet/Count to > 64
// and set BLsize bit so we can TX to 512 bytes
// WARNING:
// DO NOT do Double Buffering for now
// Simple buffering is working with all code to do Double Buffering
// Do a Double buffer of 512 Bytes, 128 unsigned short
// *********************************************
_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 =0 & 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_NAK);
Now the code to load the PMA Buffer & enable it:
// ***********************************
// Check to do Double Buffering
// Ping-Pong between the two Buffers
// ***********************************
if ((_GetENDPOINT(ENDP6) & EP_DTOG_RX) == 0)
{
// THIS IS Working
// Reset buffer 0 Tx
SetEPDblBuf0Count(ENDP6, EP_DBUF_IN, usUSBMirrorTailIndx);
UserToPMABufferCopy(ucUSBMirrorBuffer, ENDP6_TXADDR1, usUSBMirrorTailIndx);
_SetEPTxStatus(ENDP6, EP_TX_VALID); // Data Valid so USB can now Transmit it
}
else
{
// Transmit to buffer 1 Rx
// Reset buffer 1
SetEPDblBuf1Count(ENDP6, EP_DBUF_IN, usUSBMirrorTailIndx);
UserToPMABufferCopy(ucUSBMirrorBuffer, ENDP6_TXADDR2, usUSBMirrorTailIndx);
_SetEPRxStatus(ENDP6, EP_RX_VALID); // Data Valid so USB can now Transmit it
}
// WARNING
// NOT Toggling for NOW
// FreeUserBuffer(ENDP6, EP_DBUF_IN); // Toggle DTOG Status to next Buffer
|
|
|