#I picked up this pcb on etsy - https://

1 messages · Page 1 of 1 (latest)

astral pebble
jovial rover
#

apparently they did what imo is not a great decision, and went with PIO for generating the SPI signal instead of using the actual SPI peripheral on the MCU

#

as far as i know, PIO can do anything on any pin, so they could have chosen a set of pins that supported either arrangement, but from a quick look, they didnt. they have

  • SCK on GP0
  • MISO on GP1
  • MOSI on GP2

but the SPI peripheral would need to be

  • SCK on GP2
  • MISO on GP0
  • MOSI on GP3 (not even used?)
#

on the bright side, the pio/spi implementation is part of Pico-SDK, which is already included on CircuitPython as a submodule required for the RP2040 port (ports/raspberrypi/sdk), so it shouldn't be too hard to get the required file(s) to compile + add them to the include path, on your makefile

#

something like (probably) mk SRC_C += sdk/src/rp2_common/hardware_pio/pio.c INC += -isystem sdk/src/rp2_common/hardware_pio/include (but i cant find the pio_spi.h file anywhere on their repo nor the SDK 🤔, so the INC there is useless so far)

#

tho it would probably be easier to just bodge wire the PCB to use SPI hardware, rather than using PIO code (and potentially writing wrappers to interact with it from Py)

#

i have no clue how it works (or if it works at all), but there is also a pioasm library with which you can probably rewrite the PIO code i linked (which doesnt look too hard as it is like 10 lines per function, and only three of them)

astral pebble
#

This is so helpful. Thank you so much for this advice!

#

Gonna dive back into it later this afternoon.