I cannot communicate with the board's sd card using Micropython however, it works fine with Arduino's code. The camera works fine with Micropython.
I'm probably using the wrong pins but I ran out of ideas.
I appreciate any help.
TIA
PS
Yes, the sd card is plugged in and FAT32 formatted.
Code: Select all
import machine, sdcard, os
try:
print('*** Setup ***')
# CLK GPIO 14
# CMD GPIO 15
# DATA0 GPIO 2
# DATA1 / flashlight GPIO 4
# DATA2 GPIO 12
# DATA3 GPIO 13
# RED LED GPIO 33
# SD card socket : pin 9 is SD
spi = machine.SPI(1, baudrate=100000, phase=0, polarity=0, sck=machine.Pin(14), mosi=machine.Pin(15), miso=machine.Pin(2))
sd = sdcard.SDCard(spi, machine.Pin(13))
os.mount(sd, '/sd')
os.listdir('/')
print('*** Done ***')
except AssertionError as e:
print(e)
machine.reset()
MPY: soft reboot
*** Setup ***
I (52270) gpio: GPIO[15]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (52270) gpio: GPIO[2]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (52280) gpio: GPIO[14]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (52300) spi_master: Allocate TX buffer for DMA
I (52320) spi_master: Allocate TX buffer for DMA
I (52350) spi_master: Allocate TX buffer for DMA
I (52370) spi_master: Allocate TX buffer for DMA
I (52400) spi_master: Allocate TX buffer for DMA
Traceback (most recent call last):
File "main.py", line 27, in <module>
File "main.py", line 19, in <module>
File "sdcard.py", line 48, in __init__
File "sdcard.py", line 76, in init_card
OSError: no SD card
MicroPython v1.10-128-g584bc5b2a on 2019-09-01; ESP32 module with ESP32
Type "help()" for more information.