[STM32F407VGT6] How to erase flash fs?
-
- Posts: 8
- Joined: Sun Aug 25, 2019 8:50 am
[STM32F407VGT6] How to erase flash fs?
I compile micropython to DIY MORE STM32-407 board (with STM32F407VGT6 MCU) using STM32F4DISC as starting point.
My mpconfigboard.h available at https://pastebin.com/A6J2XcLb
Almost all works without problem, but content of flash filesystem is garbage. I can format it from PC and all OK till next firmware update.
What wrong with my config?
My mpconfigboard.h available at https://pastebin.com/A6J2XcLb
Almost all works without problem, but content of flash filesystem is garbage. I can format it from PC and all OK till next firmware update.
What wrong with my config?
Re: [STM32F407VGT6] How to erase flash fs?
You must not write the file system both from the PC and from MicroPython at the same time. The PC caches the FS is not awayr of changes made by MicroPython. And if you write from the PC, take care to unmount (eject) it before you unplug the device.
You can format the flash from Micropython at the REPL prompt by:
import uos
uos.VfsFat.mkfs("/flash")
Unmount (eject) the flash drive from the PC before you do that.
P.S.: Because of this continuous risk of damaging the file system I do not enable the device a flash drive. Instead I use tools like pyboard.py, rshell or ampy to transfer files. In case of a LAN connection, you can use Webrepl, rshell of ftp.
You can format the flash from Micropython at the REPL prompt by:
import uos
uos.VfsFat.mkfs("/flash")
Unmount (eject) the flash drive from the PC before you do that.
P.S.: Because of this continuous risk of damaging the file system I do not enable the device a flash drive. Instead I use tools like pyboard.py, rshell or ampy to transfer files. In case of a LAN connection, you can use Webrepl, rshell of ftp.
-
- Posts: 8
- Joined: Sun Aug 25, 2019 8:50 am
Re: [STM32F407VGT6] How to erase flash fs?
There is garbage after flashing.
Also noted that after flashing STM32F4DISC-20190529-v1.11.dfu to STM32F4DISC i got same problems - there is filenames on FS, but content is garbage.
Also noted that after flashing STM32F4DISC-20190529-v1.11.dfu to STM32F4DISC i got same problems - there is filenames on FS, but content is garbage.
-
- Posts: 8
- Joined: Sun Aug 25, 2019 8:50 am
Re: [STM32F407VGT6] How to erase flash fs?
And flash formatting not working...
>>> import uos
>>> uos.VfsFat.mkfs("/flash")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'str' object has no attribute 'readblocks'
>>> import uos
>>> uos.VfsFat.mkfs("/flash")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'str' object has no attribute 'readblocks'
Re: [STM32F407VGT6] How to erase flash fs?
Your're right. Looks Like I'm lost in versions an dialects. Then you can still erase flash with make erase and re-flash the firmware. That's the crowbar method.
-
- Posts: 8
- Joined: Sun Aug 25, 2019 8:50 am
Re: [STM32F407VGT6] How to erase flash fs?
There is a note somewhere about flash fs part not erased on firmware upgrade to save it content...
Finaly found solution - USER button press and hold while reseting board cleared flash fs. Tried this method before, but able may be not holding long enough or released in wrong moment.
Finaly found solution - USER button press and hold while reseting board cleared flash fs. Tried this method before, but able may be not holding long enough or released in wrong moment.
-
- Posts: 8
- Joined: Sun Aug 25, 2019 8:50 am
Re: [STM32F407VGT6] How to erase flash fs?
Boot modes are:
...
3. Green and orange LED together, *filesystem reset*: resets the flash
filesystem to its factory state, then boots in safe mode.
So with only one LED with invers controll very hard to get this mode...
...
3. Green and orange LED together, *filesystem reset*: resets the flash
filesystem to its factory state, then boots in safe mode.
So with only one LED with invers controll very hard to get this mode...
Re: [STM32F407VGT6] How to erase flash fs?
If your mpconfigboard.h file only defines LED1 and doesn't define LED2, then the code will use a slightly different behaviour. Instead it will flash the LED 1, 2, or 3 times.
See: https://github.com/micropython/micropyt ... ain.c#L328
See: https://github.com/micropython/micropyt ... ain.c#L328
-
- Posts: 8
- Joined: Sun Aug 25, 2019 8:50 am
Re: [STM32F407VGT6] How to erase flash fs?
Thank you. I already found this part, but don't understand why i can't catch right moment.
For one STM32F4DISCOVERY, that work strange i plan to build firmware with explicitly format flash fs on boot.
For one STM32F4DISCOVERY, that work strange i plan to build firmware with explicitly format flash fs on boot.