cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4 UART behaviour

dtarrago
Senior
Posted on November 10, 2017 at 09:29

Hi,

In the application I'm currently working with, it is possible to have several devices (UART controlled) but it is not known if the device is connected or not. I use USART3, UART4, UART5. I measure each USART/UART device every X minutes in the following way: its correspondant UART is initialized, measurements/actions are taken and then UART is deinitialized. In this process I have also implemented a timeout so, in case there is no answer (for instance, when device is not connected), the UART is also deinitialized. After carrying out this process, micro goes to Stop2 mode.

When all USART/UART devices are connected everything runs as expected but when any of the UART devices is not connected, it seems USART/UART remains in a strange state: my application continues running OK but power consumption increases from tens of uA up to about 10mA!!!! So, what is the reason that can cause this behaviour?

(Note that I use HAL_UART_Receive_IT when trying to read from UART device. Should I use HAL_UART_AbortReceive_IT before deinitializing UART if no response is received?)

#uart #stm32l4
0 REPLIES 0