Skip to main content

ESP32-C6 Peripheral Mapping

This document describes the mapping between ESP32-C6 (single-core RISC-V, Wi-Fi 6, Thread/Zigbee) on-chip peripherals and the TuyaOpen TKL layer software ports.

GPIO

  • All GPIO pins support interrupts.
  • TUYA_GPIO_NUM_E enum values map 1:1 to physical ESP32-C6 GPIO numbers.
  • 31 GPIOs in total (GPIO0 ~ GPIO30), no gaps.
GPIO RangeTUYA_GPIO_NUM RangeNotes
GPIO0 ~ GPIO30TUYA_GPIO_NUM_0 ~ TUYA_GPIO_NUM_30General-purpose IO, all usable

UART

  • 2 UART ports supported.
  • UART0 TX/RX pins are controlled by Kconfig options UART_NUM0_TX_PIN / UART_NUM0_RX_PIN, defaulting to GPIO16 / GPIO17.
  • UART1 has no dedicated IO_MUX pins and routes through the GPIO Matrix. Default pins can be overridden before initialization via tkl_io_pinmux_config().
Changing UART0 Pins

Run tos.py config menu in your project directory to enter the board configuration menu, find the relevant options and set the target GPIO numbers, or edit the default entries in boards/ESP32/ESP32-C6/Kconfig directly, then rebuild.

Board PinFunctionSoftware PinSoftware Port
GPIO16 (default)UART0_TXTUYA_GPIO_NUM_16TUYA_UART_NUM_0
GPIO17 (default)UART0_RXTUYA_GPIO_NUM_17TUYA_UART_NUM_0
GPIO6 (default)UART1_TXTUYA_GPIO_NUM_6TUYA_UART_NUM_1
GPIO7 (default)UART1_RXTUYA_GPIO_NUM_7TUYA_UART_NUM_1

I2C

  • 1 hardware I2C port supported (TUYA_I2C_NUM_0).
  • Default pins can be overridden before initialization via tkl_io_pinmux_config().
Board Pin (default)FunctionSoftware PinSoftware Port
GPIO0I2C0_SCLTUYA_IIC0_SCLTUYA_I2C_NUM_0
GPIO1I2C0_SDATUYA_IIC0_SDATUYA_I2C_NUM_0

PWM

  • 6 PWM channels, implemented using ESP-IDF LEDC driver (LEDC_LOW_SPEED_MODE, 12-bit resolution).
  • Default pins can be overridden before initialization via tkl_io_pinmux_config().
  • All default PWM pins (GPIO18–GPIO26) are within the C6 GPIO range (0–30).
Board Pin (default)FunctionSoftware PinSoftware Port
GPIO18PWM0TUYA_PWM0TUYA_PWM_NUM_0
GPIO19PWM1TUYA_PWM1TUYA_PWM_NUM_1
GPIO22PWM2TUYA_PWM2TUYA_PWM_NUM_2
GPIO23PWM3TUYA_PWM3TUYA_PWM_NUM_3
GPIO25PWM4TUYA_PWM4TUYA_PWM_NUM_4
GPIO26PWM5TUYA_PWM5TUYA_PWM_NUM_5

ADC

  • ADC1 only (TUYA_ADC_NUM_0), 7 channels.
  • Channels are configured via bitmask (ch_list.data), where bit N enables ADC_CHANNEL_N.
  • Attenuation is fixed at ADC_ATTEN_DB_12 (~0–3.3 V range). Calibration uses the curve-fitting scheme.
Board PinADC ChannelSoftware Port
GPIO0ADC1_CH0TUYA_ADC_NUM_0
GPIO1ADC1_CH1TUYA_ADC_NUM_0
GPIO2ADC1_CH2TUYA_ADC_NUM_0
GPIO3ADC1_CH3TUYA_ADC_NUM_0
GPIO4ADC1_CH4TUYA_ADC_NUM_0
GPIO5ADC1_CH5TUYA_ADC_NUM_0
GPIO6ADC1_CH6TUYA_ADC_NUM_0

References