switch spi mode at run time

manikandan_
Posts: 2
Joined: Wed Jun 19, 2019 4:25 pm

switch spi mode at run time

Postby manikandan_ » Wed Jun 19, 2019 4:32 pm

Hi,

I have 2 spi sensors which operates in spi mode 0 and mode1. i want to connect the 2 sensors to a single spi lines by sharing the lines. so is there a way i can switch between the modes while in run time. ie make mode 0 and read dfrom sensor 0 and then switch mode to 1 and read sensor1 data.

i have tried this with arduino library and it is working but couldn't figure it out with esp-idf.

what would be the best way to read from both sensors?

ESP_Sprite
Posts: 9769
Joined: Thu Nov 26, 2015 4:08 am

Re: switch spi mode at run time

Postby ESP_Sprite » Thu Jun 20, 2019 4:57 am

You can set the SPI mode per device if you use the ESP-IDF SPI driver. The driver will handle switching for you.

manikandan_
Posts: 2
Joined: Wed Jun 19, 2019 4:25 pm

Re: switch spi mode at run time

Postby manikandan_ » Fri Jun 21, 2019 8:43 am

Hi sprite,

Thanks for the quick reply, it is working. :)

Who is online

Users browsing this forum: No registered users and 135 guests