0

I hope you can help.

I am currently using a raspberry pi 4b and want to be able to use the SPI capabilities. For my pi I have SPI0 and SPI1. The pins used are as follows;

SPI0_MOSI - pin 19 (BCM_10)
SPI0_MISO - pin 21 (BCM_9)
SPI0_SCLK - pin 23 (BCM_11)
SPI0_CE0  - pin 24 (BCM_8)

SPI1_MOSI - pin 38 (BCM_20)
SPI1_MISO - pin 35 (BCM_19)
SPI1_SCLK - pin 40 (BCM_21)
SPI1_CE0  - pin 12 (BCM_18)

For now I am trying to send binary data from one SPI to the other on the same pi, and to display the number received in the terminal or by LEDs on a breadboard.

What would my code look like to achieve this? I am currently using Python-3.

Thank you in advance.

3
  • Do you know how SPI works? There are numerous libraries and examples if you want to do this but it makes about as much sense as sending data via the moon. Most SPI examples operate as master to communicate with a slave device.
    – Milliways
    Nov 13, 2023 at 10:54
  • Wouldn't the look of you code depend on your programming style?
    – jsotola
    Nov 13, 2023 at 18:30
  • See Tour to see how this site works and How do I ask a good question?
    – Milliways
    Nov 13, 2023 at 23:27

1 Answer 1

0

A SPI connection has two ends. One end is the master and controls the clock. The other end is a slave and responds to the master's clock.

Generally Raspberry Pi's only support master mode so you can not communicate between Pis.

However the Pi does have hardware to support slave mode. There is no operating system support for this hardware.

pigpio does offer limited support.

https://abyz.me.uk/rpi/pigpio/python.html#bsc_xfer

Personally I think you would be better off finding another subject to research.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.