Hi,
I designed board, sort of similar to interstate 75 and I really like the libraries supplied by adafruit.
I’ve tried to compile the C/C++ library as described here:
But I failed to do so. Then I found out, that there is Micropython build using RP2040 specific features and wanted to try it out.
My question is: Is it possible to change pinout of the board? Can I do it without recompiling micropython build? If not,what would be the easiest way around this? Circuitpython is rather slow.
Best regards,
Vit
what do you mean with “changing the pinout”? The pinout is a property of the processor, in this case the RP2040 and that is fixed.
I think he means, change what pin on the RP2040 does what function?
ok. but for this task there is no need to recompile anything.
Hello, @alphanumeric is right, I want to use the library for interstate 75 board on my custom board with RP2040, which has different pinout compared to the interstate one… Could you please elaborate on how to change the pinout (the PIO is using) without recompiling the whole adafruit micropython library?
VR
Adafruit uses CircuitPython, not MicroPython. But this actually does not matter because both tell the processor which pin takes which role.
Both CP and MP have classes/methods to create I2C or SPI objects and you pass your pin numbers. The RP2040 is very flexible, so you can pass many combinations. E.g. I think there are twelve pin-pairs you can configure as I2C (e.g. GP0+GP1, GP2+GP3, GP4+GP5, GP6+GP7 … and even more if you don’t combine pins next to each other GP0+GP9 …).
So you should read the docs for CP or MP on how to create I2C and/or SPI objects and how you pass the pin numbers to the respective methods. In this way you can create the interface objects suitable for your custom board.
A simple example in CP:
import busio
i2c = busio.I2C(scl=board.GP3, sda=board.GP2)
The important thing is the interstate library you want to use: does it support passing other pin-numbers as arguments or maybe passing I2C objects? If not (i.e. pin-numbers are hardwired within the library), you have to copy the library and change it.
Hi,
yeah its the latter (the pinout is unfortunately hardcoded in the library). If it were only for changing I2C object’s properties, I wouldnt be asking here.
Anyway, thank you for your help. I asked on github and I got instructions on how to recompile the whole micropython eith my changes.
Regards,
Vít.