ESP32-C6-DevKitM-1 Pins seem completely wrong #19805
|
I've been tinkering with an ESP32-C6 from Waveshare specifically the ESP32-C6-Pico which as far as I can tell follows the pinout of the ESP32-C6-DevKitM-1. Now if I start up MicroPython and check the defined I2S and SPI hardware buses I get this: >> import machine
>>> machine.I2C(0)
I2C(0, scl=18, sda=19, freq=400000, timeout=50000)
>>> machine.I2C(1)
I2C(1, scl=9, sda=8, freq=400000, timeout=50000)
>>> machine.SPI(1)
SPI(id=1, baudrate=500000, polarity=0, phase=0, bits=8, firstbit=0, sck=6, mosi=7, miso=2)This seems to be in direct conflict with the pin layout as supplied by Expressif:
I'd expect at least one of the two defined I2C buses to use scl=7, sda=6 but instead they're on the SPI bus!? Does anyone know why? Firmware file used: https://micropython.org/download/ESP32_GENERIC_C6/ |
Replies: 3 comments 2 replies
|
Those pins are MicroPython's generic defaults for the chip, not a map of the DevKitM-1 labels. I checked the source.
So nothing is wrong. The defaults are only what you get when you pass no pins. The ESP32 docs say any available output-capable pins can be used, so pass the ones you want: from machine import Pin, I2C
i2c = I2C(0, scl=Pin(7), sda=Pin(6), freq=400000)
For SPI, the ESP32 quickref says hardware SPI on pins other than the defaults goes through the extra GPIO-multiplexing layer. That limits it to 40 MHz and can affect reliability at high speeds. At lower speeds you can pick any suitable pins. I checked the pin defaults in the source tree and docs. I haven't run it on a C6 or looked up the Waveshare Pico's pinout, so check your two pins against its pin diagram before wiring. |
Those are the low power I2C pins: note that GPIO 6 & 7 have the LP_I2C prefix. GPIO 6, 7 & 2 are on the Fast SPI bus of the C6. ESP32s of all flavours are pretty flexible about pin functions. Best to set and specify the pins you want to use rather than relying on defaults. |
|
Waveshare have produced a custom PCB intended to have similar pinout to the Pico. There is a pinout diagram in their docs. I would use this and follow the advice of @scruss re specifying pins in code. |

You're right that I overstated it. It isn't really per chip.
machine_i2c.hspecial-cases only the C3 and S3, and every other target, the C6 included, falls into one shared default (SCL 18 / SDA 19 for I2C0, SCL 9 / SDA 8 for I2C1, with the classic ESP32 getting 25 / 26 on I2C1). So it's closer to one default for the whole port with a couple of exceptions.On why MicroPython doesn't copy Espressif's tables: the file you linked is the Arduino core's variant map. For the generic C6 variant it sets SDA 23 / SCL 22 and SS 18 / MOSI 19 / MISO 20 / SCK 21, which is Arduino's choice of "what Wire and SPI mean on this board". MicroPython is built on ESP-IDF, not on the Arduino core, and as far as …