mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 16:25:31 +03:00
Fix UART TX DMA corruption
- Use ATOMIC while examining and updating DMA status - Mask premature TC interrupt by examining transfer count register (CNTDR/NTDR) for F1 and F4.
This commit is contained in:
parent
4bacbdcc91
commit
697e5d3925
8 changed files with 94 additions and 46 deletions
|
@ -109,12 +109,9 @@ void uart_tx_dma_IRQHandler(dmaChannelDescriptor_t* descriptor)
|
|||
{
|
||||
uartPort_t *s = (uartPort_t*)(descriptor->userParam);
|
||||
DMA_CLEAR_FLAG(descriptor, DMA_IT_TCIF);
|
||||
DMA_Cmd(descriptor->ref, DISABLE);
|
||||
DMA_Cmd(descriptor->channel, DISABLE); // XXX F1 needs this!!!
|
||||
|
||||
if (s->port.txBufferHead != s->port.txBufferTail)
|
||||
uartStartTxDMA(s);
|
||||
else
|
||||
s->txDMAEmpty = true;
|
||||
uartTryStartTxDMA(s);
|
||||
}
|
||||
|
||||
// XXX Should serialUART be consolidated?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue