I've come to the conclusion that this is a hardware problem with one Pyboard. I replaced the USB cable, tried different USB ports, then tried another PC and the problem persists. The Pyboard is in one of Damien's anodized cases and has never been connected to external hardware - I use it downstairs on my laptop for code development and for answering support queries. So I'm confident it hasn't suffered electrical abuse.
It's not a showstopper. The workround is to issue ctrl-D after running any code. If it annoys me enough I'll buy a replacement. But the symptom is odd. It is as if running
any code sets up some kind of long delay interrupt which, when triggered, causes a response to ctrl-D to take many seconds and then (sometimes) to fail to mount the SD card.
Here I powered up the PC and the Pyboard. I ran a simple code sample to completion and left it at the REPL while I ate my evening meal. I then issued ctrl-D. There was a delay of about 10 seconds before this occurred:
Code: Select all
>>>
PYB: sync filesystems
PYB: soft reboot
PYB: can't mount SD card
MSC disabled in boot.py: can't mount drives
MicroPython v1.9.3-240-ga275cb0 on 2018-01-16; PYBv1.1 with STM32F405RG
Type "help()" for more information.
>>>
It booted off the Flash rather than the SD card as evidenced by the message "MSC disabled in boot.py: can't mount drives" which is a print statement in /flash/main.py. A second ctrl-D fixed this:
Code: Select all
PYB: sync filesystems
PYB: soft reboot
MicroPython v1.9.3-240-ga275cb0 on 2018-01-16; PYBv1.1 with STM32F405RG
Type "help()" for more information.
>>>
No MSC message: it had booted off the SD card and was working normally. It never fails when running code, only at the REPL after code has run to completion. Weird.