pyboard, swapping sd cards
hi,
in my /flash directory i have a SKIPSD file
i mount my SD card as follows os.mount(pyb.SDCard(),'/sd')
using screen i enter a REPL session
I issue the command os.umount("/sd")
os.listdir('/') proves it's safe to remove the disk.
I extract it and put a new SD Card in.
When i issuse the command os.mount(pyb.SDCard(),'/sd') i get an OSError , error 19 ENODEV.
is it possible to swap SD cards whilst the pyboard is running? or does in need to be hard reset?
Device Crashes Catastrophically when accessing SD in certain situations
Steps to reproduce
- Make sure device has SD Card inserted.
- Make sure device has SKIPSD on internal flash
- Run the following in main.py on internal flash. This puts my device in a boot loop.
It seems os.listdir('/') in another module crashes the device after throwing an exception with a file on the SD card.
Some devices fail the listdir in test with memory allocation fail 7958574 bytes and some devices get stuck in a boot loop, immediately crashing and restarting without displaying an error.
Using STM32F439 on these devices
import os
import pyb
print(os.listdir('/'))
with open('/flash/test.py', 'wb') as file:
file.write(b"import os\nos.listdir('/')\n")
if 'sd' not in os.listdir('/'):
os.mount(pyb.SD, '/sd')
print("os.mount() successful")
print(os.listdir('/'))
with open('/sd/test.txt', 'wb') as file:
for i in range(10000):
file.write(b"This is twenty bytes.")
file = open('/sd/test.txt', 'rb')
try:
a = file.read()
except MemoryError:
print('Exception thrown as expected')
print(os.listdir('/'))
import test