Raspberry pi as spi slave

General discussion about anything related to Ultibo.
mark
Posts: 1324
Joined: Mon Oct 03, 2016 2:12 am
Location: Indianapolis, US

Raspberry pi as spi slave

Postby mark » Fri Dec 21, 2018 8:58 pm

I'd like to connect two pi's using spi but I am not sure that a pi can act correctly in slave mode.

ref: https://www.raspberrypi.org/forums/view ... 4&t=181784

Does anyone know for sure?

Thanks,
Mark
Gavinmc42
Posts: 1508
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Raspberry pi as spi slave

Postby Gavinmc42 » Sat Dec 22, 2018 8:40 am

Interesting question.

I have had 2 x i2c's and 2 x SPI master's working at once.
Never thought to test SPI slave mode.
Two console windows, SPI master data on one, SPI slave data on the other?

There was a post about wiring.
https://www.raspberrypi.org/forums/view ... 3&t=229388
The linked video has a method of using connector shells I will now adopt here and at work ;)
https://www.youtube.com/watch?v=uYf7vFREV98

Two wires, SPI CLK/MOSI to SPI CLK IN/MISO? should be enough to test.
The errata is a bit ambiguous so a 1K? resistor in series on the data would protect the Pi.

Swap all that analog stuff for digital and my workbenches, before the refurb last xmas, looked like Jon Williams ;)
This has been pointed out to me a few years ago :oops:
My home bench still looks like that, so I will need to clean up to find some of those wires to test this.
Gavinmc42
Posts: 1508
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Raspberry pi as spi slave

Postby Gavinmc42 » Sat Dec 22, 2018 9:26 am

For those in Australia the PA-09 crimper is a great bargain along with the bigger PA-20.
https://rhinotools.com.au/product/pa-09 ... l-crimper/
I have used it enough to know now look for those pre made cables :D

https://www.adafruit.com/product/266
https://www.adafruit.com/product/794
Too late for a stocking stuffer?

Wow even without header blocks + blocks :D
https://www.adafruit.com/product/3141
https://www.adafruit.com/product/3145

I need to retire my soldering iron?
DIY electronics gets easier every year.
User avatar
Ultibo
Site Admin
Posts: 2150
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Re: Raspberry pi as spi slave

Postby Ultibo » Sat Dec 22, 2018 10:28 pm

mark wrote:Does anyone know for sure?

We've never tested it and so far we haven't had a need to create a driver for the SPI slave device but we are happy to get involved in testing if it helps to lead to a working Ultibo driver
Ultibo.org | Make something amazing
https://ultibo.org
mark
Posts: 1324
Joined: Mon Oct 03, 2016 2:12 am
Location: Indianapolis, US

Re: Raspberry pi as spi slave

Postby mark » Sun Dec 23, 2018 3:38 am

Ultibo wrote:
mark wrote:Does anyone know for sure?

We've never tested it and so far we haven't had a need to create a driver for the SPI slave device but we are happy to get involved in testing if it helps to lead to a working Ultibo driver
Thanks, and thanks Gavin for a roll-up-the-sleeves effort.

However, Gavin, I don't want to use a solution that only works with modifications that aren't fully supported by the rpi design as it is. At least for the goal that I have (a camera array) I need to have it be completely supported by the rpi design and it isn't clear that the rpi engineers didn't simply leave out spi slave support in their enthusiasm for linux capable master support. That doesn't mean that getting it to work, from my point of view, is not useable. I just couldn't use it in my application unless it is fully supported by the rpi design.

Each camera of the array is some kind of pi with an openmax/csi camera. The total array needs to be two cameras although it might as well be designed for an (n) general case.

A usb cluster hat could make a four-way camera array, but we don't yet have usb device mode on ultibo zero's. Also usb is primarily a desktop bus and I would like to have a back-end bus just for simplicity.

That leaves spi (pending validation,) i2c, and uart. I haven't thought through the uart approach - it might need to use both uart's to get the needed connectivity.

The array interface is an ethernet cable connected to one of the pi's - if the camera pi's are zero's then there would need to be a third ultibo pi to provide the ethernet.

Well, thanks and let's keep discussing.

Regards,
Mark
Gavinmc42
Posts: 1508
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Raspberry pi as spi slave

Postby Gavinmc42 » Sun Dec 23, 2018 11:23 am

A USB cluster hat could make a four-way camera array, but we don't yet have usb device mode on ultibo zero's.

I suspect the Zero stays in OTG mode when USB boot is used, but USB not easy to use and OTG even harder.
Any clues in the USBBoot source?
Ethernet over OTG USB would be best?

But if you are thinking about Zeros as SPI slave cameras, then that is something that interests me enough to try.
Can it be done booting via USBboot and SPI for images?
SPI will be slower than USB, but still fast enough to do interesting stuff, especially if the Zero does some prepossessing.

Arduino cameras are even slower with less memory.
http://www.arducam.com/
CMUcams are smarter, could Zero's do the same stuff?
http://www.cmucam.org/

Arducam have UART versions too.
Zero's can be turned into netcams by using ENJ28C60 modules via SPI.
I have some of these lying around, only 10mbs Ethernet but against Zero prepossessing might help?
https://www.olimex.com/Products/Modules ... NC28J60-H/

Lots of combinations, time for me to do some serious SPI coding.

The older, smaller res, image sensors have a parallel data mode
http://www.arducam.com/products/camera- ... v7670_3-2/
Very similar to Pi's SMI.
https://www.raspberrypi.org/forums/view ... hp?t=92233

Sometimes I wish I had the time to do everything I want to do ;)

Return to “Discussion”

Who is online

Users browsing this forum: No registered users and 0 guests