DMARead occurs Error in FX3

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I was implement DMA read between FPGA and FX3. (FX3 SDK v1.3)

   

However, when DMA Read is continuously read, errors sometimes occur in FX3.

   

Ask for advice on the situation below.

   

The DMA Read method is as follows.
When an interrupt is generated in FX3 through GPIO in FPGA, FX3 is connected to state machine through GPIF Designer
Perform DMA Read function.

   


DMA Read is performed manually. (CY_U3P_DMA_TYPE_MANUAL).
Commit through CyU3PDmaChannelCommitBuffer() in DMA Callback function.

   

Counts the number of interrupts generated by the GPIO for debugging.
Counts the number called in the DMA Callback function for debugging.

   

The DMA read fails irregularly between 10,000 and 100,000 times, resulting in an error in FX3.
In this situation, the number of GPIO interrupts continues to increase.
In this situation, the number of DMA callback calls does not increase.

   

In the DMA configuration, it was tested by changing to AUTO, but the result is the same.

   

The Burst of EndPoint is set to 1.

   

EndPoint is Bulk type.

   

The DMA settings are as follows.

   

 

   

CyU3PMemSet((uint8_t *)&dmaConfig, 0, sizeof(dmaConfig));
dmaConfig.size            = 16384;
dmaConfig.count          = 8;
dmaConfig.prodSckId    = CY_U3P_PIB_SOCKET_1;
dmaConfig.consSckId    = CY_U3P_UIB_SOCKET_CONS_1;
dmaConfig.dmaMode    = CY_U3P_DMA_MODE_BYTE;
dmaConfig.notification  = CY_U3P_DMA_CB_PROD_EVENT;
dmaConfig.cb = CyFxDMAReadCallback;
Status = CyU3PDmaChannelCreate(&glDMARead_Handle, CY_U3P_DMA_TYPE_MANUAL, &dmaConfig);

   

 

   

case 2)

   

The number of Burst was changed to 2.

   

The DMA read fails irregularly between 10 and 100 times, resulting in an error in FX3.

0 Likes
4 Replies
Anonymous
Not applicable

I see that you mentioned that the GPIF was able to read the data from the FPGA upto 10000 times, After this you do not get any DMA callback, correct? 

   

1) You say that DMA read fails. Can you confirm if you are getting any error like commit. If the FPGA is asserting the control signals properly, then the GPIF should go to the In_data state and fill the FX3 DMA buffers. 

   

a) Can you check the signals on the GPIF interface to ensure that the correct timing is followed for writing into FX3. 

   

b) Use the CyU3PGpifGetSMState in the application thread for loop to continually see the state of the GPIF. Please check if the GPIF is going to the in_data state.

   

c) I assume that the host is continuously trying to read the data from the FX3. Else, the FX3 buffers will get full, and there will not be any further DMA producer event generated. One way to check is by increasing  the DMA buffer count to see if the performance increase.

   

d) Can you share your complete FX3 firmware with the GPIF state machine? 

   

e) Could you try AN65974. This application note comes with a sample firmware which is well tested and is expected to work fine. You can base your project on this example.

0 Likes
Anonymous
Not applicable

I see that you mentioned that the GPIF was able to read the data from the FPGA upto 10000 times, After this you do not get any DMA callback, correct? 

   

=> It's correct.

   

I tested the following Lists. The error still occurs.

   

1) glDMARead_Handle changed from CY_U3P_DMA_TYPE_MANUAL to CY_U3P_DMA_TYPE_AUTO.

   

 

   

2) Added Handshake by Mutex in CyFxDMAReadCallback().

   

example)

   

status = CyU3PDMAGetLock(&glDMALock);
if (status != CY_U3P_SUCCESS)
    return;

   

status = CyU3PDmaChannelCommitBuffer (chHandle, input->buffer_p.count, 0);
if (status != CY_U3P_SUCCESS)
{
       glDebugBuffer[0x10]++;
       CyU3PDebugPrint (4, "CyU3PDmaChannelCommitBuffer failed, Error code = %d\n", status);
}

   

CyU3PDMAReleaseLock(&glDMALock);

0 Likes
Anonymous
Not applicable

To debug it, we need to narrow down the error scenario.

   

Please check the state where you get the problem. As mentioned, you can use CyU3PGpifGetSMState to get this info.  You can use UART to see which function fails, and which error code do you get when the error happens. From the error code, we may be able to identify the reason for this.

   

As you mentioned, that the FX3 will sample only when the FPGA toggles a GPIO. Did you make sure that the host is reading the data when this happens? If the host is not reading the data fast, then the DMA buffers may get full and you will loose some data. So please make sure that the host is reading fast enough. One way, you can check the number of PROD and CONS event when the failure happens. 

0 Likes
Anonymous
Not applicable

Thank you for your reply.

   

I solved this problem by your comment.

   

I added mutex on GPIO interrupt callback.

   

And I added mutex on DMA read callback.

   

 

   

Thanks, Nishant.

0 Likes