From ae1ecf87f6b8d7c34b32af0547f118ff7697c2ef Mon Sep 17 00:00:00 2001 From: Fredrik Thulin Date: Thu, 2 Jun 2016 14:56:56 +0200 Subject: Use DMA for UART RX instead of interrupts. DMA is more efficient and less prone to miss characters than interrupts. An open question is if circular mode is really the best. If someone copy-pastes more than the RX buffer size of configuration into the CLI, we risk the DMA controller catching up with the reader and overwriting data not yet read. Since we don't have flow control back to the users terminal, we will always fail if too much data is entered before we can process it. The question is if failing to stuff new data at the end of a buffer might be better than data being overwritten - thus messing up the commands in unpredictable ways. --- stm-uart.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'stm-uart.c') diff --git a/stm-uart.c b/stm-uart.c index 2f3aabe..59bbbe6 100644 --- a/stm-uart.c +++ b/stm-uart.c @@ -37,8 +37,11 @@ #include -UART_HandleTypeDef huart_mgmt; -UART_HandleTypeDef huart_user; +UART_HandleTypeDef huart_mgmt; /* USART1 */ +UART_HandleTypeDef huart_user; /* USART2 */ + +DMA_HandleTypeDef hdma_usart_mgmt_rx; +DMA_HandleTypeDef hdma_usart_user_rx; #define DEFAULT_UART STM_UART_USER -- cgit v1.2.3