cancel
Showing results for 
Search instead for 
Did you mean: 

Need to ignore the unwanted start bit during the stop mode.

prudhvichitturi
Associate III

I am working on STM32L051R8, which is set to use Stop mode, which wakes up on the start bit.

I have a situation where the MCU wakes up on an unwanted start bit, and UART extracts unwanted data. The expected action is to ignore the unwanted data and enable it to wake up again when it is supposed to.

I have tried to use 

      SET_BIT( huart1.Instance->CR1, USART_CR1_RE );
      CLEAR_BIT( huart->Instance->CR1, USART_CR1_RE );
which kind of worked but when using below
    CLEAR_BIT( huart->Instance->CR1, USART_CR1_RE ); the current consumption increased.
 
 
 
9 REPLIES 9
Pavel A.
Evangelist III

How do you know that the start bit is unwanted and does not indicate valid data?

 

TDK
Guru

When you receive "unwanted data", ignore it and go back to sleep. As far as the UART is concerned, A start bit indicates valid data.

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

i know by parity check one way and the other way is the data is wrong.

 


@prudhvichitturi wrote:

i know by parity check one way and the other way is the data is wrong.


But you can't know that in advance - only after you have received the full frame!

As @TDK said, just ignore it and go back to sleep.

Ignoring is the part I am working on. I have to use the above lines in my code. so I have restarted the uart and started again from start, which is what is needed.

 

Maybe look at the Multiprocessor communication mode?

how to enable multi processor mode and how to deal with unwanted data

 

You'll need to study the Reference Manual - RM0377 Ultra-low-power STM32L0x1 advanced Arm®-based 32-bit MCUs:

https://www.st.com/resource/en/reference_manual/rm0377-ultralowpower-stm32l0x1-advanced-armbased-32bit-mcus-stmicroelectronics.pdf

 

I've not used it on STM32, but the general principle is that the UART doesn't interrupt unless it gets a valid address byte.

If the byte has a parity error, it will trigger the UART ErrorHandler callback and you can ignore it there.

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