- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I took basic cyfxgpiftousb example from c:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\basic_examples\ and added CyU3PPibRegisterCallback to the sources to see if there is some events happen during GPIF to DMA transfer. I was surprised a lot when I saw in output CYU3P_PIB_ERR_THR0_WR_OVERRUN errors.
debug initialized
USB event: 11 0
About to connect to USB host
USB event: 0 1
CY_U3P_USB_EVENT_CONNECT detected
CyFxApplnInit complete
USB event: 4 1
USB event: 8 0
USB event: 5 1
GpifToUsbDmaCallback: 32768 bytes commited
GpifToUsbDmaCallback: 32768 bytes commited
GpifToUsbDmaCallback: 32768 bytes commited
GpifToUsbDmaCallback: 32768 bytes commited
CYU3P_PIB_ERR_THR0_WR_OVERRUN
CYU3P_PIB_ERR_THR0_WR_OVERRUN
As I think these error happen while IN_DATA action trying to work during DMA buffers are switching. Am I right? If so, how can I pause the data input process until next buffer will be ready? My modified source code is attached.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Please use the debug library which is posted in post number 11 of commit error and back flow error in UVC AN75779 and test
(Note: This library is just for debug purpose and should not be considered as standard release)
In your firmware, make changes to PROD_EVENT handling in GpifToUsbDmaMultiCallback as below:
if (type == CY_U3P_DMA_CB_PROD_EVENT)
{
/* Since this is a many to one channel, there can be a case where one producer
* is faster than the other out of sequence produce events. This means that
* we have to check for buffers with all producer sockets. In this case there
* are two producers and so loop twice or until there are valid buffers. */
for (index = 0; index < 2; index++)
{
status = CyU3PDmaMultiChannelGetBuffer (chHandle, &buf_p, CYU3P_NO_WAIT);
if (status != CY_U3P_SUCCESS)
{
CyU3PDebugPrint (4, "GetFail\r\n");
/* This can be a valid case. Just break. */
break;
}
else
{
buf_p.buffer[0x0000] = DataSignature++;
buf_p.buffer[buf_p.count - 1] = DataSignature++;
/* This is a produce event notification to the CPU. This notification is
* received upon reception of every buffer. The buffer will not be sent
* out unless it is explicitly committed. The call shall fail if there
* is a bus reset / usb disconnect or if there is any application error. */
status = CyU3PDmaMultiChannelCommitBuffer (chHandle, buf_p.count, 0);
if (status != CY_U3P_SUCCESS)
{
CyU3PDebugPrint (4, "CyU3PDmaMultiChannelCommitBuffer failed, index = %d, Error code = %d\r\n", index, status);
} else
CyU3PDebugPrint (4, "GpifToUsbDmaMultiCallback: %d bytes commited, index = %d\r\n", buf_p.count, index);
}
}
/* Increment the counter. */
//glDMARxCount++;
}
}
Please, also note that, it is not recommended to place DebugPrints in dmacallbacks. (You can do it now just for testing)
In multi channel, the dma buffers should be filled and emptied in a pingpong fashion.
Regards,
Hemanth