Skip to main content
Explorer
March 11, 2025
Question

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

  • March 11, 2025
  • 3 replies
  • 1451 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.

    3 replies

    Super User
    March 11, 2025

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

     

    Explorer
    March 12, 2025

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

     

    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.

    Super User
    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.

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

     

    Super User
    March 12, 2025

    Maybe look at the Multiprocessor communication mode?

    Explorer
    March 12, 2025

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

     

    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.