2024-12-02 04:55 PM
I'm using a STM32F103RCT6
Flash contains my own boot loader in pages 0 thru 10 and main application in 11 thru 61.
When the device is flashed in manufacturing, protection is set to prevent reading and writing via the jtag port.
I need to update the bootloader. I can do that for product in inventory, but product in the field, in customers hands, I wrote a specific application that contains the new BL image and can load THAT application via a special communication process I have in place.
All my testing on the bench was with a device that is unprotected.
I executed the process in the field and the product reported that erasing pages 0 thru 10 failed. I suspect the reason is the protection bits are set.
I've read PM0075 - sections that talk about "unprotection" - and I think it states that to unprotect a mass chip erase must take place. I can see that if trying to use a tool via jtag.
Can I (via my revised application) unprotect flash memory without causing a mass erase? The Application note - PM0075 is not real clear on that point.
I believe I was able to perform such a task on a STM32F427 in the past - hoping I can do the same with a STM32F103.
Can I unprotect, via internal executing code, unprotect flash so I can erase and then re-write pages 0 thru 10?
Thanks.
2024-12-12 02:24 AM
Hi @Joe.H ,
removing read protection indeed comes with forced mass erase. The goal is to protect the user code thoroughly. It's possible to remove write protection and do programming, this is the case 2 in paragraph 2.4.2 of the PM075. The device doesn't know which part of your code is BL and which is the application, so it's not a problem to replace BL instead of the app as long as the capability is included in the code.
BR,
J
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.