Hello,
For several days I have been blocking on several issues:
I have to save the data of a sensor in a file on the SD card.
1 - How to access the SD card reader?
2 - On the same subject: how to modify files on the "partition" which contains Root.py and main.py. As for writing there is no problem but to delete a file it blocks! It remains visible in the file explorer of the computer but is no longer accessible!
For other problem I open another Topics
Thank you for your help.
See you
Black STM32F407VE6 : access to the SD card and modify root files.
Re: Black STM32F407VE6 : access to the SD card and modify root files.
If you're going to write to the filesystem using micropython then you should disable USB Mass Storage or you'll get a corrupted filesystem.
Removing files from the internal filesystem can be done using os.remove(filename)
filename should be something like /flash/filename to access the internal filesystem from Micropython. You'd use /sd/filename to access the sdcard from Micropython.
Removing files from the internal filesystem can be done using os.remove(filename)
filename should be something like /flash/filename to access the internal filesystem from Micropython. You'd use /sd/filename to access the sdcard from Micropython.
Re: Black STM32F407VE6 : access to the SD card and modify root files.
I anderstand the problem
But if I want to write to the SD card I ve got an error :
and when I ask in a console
Is there an other module that allow me to access to the cardreader ?
But if I want to write to the SD card I ve got an error :
Code: Select all
>>>
paste mode; Ctrl-C to cancel, Ctrl-D to finish
=== import pyb
=== import os
=== os.mount(pyb.SDCard(), '/sd')
=== os.chdir('/sd')
===
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
AttributeError: 'module' object has no attribute 'SDCard'
>>>
Code: Select all
>>> dir(pyb)
['__class__', '__name__', 'DAC', 'RTC', 'ADC', 'ADCAll', 'CAN', 'ExtInt', 'Flash', 'I2C', 'LED', 'Pin', 'SPI', 'Switch', 'Timer', 'UART', 'USB_HID', 'USB_VCP', 'bootloader', 'delay', 'dht_readinto', 'disable_irq', 'elapsed_micros', 'elapsed_millis', 'enable_irq', 'fault_debug', 'freq', 'hard_reset', 'have_cdc', 'hid', 'hid_keyboard', 'hid_mouse', 'info', 'main', 'micros', 'millis', 'mount', 'repl_info', 'repl_uart', 'rng', 'standby', 'stop', 'sync', 'udelay', 'unique_id', 'usb_mode', 'wfi']
>>>
Re: Black STM32F407VE6 : access to the SD card and modify root files.
If the sdcard is configured then it should be mounted automatically at boot time. You shouldn't have to mount it yourself.
At least that's what used to happen on the pyboard. It's been a while since I tried the sdcard.
At least that's what used to happen on the pyboard. It's been a while since I tried the sdcard.
Re: Black STM32F407VE6 : access to the SD card and modify root files.
Hi @JacquesC, @JohnLittle has had some success with the sdcard:
viewtopic.php?f=12&t=3086&start=90#p38142
viewtopic.php?f=12&t=3086&start=90#p38142