drivers: uart: stm32: Fixes timing of TX_DONE generation.
Corrects TX_DONE generation occuring to early on async api. Fixes #33866 Signed-off-by: Zisis Adamos <zisarono@gmail.com>
This commit is contained in:
parent
7b6a4da206
commit
7235b09bb2
1 changed files with 12 additions and 4 deletions
|
@ -776,6 +776,13 @@ static void uart_stm32_isr(const struct device *dev)
|
||||||
if (data->dma_rx.timeout == 0) {
|
if (data->dma_rx.timeout == 0) {
|
||||||
uart_stm32_dma_rx_flush(dev);
|
uart_stm32_dma_rx_flush(dev);
|
||||||
}
|
}
|
||||||
|
} else if (LL_USART_IsEnabledIT_TC(UartInstance) &&
|
||||||
|
LL_USART_IsActiveFlag_TC(UartInstance)) {
|
||||||
|
|
||||||
|
LL_USART_DisableIT_TC(UartInstance);
|
||||||
|
LL_USART_ClearFlag_TC(UartInstance);
|
||||||
|
/* Generate TX_DONE event when transmission is done */
|
||||||
|
async_evt_tx_done(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear errors */
|
/* Clear errors */
|
||||||
|
@ -893,8 +900,6 @@ void uart_stm32_dma_tx_cb(const struct device *dma_dev, void *user_data,
|
||||||
}
|
}
|
||||||
|
|
||||||
irq_unlock(key);
|
irq_unlock(key);
|
||||||
|
|
||||||
async_evt_tx_done(data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void uart_stm32_dma_replace_buffer(const struct device *dev)
|
static void uart_stm32_dma_replace_buffer(const struct device *dev)
|
||||||
|
@ -987,8 +992,11 @@ static int uart_stm32_async_tx(const struct device *dev,
|
||||||
|
|
||||||
LOG_DBG("tx: l=%d", data->dma_tx.buffer_length);
|
LOG_DBG("tx: l=%d", data->dma_tx.buffer_length);
|
||||||
|
|
||||||
/* disable TX interrupt since DMA will handle it */
|
/* Clear TC flag */
|
||||||
LL_USART_DisableIT_TC(UartInstance);
|
LL_USART_ClearFlag_TC(UartInstance);
|
||||||
|
|
||||||
|
/* Enable TC interrupt so we can signal correct TX done */
|
||||||
|
LL_USART_EnableIT_TC(UartInstance);
|
||||||
|
|
||||||
/* set source address */
|
/* set source address */
|
||||||
data->dma_tx.blk_cfg.source_address = (uint32_t)data->dma_tx.buffer;
|
data->dma_tx.blk_cfg.source_address = (uint32_t)data->dma_tx.buffer;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue