2

It seems that it isn't officially supported (no official drivers) according to a similar question on this site. Do I have to write the driver myself or are there inofficial drivers that I can use?

Is Bit Banging possible in this scenario?

EDIT: The answers to those questions say it is not possible, however they are 2-3 years old. I couldn't find newer sources.

Question 1 Question 2

I also found this github repo. The project implements a slave driver for raspberry pi. The last commit however is three years old. Maybe someone has used it and can answer wether it works?

  • Please add references that you refere to! And show your research, not just loos comments... – MatsK Feb 7 '18 at 15:29
  • I have added a few sources to my original question. – noobprogrammer Feb 7 '18 at 16:44
4

As far as I am aware you will need to bit bang the protocol yourself. This will mean that you will only be able to reliably support comparatively low clock rates.

The Pi contains hardware to support SPI in a slave mode but it does not appear to work. This post on the raspberrypi.org forums documents my unsuccessful attempts to drive the hardware from userland.

The pigpio BSCX command will be useful for those wishing to experiment with the SPI slave hardware.

The problem with bit banging is that the external device will be the master and will control the clock. SPI has no equivalent to I2C clock stretch which allows an I2C slave to slow the clock. So a SPI slave must guarantee to respond to a clock change within roughly half a bit time. This isn't possible within a Linux preemptive system at more than a few hundred bits per second (probably even less).

You may be able to get decent bit rates if you use bare metal (no operating system) but that is outside my experience and really negates any point in using the Pi in the first place.

0

The work around for me is to use another line to the Pi indicating that the device trying to send data to the pi wants to talk. Then the channel select line is used to that device from the pi and is initiating the communication and controlling the clock.

  • Please elaborate a bit more, it is lacking a lot of hard facts! – MatsK Jan 10 at 21:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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