- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I worked through the UVC example and got video streaming working. I then worked through the GpifToUsb example and got data read out working. Now I am trying to merge them and continuously read out data from an ADC without dropping data. To do this, I began with the GpifToUsb example and added a simple GPIF project with two threads (0,1):
Next, I added a MANY_TO_ONE auto DMA channel to GpifToUsb:
//try creating a many to one dma channel
CyU3PDmaMultiChannelConfig_t dmaMultiConfig;
CyU3PMemSet ((uint8_t *)&dmaCfg, 0, sizeof (dmaMultiConfig));
dmaMultiConfig.size = CY_FX_DMA_BUF_SIZE;
dmaMultiConfig.count = CY_FX_DMA_BUF_COUNT;
dmaMultiConfig.validSckCount = 2;
dmaMultiConfig.prodSckId [0] = (CyU3PDmaSocketId_t)CY_U3P_PIB_SOCKET_0;
dmaMultiConfig.prodSckId [1] = (CyU3PDmaSocketId_t)CY_U3P_PIB_SOCKET_1;
dmaMultiConfig.consSckId [0] = (CyU3PDmaSocketId_t)(CY_U3P_UIB_SOCKET_CONS_0);
dmaMultiConfig.prodAvailCount = 0;
dmaMultiConfig.prodHeader = 0; /* 12 byte UVC header to be added. */
dmaMultiConfig.prodFooter = 0; /* 4 byte footer to compensate for the 12 byte header. */
dmaMultiConfig.consHeader = 0;
dmaMultiConfig.dmaMode = CY_U3P_DMA_MODE_BYTE;
dmaMultiConfig.cb = NULL;
dmaMultiConfig.notification = 0;
//dmaMultiConfig.notification = CY_U3P_DMA_CB_CONS_SUSP; // CY_U3P_DMA_CB_PROD_EVENT | CY_U3P_DMA_CB_CONS_EVENT;
//dmaMultiConfig.cb = GpifToUsbDmaCallbackMulti;
apiRetStatus = CyU3PDmaMultiChannelCreate (&glDmaChHandleMulti, CY_U3P_DMA_TYPE_AUTO_MANY_TO_ONE,
&dmaMultiConfig);
if (apiRetStatus != CY_U3P_SUCCESS)
{
/* Error handling */
CyU3PDebugPrint (4, "DMA Channel Creation Failed, Error Code = %d\n", apiRetStatus);
CyFxAppErrorHandler (apiRetStatus);
}
The result is:
USB event: 11 0
About to connect to USB host
USB event: 0 1
CY_U3P_USB_EVENT_CONNECT detected
CyFxApplnInit complete
USB event: 8 0
USB event: 5 1
setting up dma
DMA Channel Creation Failed, Error Code = 64
Any idea what I'm doing wrong?
Solved! Go to Solution.
- Labels:
-
USB Superspeed Peripherals
- Tags:
- fx3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Please use the consumer socket as CY_U3P_UIB_SOCKET_CONS_1 as CY_U3P_UIB_SOCKET_CONS_0 is for the CONTROL endpoint.
From the firmware I see that endpoint 0x81 is used as the BULK IN endpoint (CY_FX_EP_CONSUMER ). The USB sockets are one to one mapped to the endpoints. Using CY_U3P_UIB_SOCKET_CONS_1 in the DMA channel configuration will correctly map the socket to the BULK IN endpoint
CyU3PDmaMultiChannelConfig_t dmaMultiConfig;
CyU3PMemSet ((uint8_t *)&dmaCfg, 0, sizeof (dmaMultiConfig));
dmaMultiConfig.size = CY_FX_DMA_BUF_SIZE;
dmaMultiConfig.count = CY_FX_DMA_BUF_COUNT;
dmaMultiConfig.validSckCount = 2;
dmaMultiConfig.prodSckId [0] = (CyU3PDmaSocketId_t)CY_U3P_PIB_SOCKET_0;
dmaMultiConfig.prodSckId [1] = (CyU3PDmaSocketId_t)CY_U3P_PIB_SOCKET_1;
dmaMultiConfig.consSckId [0] = (CyU3PDmaSocketId_t)(CY_U3P_UIB_SOCKET_CONS_1);
dmaMultiConfig.prodAvailCount = 0;
Rashi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Please use the consumer socket as CY_U3P_UIB_SOCKET_CONS_1 as CY_U3P_UIB_SOCKET_CONS_0 is for the CONTROL endpoint.
From the firmware I see that endpoint 0x81 is used as the BULK IN endpoint (CY_FX_EP_CONSUMER ). The USB sockets are one to one mapped to the endpoints. Using CY_U3P_UIB_SOCKET_CONS_1 in the DMA channel configuration will correctly map the socket to the BULK IN endpoint
CyU3PDmaMultiChannelConfig_t dmaMultiConfig;
CyU3PMemSet ((uint8_t *)&dmaCfg, 0, sizeof (dmaMultiConfig));
dmaMultiConfig.size = CY_FX_DMA_BUF_SIZE;
dmaMultiConfig.count = CY_FX_DMA_BUF_COUNT;
dmaMultiConfig.validSckCount = 2;
dmaMultiConfig.prodSckId [0] = (CyU3PDmaSocketId_t)CY_U3P_PIB_SOCKET_0;
dmaMultiConfig.prodSckId [1] = (CyU3PDmaSocketId_t)CY_U3P_PIB_SOCKET_1;
dmaMultiConfig.consSckId [0] = (CyU3PDmaSocketId_t)(CY_U3P_UIB_SOCKET_CONS_1);
dmaMultiConfig.prodAvailCount = 0;
Rashi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, that was very helpful and i probably would never have noticed that mistake. With that change I can acquire data, but I'm still noticing discontinuities in recorded test signals at 128KB of data even though I thought switching threads should be seamless.
To confirm, I've set
dmaMultiConfig.size = 16384
dmaMultiConfig.count = 4
I then set the bus with to 32 bit, and the ADDR and DATA counters to 4095, which means that exactly 16384 bytes should be written before the buffers flip, is that right? Still it seems that after size*count*producers I get a discontinuity.
I've also noticed that sometimes when I start and stop the streamer application, I get old data in the first 32KB or so before the newer data is sent.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Glad to hear that the DMA channel create error is solved.
As the new question is different from the original thread we would request you to create a new thread for it. This will be helpful to other community members.
Rashi