IO_MUX and CS pin

aster94
Posts: 6
Joined: Wed Jan 10, 2018 3:32 pm

IO_MUX and CS pin

Postby aster94 » Wed Apr 22, 2020 4:33 pm

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

username
Posts: 181
Joined: Thu May 03, 2018 1:18 pm

Re: IO_MUX and CS pin

Postby username » Thu Apr 23, 2020 1:13 am

If you are working with Arduino I cannot say, but if ESP-IDF you can.

aster94
Posts: 6
Joined: Wed Jan 10, 2018 3:32 pm

Re: IO_MUX and CS pin

Postby aster94 » Fri Apr 24, 2020 8:32 am

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

username
Posts: 181
Joined: Thu May 03, 2018 1:18 pm

Re: IO_MUX and CS pin

Postby username » Fri Apr 24, 2020 12:03 pm

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);

Who is online

Users browsing this forum: No registered users and 22 guests