Skip to main content
Associate III
March 11, 2025
Question

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

  • March 11, 2025
  • 16 replies
  • 1482 views

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.
 
 
 
This topic has been closed for replies.

16 replies

Pavel A.
March 11, 2025

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

 

Associate III
March 12, 2025

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

 

Andrew Neil
Super User
March 12, 2025

@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.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
TDK
March 11, 2025

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""."
Associate III
March 12, 2025

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.

 

Andrew Neil
Super User
March 12, 2025

Maybe look at the Multiprocessor communication mode?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Associate III
March 12, 2025

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

 

Andrew Neil
Super User
March 12, 2025

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.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.