I am quite enthusiastic about the new Raspberry Pico. However I find the C SDK not very friendly and I prefer to have something as simple as the Arduino API. I did not want to wait for the official Arduino support – so I started my own project.

So far this has been just a Toy Project, but with the addition of SPI, we can now take on some more complex Arduino projects.

In order to verify and test the implementation of the Arduino SPI interface. I added the SdFat library from Bill Greiman and just used the SdInfo example. SdFat Version 2 supports FAT16/FAT32 and exFAT SD cards.

You can find more examples in the SdFat/examples directory.

The Arduino HardwareSPI interface is using the Pico API and we use the following default pins

  • spi0: pinRx = 16; pinTx = 19; pinCS = 17; pinSCK = 18;
  • spi1: pinRx = 12; pinTx = 11; pinCS = 13; pinSCK = 10;

On the master MISO is the pinRx and MOSI is pinTx!

Connections for SD Module

SD Pico
CS SPI-CS0 (GPIO 17)
SCK SPI-SCK (GPIO 18)
MOSI SPI-TX (GPIO 19)
MISO SPI-RX (GPIO 16)
VCC VBUS (5V)
GND GND

SD Module

Configuration

When I first tested the functionality, I wondered why the functionality did not work properly.

  • It turned out that USE_SIMPLE_LITTLE_ENDIAN must not be set to 1. This is changed in the SdFatConfig.h
  • I also needed to lower the max speed from 16MHz to 12MHz.

The example can be found on Github

Categories: ArduinoPico

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published.