rosflight / airbourne_f4

Be the Jason Bourne of the skies
BSD 3-Clause "New" or "Revised" License
6 stars 6 forks source link

Multiple calls to UART::DMA_Rx_IRQ_callback #31

Open plusk01 opened 6 years ago

plusk01 commented 6 years ago

In the UART code, you currently have both the USART and the DMA peripherals calling UART::DMA_Rx_IRQ_callback on interrupt. The USART is configured to fire on RXNE (byte received) and the DMA is configured to fire on TC (transfer complete).

The code in UART::DMA_Rx_IRQ_callback seems to be resilient to multiple calls (i.e., no data seems to be re-read or lost), but it seems redundant. Can you help me understand why you decided to hook up both interrupts?

superjax commented 6 years ago

Haha, yeah, this is kinda weird

The DMA callback only fires when the transfer completes, when the buffer fills, or when it half-fills. In testing, I felt like this wasn't often enough and would often be waiting for bytes. The USART_RXNE interrupt fires much more often, so I used that as well.