pimoroni / pimoroni-pico

Libraries and examples to support Pimoroni Pico add-ons in C++ and MicroPython.
https://shop.pimoroni.com/collections/pico
MIT License
1.32k stars 496 forks source link

[Badger 2040] How to connect SPI device? #607

Closed niutech closed 1 year ago

niutech commented 1 year ago

Is it possible to connect an SD card module to the Badger 2040 using Serial Peripheral Interface? Is it possible to connect SPI pins: SCK, MOSI, MISO, CS to: RX, INT, SDA, SCL respectively?

ZodiusInfuser commented 1 year ago

Hi. The exposed I2C and UART pads on Badger are GP0, GP1, GP3, GP4, and GP5. Checking the RP2040 datasheet, you can get SPI MOSI, MISO, and CS, but sadly cannot get SCK (that's on GP2 and GP6). So the quick answer to your question is no.

If you are adventurous with coding though you could explore the RP2040's PIO system, which would let you write a custom SPI driver (as is used by the Pico W for its WiFI: https://github.com/raspberrypi/pico-sdk/tree/master/src/rp2_common/cyw43_driver).