LoPy4 reuse SPI pins?
Electrozest last edited by
I am designing a complex circuit with the LOPY4 which requires both I2C and SPI and I am running out of spare GPIO pins.
Is it possible to use the MISO,MOSI and CLK lines connected to the Sigfox/Lora radio module if I run individual chip select line to each of my own SPI devices using the available GPIOs?
Essentially I didn't want to use up all of my GPIO allocations on an additional SPI interface if I can reuse the one provided and ensure that each SPI device has a separate GPIO chip select.
It looks like the radio module has an SPI chip select on GPIO17, so if this is set as disabled, I assume the SPI bus is then free and I could use my own SPI devices via these pins?
Electrozest last edited by Electrozest
I decided to use a PCA8575 16 bit I2C I/O expander as it solved the I/O problem without adding too much to the bill of materials, so I left the SPI pins for the Lora/Sigfox radio not connected.
daniel last edited by
@Electrozest what you want can be done in theory, but we haven't tried it ourselves. In principle you would have to limit the use of the shared SPI bus and be careful that the LoRa stack is not busy with anything while you communicate with your other slave. We could offer support for this and modify our code base if needed to make it work. Let us know.
robert-hh last edited by
@electrozest If you can avoid a collision, then it may should be possible, especially if you do NOT change the SPI mode. I do not know, how the radio driver is implemented. But as a first guess, I would not expect to reconfigure SPI on every use.