Can microSD card be accessed in UIFlow or with MicroPython?
-
I can not find any instruction in the documentation regarding how to access the tf card with python.
Can anyone help me? -
Take a look at the micro python official forums, there is a discussion about it
-
Not possible in uiflow yet. Micropython is easy
import os
os.mountsd()
os.listdir('/sd')etc...
-
@lukasmaximus
thank you for your reply.
But when I tried to exec os.mountsd I got an error as below.os.mountsd()
W (20141) sdspi_host: spi bus changed (1 -> 2)
E (20141) sdspi_host: spi bus 2 not available
E (20141) vfs_native: Failed to initialize SDcard (258).
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 5] EIO -
@zhufu86 said in Can TF card be accessed in UIFlow or with MicroPython?:
@lukasmaximus
thank you for your reply.
But when I tried to exec os.mountsd I got an error as below.os.mountsd()
W (20141) sdspi_host: spi bus changed (1 -> 2)
E (20141) sdspi_host: spi bus 2 not available
E (20141) vfs_native: Failed to initialize SDcard (258).
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 5] EIOCan you post all you code please
-
I just exec in REPL.
import os
os.mountsd()nothing else....
I also tried os.SDMODE_4LINE, os.SDMODE_1LINE and os.SDMODE_SPI with os.sdconfig(...) before mountsd(), but none of them worked.
Forgot to say, I'm using M5Stack Fire.
-
@zhufu86 said in Can TF card be accessed in UIFlow or with MicroPython?:
I just exec in REPL.
import os
os.mountsd()nothing else....
I also tried os.SDMODE_4LINE, os.SDMODE_1LINE and os.SDMODE_SPI with os.sdconfig(...) before mountsd(), but none of them worked.
Forgot to say, I'm using M5Stack Fire.
You also need the machine, sdcard and dpi library imported. That’s why I recommend that you visit MicroPython.org
-
thank you.
I went to MicroPython.org but found nothing helpful.
Finally, I erased the firmware and burned the M5S with the UIFlow-v1.3.1-Beta firmware.It worked, with the code below.
>>> import uos >>> uos.sdconfig(uos.SDMODE_SPI,clk=18,mosi=23,miso=19,cs=4) I (53596) gpio: GPIO[23]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pull down: 0| Intr:0 I (53596) gpio: GPIO[19]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pull down: 0| Intr:0 I (53604) gpio: GPIO[18]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pull down: 0| Intr:0 >>> uos.mountsd() W (65959) sdspi_host: spi bus changed (1 -> 2) I (65959) gpio: GPIO[4]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulld own: 0| Intr:0 --------------------- Mode: SPI Name: SU08G Type: SDHC/SDXC Speed: default speed (25 MHz) SPI speed: 40 MHz Size: 7580 MB CSD: ver=1, sector_size=512, capacity=15523840 read_bl_len=9 SCR: sd_spec=2, bus_width=5 >>> -
Funny...
I re-burned back to UIFlow-v1.2.3, and it also worked.
>>> import uos >>> uos.sdconfig(uos.SDMODE_SPI,clk=18,mosi=23,miso=19,cs=4) >>> uos.mountsd() W (104277) sdspi_host: spi bus changed (1 -> 2) --------------------- Mode: SPI Name: SU08G Type: SDHC/SDXC Speed: default speed (25 MHz) SPI speed: 20 MHz Size: 7580 MB CSD: ver=1, sector_size=512, capacity=15523840 read_bl_len=9 SCR: sd_spec=2, bus_width=5 >>> -
Here I attach the webpages which helps me mostly.
Hope it can help other people.https://github.com/loboris/MicroPython_ESP32_psRAM_LoBo/wiki/filesystems
https://forum.micropython.org/viewtopic.php?t=4551
https://loboris.eu/forum/showthread.php?tid=85 -
ok......
now even one simple uos.mountsd() also works...
good...>>> import uos >>> uos.mountsd() W (497494) sdspi_host: spi bus changed (1 -> 2) --------------------- Mode: SPI Name: SU08G Type: SDHC/SDXC Speed: default speed (25 MHz) SPI speed: 20 MHz Size: 7580 MB CSD: ver=1, sector_size=512, capacity=15523840 read_bl_len=9 SCR: sd_spec=2, bus_width=5 -
Yes, microSD cards can be accessed in UIFlow or with MicroPython. They allow you to read and write data from/to the microSD card, enabling storage and retrieval of information on compatible devices.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login