Hi,
I wanted to check if it’s possible to connect an external SD card module like this on an Arduino Nicla Vision. Is there a tutorial somewhere?
NVision is a great option for a project of mine if I can save images for post processing purposes. I’ve tried using Arduino IDE (example program using SD.h) but had no luck.
Regards,
PC
Yes, via this: micropython-lib/micropython/drivers/storage/sdcard/sdcard.py at master · micropython/micropython-lib
You just need to give it a SPI bus object and it should work.
import pyb, sdcard, os
sd = sdcard.SDCard(pyb.SPI(4), pyb.Pin("PE11"))
pyb.mount(sd, '/sd2')
os.listdir('/')
Hi @kwagyeman, thanks for something to start with. Unfortunately, this does not work on my Nicla. Same thing happens on a Portenta too; I keep getting OSError: no SD card
. So far I’ve tried altering the baudrate to 9600 and 19200 in sdcard.py
but have had no luck.
The SD card reader module is working fine. To check if the issue is with micropython, I tested it on an Uno and Portenta via the Arduino IDE and it works fine there. However, this way of execution fails for my Nicla Vision for some reason (as mentioned in the original post).
Here’s the schematic of the card reader, followed by the connections on NVision:
GND → GND
+3.3 → VDDIO_EXT
SDCS → PE_11
MOSI → PE_14
SCK → PE12
MISO → PE_13
PS the module has a 5V pin too but works with the 3.3V one on Uno and Portenta, so it should be fine.
PC
Hi, @prithulc - Do you have anyway to analyze the signal wires and see what their values are over time? SInce what you want to do is rather custom, you need to debug it.
The first thing you want to do is verify the SPI bus is actually working. Then, you probably want to add some debug statements to the script I linked to in order to determine what’s wrong with it.
Most likely, the bug is with the SPI bus and the CS pin, so, determining if all the electrical signals are working should get you 95% the way there to a working system.
1 Like