Page 1 of 1

switch spi mode at run time

Posted: Wed Jun 19, 2019 4:32 pm
by manikandan_
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?

Re: switch spi mode at run time

Posted: Thu Jun 20, 2019 4:57 am
by ESP_Sprite
You can set the SPI mode per device if you use the ESP-IDF SPI driver. The driver will handle switching for you.

Re: switch spi mode at run time

Posted: Fri Jun 21, 2019 8:43 am
by manikandan_
Hi sprite,

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