I am implementing a protocol decoder which receives bytes through UART of a microcontroller. The ISR takes bytes from the UART peripheral and puts it in a ring buffer. The main loop reads from the ring buffer and runs a state machine to decode it.
The UART internally has a 32-byte receive FIFO, and provides interrupts when this FIFO is quarter-full, half-full, three-quarter full and completely full.
- How should I determine which of these interrupts should trigger my ISR?
- What is the trade-off involved?
Note - The protocol involves packets of 32-byte (fixed length), send every 10ms.