cancel
Showing results for 
Search instead for 
Did you mean: 

How reinit UART?

EAlek.2
Associate II
  1. After reset MCU init UART - 8bits, no parity bit, init DMA RX and TX, interrupts on - works Ok.
  2. Reinit UART - 9 bits, even parity bit, no DMA - works Ok.
  3. Reinit UART the same as p.1 - doesn't work interrupts.
3 REPLIES 3
TDK
Guru

Before reinitializing, reset the peripheral with the RCC force/release reset bits to get it back to the as-reset configuration.

__HAL_RCC_USART1_CLK_ENABLE();
__HAL_RCC_USART1_FORCE_RESET();
__HAL_RCC_USART1_RELEASE_RESET();

The initialization is likely expecting this to be as-reset.

If you feel a post has answered your question, please click "Accept as Solution".

DMA would need to be 16-bit for the 9-bit mode.

Perhaps you could double check the content of the DMA controller registers, and share those. If this is a bug it could probably be added to the list.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

> doesn't work interrupts

Which interrupts? How do you know they don't work?

Debug as usually: read out and check relevant UART, DMA, NVIC registers.

JW