Hello,
I need to implement a ring buffer for receiving from UART via DMA. For consistency, I'd like to keep using the SDK.
What I want is to set up UART and DMA once, and have a circular buffer that overwrites itself over and over, completely unattended (I can't miss a character, ISR to switch buffer would be too slow). I'll have a periodic task reading from the ring buffer.
The thing is, I just cannot figure out how to do it. The most obvious way I've tried breaks the SDK's abstraction, making it (very) leaky, and also doesn't work:
Looking into edma_driver.h, there is this function EDMA_DRV_ConfigLoopTransfer() which looked to akin to EDMA_DRV_ConfigMultiBlockTransfer() that the UART driver uses. I could find a Freescale document recommending it, but the SDK back there seemed different back then and it tells me to call EDMA_DRV_RequestChannel() beforehand, which is not available anymore: https://www.nxp.com/docs/en/supporting-information/Enhanced-Direct-Memory-Access-Controller-Training...
I tried:
So, is there a sensible way to do it? Or is the SDK really just lacking and I have to fiddle with registers?
Attached, a test project of mine. #define DMA_LOOP turns on the looping attempt. Using S32K148EVB-Q176.
Best regards,
已解决! 转到解答。
Hi Wesley,
the SDK does not cover 100% functionality of the microcontroller. The DMA module itself allows us to handle almost all operations and situations we can think about. However, the UART driver does not cover this use-case. As we do not support modifications of SDK code, this should be implemented rather by your own code.
Regards,
Lukas
Hi Wesley,
the SDK does not cover 100% functionality of the microcontroller. The DMA module itself allows us to handle almost all operations and situations we can think about. However, the UART driver does not cover this use-case. As we do not support modifications of SDK code, this should be implemented rather by your own code.
Regards,
Lukas