[SAMD21] - SPI/I2C support

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
ltmerlin
Posts: 39
Joined: Fri Jun 28, 2019 12:34 pm

[SAMD21] - SPI/I2C support

Post by ltmerlin » Mon Nov 02, 2020 3:36 pm

Has anyone got SPI or I2C working on a SAMD21? The samd21 port is very limited with no built-in SPI/I2C support. Even a machine.Pin is not available…
I know there is CircuitPython, but I would like to have standard Micropython on it...
CircuitPython uses its own adafruit_bus_device and busio libraries to enable SPI/I2C support. Is there a way/guidelines I could try to start filling these gaps in the genuine Micropython repo?

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: [SAMD21] - SPI/I2C support

Post by jimmo » Tue Nov 03, 2020 12:43 am

I see you posted on the Slack also, so for the benefit of others here's the reply I sent there:

With samd and i.mx (i.e. teensy 4.0) we just tried to get the minimum thing that booted (i.e. the "hard" bit that can be difficult to get merged, and hopefully the community can fill in the drivers and stuff). machine.Pin is obviously the next big thing to work on (because that gets you SoftI2C and SoftSPI automatically).

Some more background:
- machine.Pin needs a way to map the pin names (i.e. like on the STM32 port you can write machine.Pin('I2C1_SDA') or machine.Pin('X1') which comes from the pins.csv in the board definition). It would be good to make this mechanism common across all ports. Currently STM32 and nRF have their own implementation of make-pins.py, and ESP32/ESP8266 just use numeric pin IDs.
- The machine module is currently implemented from scratch in each port. I'd like to see this done in terms of a "common" HAL layer (and with pins we kind of already have that with the mp_hal_pin_* functions and just define machine.Pin in a common place in extmod. (I realise this is more like how CircuitPython does it with the shared bindings).

ltmerlin
Posts: 39
Joined: Fri Jun 28, 2019 12:34 pm

Re: [SAMD21] - SPI/I2C support

Post by ltmerlin » Wed Nov 04, 2020 3:04 pm

OK that's a start. Thanks.

Post Reply