Electronic – stm32 – is there a factory reset

microcontrollerresetstm32

for the past couple of months I have been developing software for a custom build board. Due to a non disclosure agreement i am not allowed to share the schematics , PCB layout or software of the board.

What i am allowed to share is that the board uses a Murata cmwx1zzabz module as proccesor and for lora communication. The proccesor in this module is a Stm32l0 which i was able to program for the past couple of months.

As i had a problem with the stability of the program (chrashed randomly after sometimes running perfectly for a couple of hours) i decided to let 3 of my 5 prototype boards run a program in a mode that uses one paticular sensor which seemed to cause problems. As a refference i picked another prototype board and let it run the same software version as the other three prototypes but in a different mode.

The idea was to let the code run on the four prototypes and let it run the whole weekend as a stability check. The last prototype board i wanted to use for an energy consumption test. I loaded the same software as the other boards onto the board and did some measurements.

It was a terrible idea to let all of my prototypes run the same software because keil uvision 5 cant program any of the boards anymore. I get this error:

enter image description here

enter image description here

What i have tried to solve the problem is:

  • use a different ST-link
  • use different cables
  • pulled the boot0 pin to '1' and tried to program it (normally pulled down)
  • tried to load the program onto a Discovery board (It seems to work but i did stop the programming halfway through the procces because i am afraid to brick the disco board too)
  • Created a "fresh" CubeMX project and tried to load the program on to the prototypes without succes

Does anyone know a way to do a factory reset or has a sollution for this problem? My internship is almost finished and i dont really have the time to wait +- 4 weeks to wait on new prototypes.

On the plus side the boards are still running but have some inconsistent readings. The only change i made to this version of the software and an older variant was to change return uwTick; to return HW_RTC_GetTimerValue(); in the HAL_gettick() function.

some additional info of when i connect the stlink in my PC with the prototye connected.
enter image description here

Best Answer

It was a terrible idea to let all of my prototypes run the same software because keil uvision 5 cant program any of the boards anymore.

It wasn't, you've found a problem. A test where nothing fails is a poor test.

Try the ST Link Utility, and verify if the RESET pin is actually connected to the programmer.
Right now it says "No Target Connected", meaning the debug core inside the ARM Cortex M0 is not reachable.
Either because the lock bits of the manufacturer are set, or pin function was changed by your code.
Did you use the GPIO port configuration lock register?

There is no such thing as a factory reset if you cannot get into the chip.
If mass flash erase is not available over SWD/JTAG. Then maybe over a bootloader (uart/usb).
Otherwise you have to replace the chip since you might have accidentally activated read out protection level 2. (RDP level 2, see reference manual)

Also sometimes a lower clock on the SW interface can help if you have a poor board design.