Configuring SPI bus on Tiny2040

I have tons of experience with the Tiny2040 using MicroPython and I2C.
I am having issues setting up my first of two SPI bus channels on the Tiny2040 in Python.

import machine
from machine import Pin, SPI
SPI_handle = SPI(1, baudrate=2000000, polarity=0, phase=0, sck=Pin(2), MOSI=Pin(0), MISO=Pin(3)

TypeError: extra keyword arguments given

Ultimately, I need to configure two bi-directional SPI channels but was starting out as simple as possible.

I’m wondering if MicroPython is being case-sensitive here - the documentation describes the mosi and miso parameters in lower case.

I’m wondering if MicroPython is being case-sensitive here

That’s exactly it.

Also, your pin definitions aren’t quite right.

SPI_handle = SPI(1,

So the RP2040 has two SPI busses, 1 and 0, and the first parameter selects which bus to use. If you look at the pinout diagram on the product page, all of the SPI pins are labelled with “0”, so they’ll only work on bus 0, so that parameter needs to be 0.

You’ve also got the MOSI and MISO pins the wrong way around. MOSI is for the host to transmit data to peripherals, so that is the TX pin, while MISO is for the host to recieve data, and is the RX pin.

The following code works:

import machine
from machine import Pin, SPI
SPI_handle = SPI(0, baudrate=2000000, polarity=0, phase=0, sck=Pin(2), mosi=Pin(3), miso=Pin(0))