2024-02-29 09:21 PM
Hello .
According to the reference manual, the default RDP level is set to level 1. However, after performing a full erase with ST-Link and then writing the hex file, the RDP level was found to be set to 0.
I would like to set the RDP level to 1 at the stage of writing the hex file with ST-Link without using software to control the registers. Could you please tell me how to do this?
Best regards,
aki
Solved! Go to Solution.
2024-03-03 11:45 PM
Hello @aki49
yes option byte could be modified from embedded software and you can use HAL do do this.
Please find link related to this topics
https://community.st.com/t5/stm32-mcus/how-to-program-stm32-option-bytes-with-the-hal-api/ta-p/49660
https://community.st.com/t5/stm32-mcus-products/flash-rdp-activate/td-p/568517
Best regards,
Frantz
2024-02-29 10:35 PM
Hell @aki49 ,
a you can read in the reference manual
https://www.st.com/resource/en/reference_manual/rm0444-stm32g0x1-advanced-armbased-32bit-mcus-stmicroelectronics.pdf
page 81/1390
User and read protection option bytes
Flash memory address: 0x1FFF 7800
Reset value: 0xFFFF FEAA (ST production value)
So default value of RDP = 0xAA which is RDP level 0.
You can modify the option byte could be change thanks programming tools like STM32CubeProgrammer.
You can modify it in command line :
cd "\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin"
STM32_Programmer_CLI.exe -c port=SWD mode=UR -ob RDP=0xBB
If you are using an other programming tools, you probably have interface to change option byte.
Best regards,
Frantz
2024-03-03 06:31 PM
Hello Frantz LEFRERE,
Thank you for your reply.
I misunderstood the default values and understood that it is possible to rewrite using STM32CubeProgrammer.
It seems that changes can also be made through software processing without using STM32CubeProgrammer.
If there are any sample programs available, could you please let me know?
Thank you in advance.
aki
2024-03-03 11:45 PM
Hello @aki49
yes option byte could be modified from embedded software and you can use HAL do do this.
Please find link related to this topics
https://community.st.com/t5/stm32-mcus/how-to-program-stm32-option-bytes-with-the-hal-api/ta-p/49660
https://community.st.com/t5/stm32-mcus-products/flash-rdp-activate/td-p/568517
Best regards,
Frantz
2024-03-10 04:45 PM
Hello @Frantz LEFRERE
I was able to resolve my issue.
I want to express my gratitude for the valuable information you provided.It was very helpful.
Best regards,
aki49