Hi,
My current project is using the TMS320C5515 in conjunction with CSL 3.04.
The only CSL module I'm using currently in the project is the USB code.
My device enumerates with no issues, but has a problem getting data from the host.
Right now I'm just trying to establish reliable communication between the host and device, so the code in the device is setup to just boomerang back any data it gets from the host.
If I send an even number of bytes from the host to the device, there is no issue.
If I perform 2 transfers from the host to the device that have an odd number of bytes, the second transfer will have the first 2 bytes missing.
When I read how large the transfer was on the device side it is 2 bytes smaller via the method USB_getDataCountReadFromFifo().
For instance, if I send the string "testing" to my device, the second time I send "testing" it will only get "sting".
I'm also having a secondary issue where the device seemingly writes back the data 2 times instead of once, but I have yet to rule out if this issue is on the device or host side.
I based my code off of the USB polling example found in the CSL download, but it has changed since.
Below is my USB section that deals with reading and writing data in the device:
if(pContext->dwIntSourceL & CSL_USB_RX_INT_EP2)
{
// read the RX packet size
// validate the RX packet first
if (USB_isValidDataInFifoOut(&pContext->pEpStatus[CSL_USB_EP2]))
{
// get the EP2 handle
tempEpH = USB_epNumToHandle(hUsbDev, CSL_USB_EP2);
usb_income_num_bytes_ep2 = USB_getDataCountReadFromFifo(tempEpH);
}
else
{
while(1);
}
status = USB_postTransaction(hEp[3], usb_income_num_bytes_ep2, USBDataBufferOut, CSL_USB_OUT_TRANSFER);
if(status != CSL_SOK)
{
while(1);
}
// wait for the RX to be done
while(USB_isTransactionDone(hEp[3], &status) == CSL_USB_FALSE);
status = USB_postTransaction(hEp[2], usb_income_num_bytes_ep2, USBDataBufferOut, CSL_USB_IN_TRANSFER);
if(status != CSL_SOK)
{
while(1);
}
// wait for the TX to be done
while(USB_isTransactionDone(hEp[2], &status) == CSL_USB_FALSE);
}
Any suggestions would be greatly appreciated.
Thanks,
Ben