SD card problems .. I think the umount doesn't work.

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
peter247
Posts: 8
Joined: Sat Oct 31, 2020 9:45 am

SD card problems .. I think the umount doesn't work.

Post by peter247 » Sat Nov 07, 2020 11:48 am

Hi , I've had problems trying to mount the SD card , But found what my problem was and why I was getting my error.
The first time I mount the SD it works , but if I try running a second time without a Ctrl D and full power down I get this error.

>>> %Run -c $EDITOR_CONTENT
['System Volume Information', 'Hello.txt']
Hello this is just a test
>>> %Run -c $EDITOR_CONTENT
E (154919) spi: SPI3 already claimed by spi master.
Traceback (most recent call last):
File "<stdin>", line 6, in <module>
OSError: 259
>>>

Code: Select all

from machine import SDCard, Pin , SPI
import time
import os
import machine

os.mount(machine.SDCard(slot=2), "/sd")
os.chdir('/sd')
print(os.listdir('/sd'))
print(open("/sd/Hello.txt", "r").read())
os.umount('/sd')
On clean power up or Ctrl D it looks to be working , what am I missing ?
Last edited by peter247 on Mon Nov 09, 2020 10:34 am, edited 1 time in total.

peter247
Posts: 8
Joined: Sat Oct 31, 2020 9:45 am

Re: SD card problems ..

Post by peter247 » Sun Nov 08, 2020 10:28 am

I think the umount doesn't work.
looking at this video https://www.youtube.com/watch?v=s8agR-Uhn3Q
So I've solved it by just trying it out .

Post Reply