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

drmpf321
Posts: 9
Joined: Thu Dec 10, 2015 10:33 pm

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

Postby drmpf321 » 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.

mikronauts
Posts: 23
Joined: Wed Dec 09, 2015 8:11 pm

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

Postby mikronauts » Sun Sep 29, 2019 12:14 am

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.

drmpf321
Posts: 9
Joined: Thu Dec 10, 2015 10:33 pm

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

Postby drmpf321 » Sun Sep 29, 2019 12:28 am

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.

Who is online

Users browsing this forum: Bing [Bot] and 94 guests