G'Day all,
Just curious - if I setup a UART, can I also get GPIO interrupts off the UARTs Rx pin. I'll be doing the UART Rx via DMA, and I know how much data to expect in advance.
I'd like to be able to time out the DMA UART Rx operation if it takes too long (e.g. the transmitter stops transmitting mid way for some reason).
Was thinking of doing this by setting up the DMA UART Rx and at the same time enabling a falling edge GPIO interrupt on the Rx pin.
When data starts coming in, DMA will automagically take care of it, and the GPIO interrupt on the Rx pin will fire. In the GPIO interrupt disable the GPIO interrupt so that it doesn't keep firing (only needs to fire on the first falling edge), and I can start a timer that will fire shortly after I expect the DMA to complete (remember I know the baud rate and how much data is coming).
If the DMA completion interrupt fires first, all is well and I clean up the DMA and reset the timeout timer.
If the timer interrupt fires first, then the DMA operation took too long. I clean up the timer interrupt and I reset the DMA operation & arrange to try it again at some point later.
Cheers
Julian