I'm having strange issues with an STM32F4 Discovery board. Microphython is installed and works, the device appears in Windows and I can write to it. But, for some reason, I get odd "syntax errors" where there is no syntax error. I have to reboot the board with Ctrl-D several times and then it will work. Or sometimes it just won't until I edit the file and add a newline somewhere and save again.
What's going on?
flash read errors?
Re: flash read errors?
If you're sharing the file system using USB Mass Storage, then the host can wind up corrupting the filesystem.
Re: flash read errors?
I thought it was possible to do that? How should I test my code? Is it possible to disable USB mass storage for testing?
Re: flash read errors?
Hello hij, you can disable USB Mass storage mode with the function pyb.usb_mode called in boot.py (see http://docs.micropython.org/en/latest/p ... t=usb_mode). You may also usw dhylands scripts rshell.py of pyboard.py, which do not use the mass storage mode, although i do not know whther they work on Windows. I have the same observations sometimes, but I'm using a Linux host. It's caused by the host updating the file system slowly. On Unix, I can force the update with the 'sync' command. I do not know whether something like that is available in Windows, at least not in the standard package. Unmounting the Micropython USB drive should work, but it's not comfortable.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: flash read errors?
@dhylands, @Damien This issue crops up with great regularity. The Pyboard tutorial recommends a way of working which is frankly broken. Given that the cause is implicit in the USB mass storage specification it isn't going to get fixed. In my view it would be better if Pyboards were shipped with mass storage disabled by default, and the docs amended to recommend rshell.
I'd be happy to contribute some writing but I only have Linux boxes so I'd need some guidance on the OSX and Windows platforms.
I'd be happy to contribute some writing but I only have Linux boxes so I'd need some guidance on the OSX and Windows platforms.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: flash read errors?
I've been using rshell under cygwin and its been working fine. I try it from time to time using OSX and will be trying it more frequently as I'll be getting a Mac laptop for work soon (within the next month).
Re: flash read errors?
Thanks for the answers. I'll be tryng the suggestions.
I'm trying to understand the problem. Is it that there are two devices mounting a partition at the same time?
If so, the fix would probably be to use MTP mode instead of USB mass storage. This is how my phone does it. To the end user MTP is basically the same as USBMS but under the hood it's not reading blocks from raw storage, but files from the OS. I have no idea though how much work this would take.
I'm trying to understand the problem. Is it that there are two devices mounting a partition at the same time?
If so, the fix would probably be to use MTP mode instead of USB mass storage. This is how my phone does it. To the end user MTP is basically the same as USBMS but under the hood it's not reading blocks from raw storage, but files from the OS. I have no idea though how much work this would take.
Re: flash read errors?
Yep - the disadvantage of MTP is that there is no Mac support out-of-the-box (well there is the Android MTP file transfer program which is free but seems fairly buggy). And somebody needs to write the MicroPython side. I've done device side MTP for FirefoxOS, but I had the advantage of the linux kernel drivers and some of the infrastructure provided by Android's C++ code.