Skip to main content
Visitor II
October 15, 2024
Question

Problem with reloading option bytes - STM32L010K4T6

  • October 15, 2024
  • 1 reply
  • 3944 views

I've implemented Read Out Protection in the firmware running on an STM32L010K4T6 MCU, but I'm experiencing unexpected behavior.

 

  1.  I change the option byte for read out protection level 1 and then read it back, and after resetting via the NRST pin, it still has the same value (No read out protection applied).

 

       2.  When I power cycle the device the option byte has a new modified value (Read out protection applied).

 

       3. I have also tried with a system reset but the result is same.

       4. I also try out with putting MCU in standby mode and waking up through RTC interrupt but it unable to load option bytes and hang the MCU

 

We cannot power cycle this device as it is situated in the field. How can we reload option bytes after writing to flash and reset the system without disconnecting power ?

 

Could you please provide the solutions ?
How to reload option bytes using NRST pin by applying reset through it? Or any work around for the same.

    This topic has been closed for replies.

    1 reply

    ST Employee
    October 18, 2024

    STM32L0 reference manual is the document for you to read:

    chapter "Reloading Option bytes by software"

    It is possible to request an Option byte reloading by setting the OBL_LAUNCH flag to 1 in
    the FLASH_PECR register. This bit can be set only when OPTLOCK = 0 (and PELOCK =
    0). Setting this bit, the ongoing write/erase is completed, but no new write/erase or read
    operation is executed.
    The reload of Option bytes generates a reset of the device but without a power-down. The
    options must be reloaded after every change of the Option bytes in the NVM, so that the
    changes can apply.

    Visitor II
    October 22, 2024

    Hello  Jiangfan ,

    We had already tried out the workaround suggested by ST, It is mentioned in ST MCU datasheet. It was not working.

    To tried search any solution of this issue on ST community/Forum and found one workaround as detailed below.

    As per this workaround we have to wake up the ST MCU in standby mode. We able to get expected output by waking up from standby mode.

     

    https://community.st.com/t5/stm32-mcus-security/problem-with-reloading-option-bytes-stm32l452re/td-p/355058

     

    Below are the steps we followed.

     

    1) Write the option bytes

     

    2) DO NOT set OBL_LAUNCH

     

    3) Set up RTC so it will wake up after a second

     

    4) Enter standby mode and wakeup by RTC.

     

    This will effectively reset everything after a second and MCU FW will work as expected.

     

    Could you please share this workaround and its steps with ST and confirm whether this is correct way to get rid of the issue ?

    ST Employee
    October 22, 2024

    You may try 

    Below steps.

     

    1) Write the option bytes

    2) delay some time, such as 100ms

     

    3) set OBL_LAUNCH