Hello,
I am using i.MX8 hardware and I am using DMA interface to transfer data. But I have to poll till transfer completes. I am planning to implement timeout for DMA transfer. what would be the ideal timeout I will use?
Thanks in advance.
Hi @thediptendu!
Thank you for contacting NXP Support!
There are eDMA example code in the path like M4_SDK/boards/mekmimx8qx/driver_examples/edma and boards/mekmimx8qx/driver_examples/flexcan/loopback_edma_transfer. In these example code, we can see that after we start the eDMA transfer, we need to wait for the complete signal to be true to know that the transfer is done.
During the time that eDMA is transferring, actually the program don't need to poll the complete signal in a loop, and it can do other things. (In the example code, it don't have other things to do, so that's why it's waiting in a while loop) But when the program want to know whether the eDMA transfer is done before it can start the next transfer, it need to wait for the complete signal to be true.
So I guess the "timeout" customer want is actually a timer, like the one in boards/mekmimx8qx/driver_examples/tpm/timer, so that they can check the eDMA complete signal after a period of time.
Best Regards!
Chavira
Hello Chavira,
Thanks for replying. If we are waiting in while loop, then we are continuously waiting. what if the signal never becomes true? in that scenario, the code is stuck there. So my intention to implement a timeout and return FAIL if it does not come out of the loop.
>> During the time that eDMA is transferring, actually the program don't need to poll the complete signal in a loop, and it can do other things.
How we can do other things while polling a signal?
>> M4_SDK/boards/mekmimx8qx/driver_examples/edma and boards/mekmimx8qx/driver_examples/flexcan/loopback_edma_transfer.
Please send me the link to refer.
Thanks,
Diptendu
HI @thediptendu!
Then you can set up a timer. When the timer is triggered, it will check the eDMA complete signal. And by doing this, it don't need to poll the complete signal in a loop.
https://github.com/nxp-mcuxpresso/mcux-sdk-examples/tree/main/mekmimx8qx/driver_examples/edma
Best Regards!
Chavira