Page 1 of 1

How to work with 3 SPI slaves in Arduino ESP32 add-on

Posted: Fri Sep 27, 2019 9:07 am
by drmpf321
I am trying to control 3 SPI slaves from one SPI connection using the Arduino add-on for ESP32.
I can see that the 'standard' SPI is using CS0 but it is not clear to me how to set CS1 and CS2 and how to switch between them.
The ESP32 docs talk about spi_bus_add_device( ), but the Arduino esp32_hal_spi files do not call that method.
Any advice on this would be welcome.

Re: How to work with 3 SPI slaves in Arduino ESP32 add-on

Posted: Sun Sep 29, 2019 12:14 am
by mikronauts
see https://www.mikronauts.com/raspberry-pi ... and-howto/

I used a 74HC138N to generate eight chip selects from three digital output.

use CS0 as /EN, use three gpio's for the channel select inputs.
drmpf321 wrote:
Fri Sep 27, 2019 9:07 am
I am trying to control 3 SPI slaves from one SPI connection using the Arduino add-on for ESP32.
I can see that the 'standard' SPI is using CS0 but it is not clear to me how to set CS1 and CS2 and how to switch between them.
The ESP32 docs talk about spi_bus_add_device( ), but the Arduino esp32_hal_spi files do not call that method.
Any advice on this would be welcome.

Re: How to work with 3 SPI slaves in Arduino ESP32 add-on

Posted: Sun Sep 29, 2019 12:28 am
by drmpf321
Thanks for the tip.
I have enough pins for the extra CS.
The ESP32 docs says you can specify 3 CS pins for one SPI channel and then just use 'handles' to preform SPI on each device.
It is not clear how to do this in the ESP32 Arduino addon which does not use SPI handles.