2017-11-24 06:08 AM
I have a simple project that toogle a LED. I try to add software protection to it.
Basically, it does :
main()
{
Init_GPIO_for_LED();
LED_ON();
while(i++ < 10000000) {}; // yes, ugly
LED_OFF();
while(1) {} // wait forever
}
If I flash it, I see the LED light for some time.
Then, I want to protect the program, so I use the ST-Link Utility to switch the RDP to Level 1.
$ ST-LINK_CLI.exe -OB RDP=1
STM32 ST-LINK CLI v3.0.0.0
STM32 ST-LINK Command Line Interface
ST-LINK SN : [edited]
ST-LINK Firmware version : V2J24M11
Connected via SWD.
SWD Frequency = 4000K.
Target voltage = 0.0 V.
Connection mode : Normal.
Device ID:0x429
Device flash Size : 64 Kbytes
Device family :STM32L100x6xxA/L15xx6xxA
Updating option bytes...
Option bytes updated successfully.
I perform a hard reset after, and I can see the RDP level is set :
$ ST-LINK_CLI.exe -rOB
STM32 ST-LINK CLI v3.0.0.0
STM32 ST-LINK Command Line Interface
ST-LINK SN : [edited]
ST-LINK Firmware version : V2J24M11
Connected via SWD.
SWD Frequency = 4000K.
Target voltage = 0.0 V.
Connection mode : Normal.
Device ID:0x429
Device flash Size : 4095 Kbytes
Device family :STM32L1xxx4xxA-xxx6xxA-xxx8xxA
Option bytes:
RDP : Level 1
BOR : Level 0
IWDG_SW : 1
nRST_STOP : 1
nRST_STDBY : 1
Data0 : 0x00
Data1 : 0x00
SPRMOD : 0
WRP : 0x00000000
But now, there is no LED light at all. It seems the program doesn't start.
I can switch back to level 0, and the flash is mass erased, as explained in the docs, but I need level 1 to read-protect the code.
I'm on a STM32L151C8T6A, and the LED pin is the M19.
What's wrong?
Thanks in advance.
#rdp #protection #flashSolved! Go to Solution.
2017-12-01 04:15 AM
The problem was in the hardware
There was a capacitor that prevented the complete reset of the STM32, so there was no restart from the beginning of the program!
2017-12-01 04:15 AM
The problem was in the hardware
There was a capacitor that prevented the complete reset of the STM32, so there was no restart from the beginning of the program!