cancel
Showing results for 
Search instead for 
Did you mean: 

I am using the STM32L073 and I need to disable the UART while I send a timed BREAK/MARK on the TXD line using simple GPIO command. How do I "deinit" the UART and then "init" again?

Graham1904
Associate III
 
This discussion is locked. Please start a new topic to ask your question.
5 REPLIES 5
waclawek.jan
Super User

You don't need to do anything particular in the UART, just change the Tx pin's setting in respective GPIO_MODER to GPIO_Output, perform the operation you want, and then change it back to AF.

JW

Many thanks. I go it to work. HAL_UART2_Init() after the GPIO toggling?

waclawek.jan
Super User

I don't use Cube/HAL, but I don't see the reason to do so.

JW

Surely you must re-configure the UART2?

i don't see any reason why you would need to reconfigure it, you only mess with the GPIO registers not usart periephal registers.

i believe that at most, messing with the GPIO, would toggle the TE(bit 3 -> Transmit enable) or UE(bit 0 -> usart enable) in USARTx_CR1 register, but you would have to confirm it with debugger. i suspect that it wont do anything to usart registers in the end, and simple changing the GPIO back to Alternative function will make it work again.

Announcement

We’re moving the ST Community to a new platform to give you a better and more reliable community experience.