BLACK STM32F407ZGT: factory resetting

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
yuanyanhui
Posts: 10
Joined: Wed Mar 20, 2019 11:25 am

BLACK STM32F407ZGT: factory resetting

Post by yuanyanhui » Tue Jul 30, 2019 2:02 am

I flashed a BLACK STM32F407ZGT using mcauser's github repo. After resetting the board while connected to the computer, it says main.py was corrupted. How to do a factory resetting on this board? There are instructions for the official pyboard. But it uses green and yellow LEDs to control the timing of releasing the reset button. It seems this method does not apply to BLACK STM32F407ZGT.

yuanyanhui
Posts: 10
Joined: Wed Mar 20, 2019 11:25 am

Re: BLACK STM32F407ZGT: factory resetting

Post by yuanyanhui » Tue Jul 30, 2019 3:01 am

Reflashed firmware and the problem is still there. I even executed some Arduino code to make sure micropython was wiped out before reflashing. Why?

User avatar
jimmo
Posts: 517
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia

Re: BLACK STM32F407ZGT: factory resetting

Post by jimmo » Tue Jul 30, 2019 5:16 am

To factory reset the filesystem: holding down hte USR button after reset, it cycles through four stages. If you have a single LED then it flashes the number of times to indicate which stage. If you release USR in stage 3 it will reset the filesystem.

yuanyanhui
Posts: 10
Joined: Wed Mar 20, 2019 11:25 am

Re: BLACK STM32F407ZGT: factory resetting

Post by yuanyanhui » Tue Jul 30, 2019 7:24 am

@jimmo Thank you for your help. Using button K1 and RST, the board was reset successfully. I still got two questions regarding the file system:
1. Why reflashing micropython doesn't erase the corrupted file system.
2. Arduino code is burned using stlink, while micropython using dfu. Are codes flashed into different memory locations with these two methods?

User avatar
jimmo
Posts: 517
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia

Re: BLACK STM32F407ZGT: factory resetting

Post by jimmo » Tue Jul 30, 2019 8:03 am

The flashing process only writes the areas where it needs to. You can optionally do a full erase during flashing if you want. (Mass erase, as opposed to the page-erase that the flash process does).

MicroPython keeps the code and filesystem in separate areas of flash, so flashing code will not overwrite the filesystem. This is actually really handy while doing MicroPython firmware development, not having to re-upload test code and libraries every time.

If your Arduino sketch was small it likely only wrote a small section of flash, leaving everything else intact.

yuanyanhui
Posts: 10
Joined: Wed Mar 20, 2019 11:25 am

Re: BLACK STM32F407ZGT: factory resetting

Post by yuanyanhui » Tue Jul 30, 2019 10:17 am

Thanks again for the clarification.

User avatar
mcauser
Posts: 400
Joined: Mon Jun 15, 2015 8:03 am

Re: BLACK STM32F407ZGT: factory resetting

Post by mcauser » Fri Aug 09, 2019 3:52 am

Is it possible to trigger the filesystem reset from the REPL?

Post Reply