Figured out the problem - the STM32C0116-DK when connected to USB must not be opened by any host app or MCU will detect onboard programmer and hard faults. My shame ;)
I'm having two STM32C0116-DK boards. So I've made the simple experiment, unpacked the second board that is shipped with _stock_ LED blinking project and locked it to RDP 1 with :
Repowered it and guess what ? It stopped blinking exactly as my simple project above. I guess there is real problem with STM32C0 series concerning this issue.
Made the same experiment with STM32C0316-DK and all is working as expected - RDP 1 do not crash the firmware. Seems like problem is related at least to STM32C0116
I did the test with the C011DK, C031DK and NUCLEO, I never observed the issue. I changes the RDP with cube programmer and then after a POR the LED MCU is working fine (LED blinking with HAL delay of 100ms).
Which product revision are you using ? And did you do the POR after changing the RDP ?
Figured out the problem - the STM32C0116-DK when connected to USB must not be opened by any host app or MCU will detect onboard programmer and hard faults. My shame ;)
Thank you for finding this and reporting it back here!
Regards
/Peter
In order 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.