I`m a beginner with the ESP32. I want to use in a ESP32-WROOM-32D one of the SPI peripherals as Master. As I could find in the "Exampels", there are different pre-definitiones for the different ESP32 types, in terms of pin-function and SPI-module (HSPI_HOST or SPI2_HOST):
Code: Select all
#ifdef CONFIG_IDF_TARGET_ESP32
#define LCD_HOST HSPI_HOST
#define PIN_NUM_MISO 25
#define PIN_NUM_MOSI 23
#define PIN_NUM_CLK 19
#define PIN_NUM_CS 22
#define PIN_NUM_DC 21
#define PIN_NUM_RST 18
#define PIN_NUM_BCKL 5
#elif defined CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
#define LCD_HOST SPI2_HOST
#define PIN_NUM_MISO 37
#define PIN_NUM_MOSI 35
#define PIN_NUM_CLK 36
#define PIN_NUM_CS 45
#define PIN_NUM_DC 4
#define PIN_NUM_RST 5
#define PIN_NUM_BCKL 6
#elif defined CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C6
#define LCD_HOST SPI2_HOST
#define PIN_NUM_MISO 2
#define PIN_NUM_MOSI 7
#define PIN_NUM_CLK 6
#define PIN_NUM_CS 10
#define PIN_NUM_DC 9
#define PIN_NUM_RST 4
#define PIN_NUM_BCKL 5
#elif defined CONFIG_IDF_TARGET_ESP32H2
#define LCD_HOST SPI2_HOST
#define PIN_NUM_MISO 0
#define PIN_NUM_MOSI 5
#define PIN_NUM_CLK 4
#define PIN_NUM_CS 1
#define PIN_NUM_DC 10
#define PIN_NUM_RST 11
#define PIN_NUM_BCKL 12
#endif
- Datasheet
- Technical Refernce Manual
From my point of view, it is quit difficult to learn, how to configure the I/O pins through the MUX/Matrix. Furthermore, for the idf.py I`m able to select the ESP32 sub-type.
So my questions:
- which pin should I select for the which pin function?
- for the idf.py should I simply select the "ESP32" as target device?
Thank you for your comments.
Greetings
Henry