Multiple Slave select pins to talk to multiple devices via SPI

I am trying to talk to multiple devices via SPI. I am aware that I can use GPIOs as extra slave select pins, controlling them explicitly while carrying out spi transactions and get this working.
However I wanted to know if there was a way to setup multiple GPIOs as slave selects, add devices to device tree (eg : spidev0.1, spidev0.2… ) each configured with a different GPIO as SS pin and let the SPIDEV open the required device and handle the control of slave select pin on its on.
Any supportive links/code snippets/device tree examples would be really helpful
Thanks

From hardware perspective it’s possible to use single mater to multiple slaves, post connections here for your reference (from Wikipedia).
[url]https://en.wikipedia.org/wiki/File:SPI_three_slaves.svg[/url]
SPI_three_slaves.jpg

SPI_three_slaves.jpg

Hi Trumany,
Yep. Actually the question is regarding configuring the Jetson to define some extra GPIO pins as slave select pins and add that info to device tree so that SPIDEV directly handles talking to the desired device when the corresponding device is opened.
In the current scenario, I have configured device tree to get the SPI working, and there is only 1 Slave select pin associated with SPI0. As I have enable hw based chip select in device tree, I don’t need to pull the pin low to enable the slave explicitly. The SPIDEV driver handles pulling the pin low and then high whenever a command is sent from the master to slave or received back.
What I am looking for is configuring few more pins as Slave select, and adding more devices under SPI0, (which will be opened by SPIDEV as spidev0.0, spidev0.1 … ), and let the SPIDEV handle the slave select pins on its own.

Hello, Mbot:
You can check ‘cs-gpios’ in DTS and SPI drivers. that’s GPIO to use for chipselect.

br
Chenjian

Hi jachen,
I looked up cs-gpios. Seems like that’s the way. Do you have some example you might have tried or some other reference ? It would be great to have it. Else, I will search on it and post the example here if I manage to get it working.

Regards

Hello, Mbot:
Sorry that I do not have such SPI devices in hand so I cannot verify that. That part of code should be general and not NV-specific. Please go ahead and share your achievements if possible. That may help a lot for other developers.

thanks.

ChenJian

Hello Mbot,

did you succeed configuring more pins as slave select and talk to multiple SPI devices?

thanks

Timscho

Hi Chenjian,

Can you please let me know which GPIO pins are you referring to that can be used for chip select.

Will be helpful if you can kindly let me know the pin nos.

thanks

Hello, siddharthm:
what’s the platform you are using? TK1 is very old platform and current SDK does not support that platform any more.

br
Chenjian

Thanks for the reply,

I am using Jetson Nano, so can you please let me know which if there are any specific GPIOs on Jetson Nano that can be used as chip select pins for SPI & I2C communications apart from the standard chip select pins on Nano ?

Hello,
Can you file a new thread for your question?
This is a very old thread with TK1 platform.

thanks.

br
ChenJian

I have already done that last week :

https://forums.developer.nvidia.com/t/gpio-pins-from-the-carrier-board-260-pin-connector-can-be-used-for-chip-select/128916