Other Parts Discussed in Thread: TMS320VC5507
Hello all,
We are using the TMS320C5509A in a kind of sensor app with USB interface. The communication between the sensor and a self developed software works normally fine. But if we exit the programm and start it again we get some trouble. We analysed the problem by using an USB analyser, so we found a data toggle error after the PC-USB driver send a CLEAR_FEATURE - ENDPOINT_HALT request. The host resets the data toggle bit to 0, but the device sends a data1 package, through this we lost the first data package on the host side.
We use the csl ( older version [maybe 2004] ) :
USB_REQUEST_RET USB_reqClearFeature(USB_REQUEST_ARGS)
{
USB_EpHandle hEPx=0;
Uint16 Endpt;
USB_REQUEST_RET ret_stat = USB_REQUEST_SEND_ACK;
// decode the requested feature
switch(USB_Setup->wValue)
{
case USB_FEATURE_ENDPOINT_HALT:
{
// retrieve the endpoint number
Endpt = (USB_Setup->wIndex) & 0xFF;
// retrieve the handle associated with the endpoint
if (USB_Setup->wIndex==0 || USB_Setup->wIndex==6 || USB_Setup->wIndex==7)
{
ret_stat = USB_REQUEST_STALL;
}
else
{
hEPx = USB_epNumToHandle(USB0, Endpt);
// un-stall the endpoint
if (USB_getEndptStall(hEPx))
{
USB_clearEndptStall(hEPx);
}
}
break;
}
So we had the idea to use the USBICNFn / USBOCNFn register to solve the problem.
( Doku.: spru596.pdf ) page 91
Bits 5−0 in Non-Isochronous Mode (ISO = 0) // we use BULK
Bit | Field | Value | Description
5 | | | TOGGLE Endpoint data toggle.
| | 0 | The next data packet is DATA0.
| | 1 | The next data packet is DATA1.
BIT:
7 6 5 4 3 2 - 0
UBME ISO TOGGLE DBUF STALL Reserved
R/W-x R/W-x R/W-x R/W-x R/W-x R/W−x
So we use: *(Uint16 *) hEPx-> EDReg_SAddr = 0xA0; for reset the Toggle Bit after the last " if ".
//// hEPx-> EDReg_SAddr = 0x6750 ( seen in debug) ////
If we test the code, we see no effect ! Why not ??? What are we doing wrong???
In debug-mode we see what the address is 0x6750; it must be EP 2 IN base-address right ???
( Doku.: spru596.pdf ) page 76
Base address + 0F50h Endpoint IN2 definition register block
Is 0x6750 the USBICNF2 Register address ????
Could anyone give me an advice?
Thank you!
Sebastian

