Page 1 of 1

IO_MUX and CS pin

Posted: Wed Apr 22, 2020 4:33 pm
by aster94
hello,

I would like to use the fastest SPI interface possible, so I am using these pins to take advantage of the IO_MUX

[Codebox]#define PIN_NUM_MISO 12
#define PIN_NUM_MOSI 13
#define PIN_NUM_CLK 14
#define PIN_NUM_CS 15[/Codebox]

But am I really forced to use the CS pin or can I use everything? In other architecture I am free to use any pin for the CS

Re: IO_MUX and CS pin

Posted: Thu Apr 23, 2020 1:13 am
by username
If you are working with Arduino I cannot say, but if ESP-IDF you can.

Re: IO_MUX and CS pin

Posted: Fri Apr 24, 2020 8:32 am
by aster94
I think you are correct, i read again the docs (https://docs.espressif.com/projects/esp ... aster.html) and:
Only the first Device attached to the bus can use the CS0 pin
So looks like that other CS pin can be used without affecting the speed

Re: IO_MUX and CS pin

Posted: Fri Apr 24, 2020 12:03 pm
by username
If you want to disable all CS pins you would set sclk_io_num to -1
Take a look here: https://espressif-docs.readthedocs-host ... lk_io_numE

Then you can control your own CS using something like this.
#define CS GPIO_NUM_16

gpio_set_level(CS, 0);
send you data
gpio_set_level(CS, 1);