Hi all,
So I have read the numerous (maybe all?) threads about UART and DMA here.
I agree that a free running UART RX DMA is great and want to have that (also achieved draft version,
no problems there so far). But I agree further with others, that the next great thing would be to get an interrupt
when there is something in the DMA buffer to process. pmt has discussed this (imo very apparent&straightforward) need in great length here (and also why this is problematic/critical to do via UART interrupt alone): https://community.nxp.com/thread/301651
I know I could configure DMA so that I get an interrupt every byte, but at high rates and even
with just a signaling IRQ, I'd consider this too much load on the system and not what I want when using RX DMA.
Yes, I also agree just "polling" the RX DMA buffer periodically / at idle times is good enough and likely the way I will go if
this doesn't work out. But to get optimal low latency processing of received data I have to poll often, but high frequency polling will 99% of the time not be needed due to rare transfers. So best thing (again as discussed in https://community.nxp.com/thread/301651) would be to get a notification for the IDLE condition.
So the manual seems to document right in my face what I want: Set ILIE in C2 together with ILDMAS in C5,
and that should then generate DMA transfer requests...
But how should that work? Is it an RX DMA request? But then DMA would read an empty DREG and still it wouldn't help me generate an interrupt ..Or would it be kind of special DMA request that lets my RXA DMA generate INTHALF or INTMAJOR, or even generate some kind of error? All would be a little more helpful, but no further documentation on how this could work. => Anyway, setting ILIE&ILDMAS does not seem to have an effect at all, no additional character transferred into receive buffer, no additional INTHALF/INTMAJOR/DMA error interrupt, and even the IDLE flag keeps to set in the UART, so really nothing seems to process (and clear) it.
Alternatively, could it maybe work over its own DMA channel? Seems kind of wastfulness, but we have enough channels and I'd happily would set up a DMA channel just for IDLE requests... but no there are only RX and TX UART DMA requests.
Then after reading again and a lot more threads I found https://community.nxp.com/thread/301359
"I'm afraid that is a documentation error, ILDMAS in UART are not supported in Kinetis microcontrollers."
Can anyone confirm this again please? I still have minor but dwindling hopes that just changed; I mean this thread is from 2013 ... I am looking at the latest reference manual from 2017, in the year 2020. If above statement is true, why is the reference manual still pointing it out like that? ( I'm concretely looking at a MK24FN1M0xxx12. - https://www.nxp.com/webapp/Download?colCode=K24P144M120SF5RM&location=null Rev 3, July 2017)
(and just some further UART/DMA threads for reference beyond the two mentioned above: https://community.nxp.com/thread/110844 https://community.nxp.com/thread/318780 https://community.nxp.com/thread/508874 https://community.nxp.com/thread/301031 https://community.nxp.com/thread/525667 )
Afterwards questions: Has anyone conceived a scheme how to 100% safely use the UART IDLE interrupt together with DMA (due to potential side effects of clearing this flag by needing to read S1/D while receiving characters)? My current thinking would be that in the IDLE IRQ routine I need to check RAF and can only clear IDLE by reading S1/D (and then also clear underflow and flush fifo?) when RAF is not set (otherwise do clear IDLE only later outside of IRQ somehow).
Thank you for any response!