ivmarkov / rust-esp32-std-demo

Rust on ESP32 STD demo app. A demo STD binary crate for the ESP32[XX] and ESP-IDF, which connects to WiFi, Ethernet, drives a small HTTP server and draws on a LED screen.
Apache License 2.0
784 stars 105 forks source link

Question:why use different pins from document #73

Closed buhe closed 2 years ago

buhe commented 2 years ago

Hi, esp32-devkitC-v4-pinout I use esp32 devkit and waveshare 1.54in e-paper, i see doc gpio14 is spi clk pin and gpio13 is mosi ,but code is sclk: gpio::Gpio13, sdo: gpio::Gpio14,. why?

thanks

buhe

simon0356 commented 2 years ago

Hello Buhe,

I'm the creator of the waveshare feature PR, i'm using the Waveshare ESP32 board with 4.2" screen which use the following pin : ESP32 Waveshare driver board BUSY = 25
CS = 15 RST = 26 DC = 27 SCK = 13 SDI/MISO = 12 // Master-In Slave-Out not used, as no data from display SDO/DIN/MOSI = 14

On another project I also use the same screen with a LILYGO-T18 Board using the following pinout :
BUSY = 4 CS = 5 RST = 26 DC = 27 SCK = 18 SDI/MISO = 19 // Master-In Slave-Out not used, as no data from display SDO/DIN/MOSI = 23

Did you manage to run the code with your own pin configuration ?

Simon

buhe commented 2 years ago

thanks @simon0356 reply

The code is definitely correct. I just have a question, look at that picture. The picture says gpio14 is sck and the code is mosi, so I want to ask why.

buhe commented 2 years ago

Please, what are you based on? I read the data sheet as well.

simon0356 commented 2 years ago

The Waveshare ESP32 board use different pinout for SPI2 as i understand. I use the hardware connection as documented here : https://www.waveshare.com/wiki/4.2inch_e-Paper_Module Tab "User Guides of ESP32" section "Hardware connection" table "Connect to ESP32 Driver Board "

ivmarkov commented 2 years ago

thanks @simon0356 reply

The code is definitely correct. I just have a question, look at that picture. The picture says gpio14 is sck and the code is mosi, so I want to ask why.

What the picture is telling you is what e.g. gpio14 is usually used for. You can use SPI1/SPI2 with any pin configuration. It is just that some configurations are slightly more efficient as then the pin routing goes via IOMUX (Direct IO) and not via the GPIO matrix.

Consult p45 in the ESP32 Technical Reference: https://www.espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf

buhe commented 2 years ago

Excuse me @ivmarkov , how does this project map the GPIO matrix, thanks.