[stm32f4-disco] Problem after reset

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
Antek
Posts: 3
Joined: Wed Sep 13, 2017 1:26 pm

[stm32f4-disco] Problem after reset

Post by Antek » Wed Sep 13, 2017 1:31 pm

Hello,

Sometimes after reset my files main.py and boot.py are corrupted and are made of dots only (....).
My board flashes then two LEDs for a while and does not run my files.
I cannot find why and when is it happening. Any ideas?

Thanks in advance

Antek
Posts: 3
Joined: Wed Sep 13, 2017 1:26 pm

Re: [stm32f4-disco] Problem after reset

Post by Antek » Mon Sep 18, 2017 1:05 pm

It turned out that the whole difference is in unmounting the device from my PC with windows7.

After every change in python files, I have to do remove safely. :roll:
That way the files will not be corrupted.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: [stm32f4-disco] Problem after reset

Post by pythoncoder » Mon Sep 18, 2017 3:30 pm

The sure way to avoid file corruption with all MicroPython targets is to disable MSC (USB mass storage) mode in boot.py and manage the filesystem using a tool like rshell https://github.com/dhylands/rshell. There is a fundamental problem in that USB mass storage is a single master design that assumes that the USB subsystem is a dumb disk drive which cannot modify the files. Obviously a MicroPython device can. Sooner or later that will jump up and bite you ;)

In my view the official docs should suggest this way of working but I guess MSC mode is simple and intuitive for beginners.
Peter Hinch
Index to my micropython libraries.

Post Reply