Skip to content

Commit 654aead

Browse files
Matched pin numbers in doco to numbers in variants files (espressif#9422)
* Matched pin numbers in doco to numbers in variants files * Non-breaking dashes * Changed SD examples to make REASSIGN_PINS more transparent. Fixes espressif#9082 --------- Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
1 parent 91c9ecd commit 654aead

File tree

3 files changed

+34
-32
lines changed

3 files changed

+34
-32
lines changed

libraries/SD/README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ Some ESP32 modules have different pin outs!
1818
## Default SPI pins:
1919
Note that SPI pins can be configured by using `SPI.begin(sck, miso, mosi, cs);` alternatively, you can change only the CS pin with `SD.begin(CSpin)`
2020

21-
| SPI Pin Name | ESP8266 | ESP32 | ESP32-S2 | ESP32-C3 | ESP32-S3 |
22-
|--------------|---------|-------|----------|----------|----------|
23-
| CS (SS) | GPIO15 | GPIO5 | GPIO5 | GPIO13 | GPIO13 |
24-
| DI (MOSI) | GPIO13 | GPIO23| GPIO24 | GPIO14 | GPIO14 |
25-
| DO (MISO) | GPIO12 | GPIO19| GPIO25 | GPIO15 | GPIO15 |
26-
| SCK (SCLK) | GPIO14 | GPIO18| GPIO19 | GPIO16 | GPIO16 |
21+
| SPI Pin Name | ESP8266 | ESP32 | ESP32S2 | ESP32‑S3 | ESP32‑C3 | ESP32‑C6 | ESP32‑H2 |
22+
|--------------|---------|-------|----------|----------|----------|----------|----------|
23+
| CS (SS) | GPIO15 | GPIO5 | GPIO34 | GPIO10 | GPIO7 | GPIO18 | GPIO0 |
24+
| DI (MOSI) | GPIO13 | GPIO23| GPIO35 | GPIO11 | GPIO6 | GPIO19 | GPIO25 |
25+
| DO (MISO) | GPIO12 | GPIO19| GPIO37 | GPIO13 | GPIO5 | GPIO20 | GPIO11 |
26+
| SCK (SCLK) | GPIO14 | GPIO18| GPIO36 | GPIO12 | GPIO4 | GPIO21 | GPIO10 |
2727

2828
## FAQ:
2929

libraries/SD/examples/SD_Test/SD_Test.ino

+14-13
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@
2222
* Note: The SPI pins can be manually configured by using `SPI.begin(sck, miso, mosi, cs).`
2323
* Alternatively, you can change the CS pin and use the other default settings by using `SD.begin(cs)`.
2424
*
25-
* +--------------+---------+-------+----------+----------+----------+
26-
* | SPI Pin Name | ESP8266 | ESP32 | ESP32-S2 | ESP32-C3 | ESP32-S3 |
27-
* +==============+=========+=======+==========+==========+==========+
28-
* | CS (SS) | GPIO15 | GPIO5 | GPIO5 | GPIO13 | GPIO13 |
29-
* +--------------+---------+-------+----------+----------+----------+
30-
* | DI (MOSI) | GPIO13 | GPIO23| GPIO24 | GPIO14 | GPIO14 |
31-
* +--------------+---------+-------+----------+----------+----------+
32-
* | DO (MISO) | GPIO12 | GPIO19| GPIO25 | GPIO15 | GPIO15 |
33-
* +--------------+---------+-------+----------+----------+----------+
34-
* | SCK (SCLK) | GPIO14 | GPIO18| GPIO19 | GPIO16 | GPIO16 |
35-
* +--------------+---------+-------+----------+----------+----------+
25+
* +--------------+---------+-------+----------+----------+----------+----------+----------+
26+
* | SPI Pin Name | ESP8266 | ESP32 | ESP32S2 | ESP32‑S3 | ESP32‑C3 | ESP32‑C6 | ESP32‑H2 |
27+
* +==============+=========+=======+==========+==========+==========+==========+==========+
28+
* | CS (SS) | GPIO15 | GPIO5 | GPIO34 | GPIO10 | GPIO7 | GPIO18 | GPIO0 |
29+
* +--------------+---------+-------+----------+----------+----------+----------+----------+
30+
* | DI (MOSI) | GPIO13 | GPIO23| GPIO35 | GPIO11 | GPIO6 | GPIO19 | GPIO25 |
31+
* +--------------+---------+-------+----------+----------+----------+----------+----------+
32+
* | DO (MISO) | GPIO12 | GPIO19| GPIO37 | GPIO13 | GPIO5 | GPIO20 | GPIO11 |
33+
* +--------------+---------+-------+----------+----------+----------+----------+----------+
34+
* | SCK (SCLK) | GPIO14 | GPIO18| GPIO36 | GPIO12 | GPIO4 | GPIO21 | GPIO10 |
35+
* +--------------+---------+-------+----------+----------+----------+----------+----------+
3636
*
3737
* For more info see file README.md in this library or on URL:
3838
* https://github.com/espressif/arduino-esp32/tree/master/libraries/SD
@@ -214,9 +214,10 @@ void setup(){
214214

215215
#ifdef REASSIGN_PINS
216216
SPI.begin(sck, miso, mosi, cs);
217-
#endif
218-
//if(!SD.begin(cs)){ //Change to this function to manually change CS pin
217+
if(!SD.begin(cs)){
218+
#else
219219
if(!SD.begin()){
220+
#endif
220221
Serial.println("Card Mount Failed");
221222
return;
222223
}

libraries/SD/examples/SD_time/SD_time.ino

+14-13
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@
2222
* Note: The SPI pins can be manually configured by using `SPI.begin(sck, miso, mosi, cs);`.
2323
* Alternatively you can change only the CS pin with `SD.begin(CSpin)` and keep the default settings for other pins.
2424
*
25-
* +--------------+---------+-------+----------+----------+----------+
26-
* | SPI Pin Name | ESP8266 | ESP32 | ESP32-S2 | ESP32-C3 | ESP32-S3 |
27-
* +==============+=========+=======+==========+==========+==========+
28-
* | CS (SS) | GPIO15 | GPIO5 | GPIO5 | GPIO13 | GPIO13 |
29-
* +--------------+---------+-------+----------+----------+----------+
30-
* | DI (MOSI) | GPIO13 | GPIO23| GPIO24 | GPIO14 | GPIO14 |
31-
* +--------------+---------+-------+----------+----------+----------+
32-
* | DO (MISO) | GPIO12 | GPIO19| GPIO25 | GPIO15 | GPIO15 |
33-
* +--------------+---------+-------+----------+----------+----------+
34-
* | SCK (SCLK) | GPIO14 | GPIO18| GPIO19 | GPIO16 | GPIO16 |
35-
* +--------------+---------+-------+----------+----------+----------+
25+
+----------+
26+
* | SPI Pin Name | ESP8266 | ESP32 | ESP32S2 | ESP32‑S3 | ESP32‑C3 | ESP32‑C6 | ESP32‑H2 |
27+
* +==============+=========+=======+==========+==========+==========+==========+==========+
28+
* | CS (SS) | GPIO15 | GPIO5 | GPIO34 | GPIO10 | GPIO7 | GPIO18 | GPIO0 |
29+
* +--------------+---------+-------+----------+----------+----------+----------+----------+
30+
* | DI (MOSI) | GPIO13 | GPIO23| GPIO35 | GPIO11 | GPIO6 | GPIO19 | GPIO25 |
31+
* +--------------+---------+-------+----------+----------+----------+----------+----------+
32+
* | DO (MISO) | GPIO12 | GPIO19| GPIO37 | GPIO13 | GPIO5 | GPIO20 | GPIO11 |
33+
* +--------------+---------+-------+----------+----------+----------+----------+----------+
34+
* | SCK (SCLK) | GPIO14 | GPIO18| GPIO36 | GPIO12 | GPIO4 | GPIO21 | GPIO10 |
35+
* +--------------+---------+-------+----------+----------+----------+----------+----------+
3636
*
3737
* For more info see file README.md in this library or on URL:
3838
* https://github.com/espressif/arduino-esp32/tree/master/libraries/SD
@@ -208,9 +208,10 @@ void setup(){
208208

209209
#ifdef REASSIGN_PINS
210210
SPI.begin(sck, miso, mosi, cs);
211-
#endif
212-
//if(!SD.begin(cs)){ //Change to this function to manually change CS pin
211+
if(!SD.begin(cs)){
212+
#else
213213
if(!SD.begin()){
214+
#endif
214215
Serial.println("Card Mount Failed");
215216
return;
216217
}

0 commit comments

Comments
 (0)