machine.SDCard doesn't work in my setup

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
Dogostyle
Posts: 3
Joined: Fri Feb 08, 2019 4:33 pm

machine.SDCard doesn't work in my setup

Post by Dogostyle » Sun Aug 02, 2020 4:33 am

Hi people of micropython, I hope you're doing well.
I'm currently working on a project on the Heltec Wifi LoRa 32 https://heltec.org/project/wifi-lora-32/. I'm using an microSD card for logging purposes and I'm trying to migrate from the sdcard.py library at https://github.com/micropython/micropyt ... /sdcard.py to the builtin machine.SDCard module now available, in order to save some resources.
Constraints relative to the desing left me with the following pins:
[*] miso: 19
[*] mosi: 27
[*] sck: 5
[*] cs: 2

Code: Select all

from machine import SDCard, Pin

Pin(18, Pin.OUT, value = 1) # this way I disable LoRa on the SPI bus

sd = SDCard(slot = 3, sck = Pin(5), miso = Pin(19), mosi = Pin(27), cs = Pin(2), freq = 1000000)
uos.mount(sd, '/sd')
After I run the code above I get this output:

Code: Select all

I (4692920) gpio: GPIO[2]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (4692970) sdspi_transaction: cmd=5, R1 response: command not supported
E (4692980) sdmmc_common: sdmmc_init_ocr: send_op_cond (1) returned 0x107
Traceback (most recent call last):
  File "<stdin>", line 4, in <module>
OSError: 16
Previusly with sdcard.py I didn't have any issue btw.
Since I have this desing limitations I cannot change the order nor wirings of the pins to the microSD card.
Hope you guys can help me out with this one, saludos desde Chile!.

Post Reply