Skip to main content

T5AI Peripheral Mapping

This document describes the mapping relationship between T5AI hardware peripherals and Tuya TKL layer software peripheral ports.

GPIO

  • All GPIO pins on the module support interrupts.
Board PinFunctionSoftware PinSoftware Port
P0 - P55GPIOTUYA_GPIO_NUM_0 - TUYA_GPIO_NUM_55/

ADC

  • The module supports one 12-bit ADC, with 11 acquisition channels per ADC group.
Board PinFunctionSoftware PinSoftware port
P25ADC1ch_1TUYA_ADC_NUM_0
P24ADC2ch_2TUYA_ADC_NUM_0
P23ADC3ch_3TUYA_ADC_NUM_0
P28ADC4ch_4TUYA_ADC_NUM_0
P22ADC5ch_5TUYA_ADC_NUM_0
P21ADC6ch_6TUYA_ADC_NUM_0
P8ADC10ch_10TUYA_ADC_NUM_0
P0ADC12ch_12TUYA_ADC_NUM_0
P1ADC13ch_13TUYA_ADC_NUM_0
P12ADC14ch_14TUYA_ADC_NUM_0
P13ADC15ch_15TUYA_ADC_NUM_0

IIC

  • The module supports 2 hardware IIC channels.
  • Software supports 3 IIC channels. By default, the first two are hardware IIC and the third is software-simulated IIC. You can also configure all three channels as software-simulated IIC.
  • The second hardware IIC channel has 4 pin groups available for selection. You need to call the tkl_io_pinmux_config interface to configure it before IIC initialization.
  • If you want to use software-simulated IIC, you need to call the tkl_io_pinmux_config interface to map non-hardware IIC pins to corresponding function pins before IIC initialization.

Hardware IIC

Board PinFunctionSoftware PinSoftware Port
P20I2C0_SCLTUYA_IIC0_SCLTUYA_I2C_NUM_0
P21I2C0_SDATUYA_IIC0_SDATUYA_I2C_NUM_0
P0I2C1_SCLTUYA_IIC1_SCLTUYA_I2C_NUM_1
P1I2C1_SDATUYA_IIC1_SDATUYA_I2C_NUM_1
P14I2C1_SCLTUYA_IIC1_SCLTUYA_I2C_NUM_1
P15I2C1_SDATUYA_IIC1_SDATUYA_I2C_NUM_1
P38I2C1_SCLTUYA_IIC1_SCLTUYA_I2C_NUM_1
P39I2C1_SDATUYA_IIC1_SDATUYA_I2C_NUM_1
P42I2C1_SCLTUYA_IIC1_SCLTUYA_I2C_NUM_1
P43I2C1_SDATUYA_IIC1_SDATUYA_I2C_NUM_1

UART

  • The module supports 3 UART channels.
  • By default, the second UART channel (UART1) is the module log port and is not recommended for use as a regular UART.
  • The third UART channel has 2 pin groups available for selection. You can call the tkl_io_pinmux_config interface to configure it before UART initialization.
Board PinFunctionSoftware PinSoftware Port
P11UART0_TXTUYA_UART0_TXTUYA_UART_NUM_0
P10UART0_RXTUYA_UART0_RXTUYA_UART_NUM_0
P13UART0_CTSTUYA_UART0_CTSTUYA_UART_NUM_0
P12UART0_RTSTUYA_UART0_RTSTUYA_UART_NUM_0
P0UART1_TXTUYA_UART1_TXTUYA_UART_NUM_1
P1UART1_RXTUYA_UART1_RXTUYA_UART_NUM_1
P31 (default)UART2_TXTUYA_UART2_TXTUYA_UART_NUM_2
P30 (default)UART2_RXTUYA_UART2_RXTUYA_UART_NUM_2
P41UART2_TXTUYA_UART2_TXTUYA_UART_NUM_2
P40UART2_RXTUYA_UART2_RXTUYA_UART_NUM_2

PWM

  • The module supports 12 PWM channels.
Board PinFunctionSoftware PinSoftware Port
P18PWMG0_PWM0TUYA_PWM0TUYA_PWM_NUM_0
P24PWMG0_PWM4TUYA_PWM1TUYA_PWM_NUM_1
P32PWMG1_PWM0TUYA_PWM2TUYA_PWM_NUM_2
P34PWMG1_PWM2TUYA_PWM3TUYA_PWM_NUM_3
P36PWMG1_PWM4TUYA_PWM4TUYA_PWM_NUM_4
P19PWMG0_PWM1TUYA_PWM5TUYA_PWM_NUM_5
P8PWMG0_PWM2TUYA_PWM6TUYA_PWM_NUM_6
P9PWMG0_PWM3TUYA_PWM7TUYA_PWM_NUM_7
P25PWMG0_PWM5TUYA_PWM8TUYA_PWM_NUM_8
P33PWMG1_PWM1TUYA_PWM9TUYA_PWM_NUM_9
P35PWMG1_PWM3TUYA_PWM10TUYA_PWM_NUM_10
P37PWMG1_PWM5TUYA_PWM11TUYA_PWM_NUM_11

TIMER

  • The module supports 6 hardware timers.

  • The system occupies the first 3 timers. It is recommended that users start using from the 4th timer (TUYA_TIMER_NUM_3).

SPI

  • Hardware supports 2 SPI channels.
  • Software supports 4 SPI channels. The first two are hardware SPI, and the last two are hardware QSPI simulating SPI protocol.
  • The first SPI channel has 2 pin groups available for selection. You can call the tkl_io_pinmux_config interface to configure it before SPI initialization.
Board PinFunctionSoftware PinSoftware Port
P15 (default)SPI0_CSNTUYA_SPI0_CSTUYA_SPI_NUM_0
P14 (default)SPI0_SCKTUYA_SPI0_CLKTUYA_SPI_NUM_0
P16 (default)SPI0_MOSITUYA_SPI0_MOSITUYA_SPI_NUM_0
P17 (default)SPI0_MISOTUYA_SPI0_MISOTUYA_SPI_NUM_0
P45SPI0_CSNTUYA_SPI0_CSTUYA_SPI_NUM_0
P44SPI0_SCKTUYA_SPI0_CLKTUYA_SPI_NUM_0
P46SPI0_MOSITUYA_SPI0_MOSITUYA_SPI_NUM_0
P47SPI0_MISOTUYA_SPI0_MISOTUYA_SPI_NUM_0
P3SPI1_CSNTUYA_SPI1_CSTUYA_SPI_NUM_1
P2SPI1_SCKTUYA_SPI1_CLKTUYA_SPI_NUM_1
P4SPI1_MOSITUYA_SPI1_MOSITUYA_SPI_NUM_1
P5SPI1_MISOTUYA_SPI1_MISOTUYA_SPI_NUM_1
P23QSPI0_CSTUYA_QSPI0_CSTUYA_SPI_NUM_2
P22QSPI0_SCKTUYA_QSPI0_CLKTUYA_SPI_NUM_2
P24QSPI0_IO0TUYA_QSPI0_IO0TUYA_SPI_NUM_2
P25QSPI0_IO1TUYA_QSPI0_IO1TUYA_SPI_NUM_2
P26QSPI0_IO2TUYA_QSPI0_IO2TUYA_SPI_NUM_2
P27QSPI0_IO3TUYA_QSPI0_IO3TUYA_SPI_NUM_2
P3QSPI1_CSTUYA_QSPI1_CSTUYA_SPI_NUM_3
P2QSPI1_SCKTUYA_QSPI1_CLKTUYA_SPI_NUM_3
P4QSPI1_IO0TUYA_QSPI1_IO0TUYA_SPI_NUM_3
P5QSPI1_IO1TUYA_QSPI1_IO1TUYA_SPI_NUM_3
P6QSPI1_IO2TUYA_QSPI1_IO2TUYA_SPI_NUM_3
P7QSPI1_IO3TUYA_QSPI0_IO3TUYA_SPI_NUM_3

QSPI

  • The module supports 2 QSPI channels.
Board PinFunctionSoftware PinSoftware Port
P23QSPI0_CSTUYA_QSPI0_CSTUYA_QSPI_NUM_0
P22QSPI0_SCKTUYA_QSPI0_CLKTUYA_QSPI_NUM_0
P24QSPI0_IO0TUYA_QSPI0_IO0TUYA_QSPI_NUM_0
P25QSPI0_IO1TUYA_QSPI0_IO1TUYA_QSPI_NUM_0
P26QSPI0_IO2TUYA_QSPI0_IO2TUYA_QSPI_NUM_0
P27QSPI0_IO3TUYA_QSPI0_IO3TUYA_QSPI_NUM_0
P3QSPI1_CSTUYA_QSPI1_CSTUYA_QSPI_NUM_1
P2QSPI1_SCKTUYA_QSPI1_CLKTUYA_QSPI_NUM_1
P4QSPI1_IO0TUYA_QSPI1_IO0TUYA_QSPI_NUM_1
P5QSPI1_IO1TUYA_QSPI1_IO1TUYA_QSPI_NUM_1
P6QSPI1_IO2TUYA_QSPI1_IO2TUYA_QSPI_NUM_1
P7QSPI1_IO3TUYA_QSPI0_IO3TUYA_QSPI_NUM_1

RGB

  • The module supports one hardware RGB 888 channel.
  • If the target screen's pixel format is RGB565, then RGB_R0 - RGB_R2, RGB_G0 - RGB_G1, RGB_B0 - RGB_B2 ports will not be initialized.
  • If the target screen's pixel format is RGB666, then RGB_R0 - RGB_R1, RGB_G0 - RGB_G1, RGB_B0 - RGB_B1 ports will not be initialized.
Board PinFunctionSoftware PinSoftware Port
P50RGB_R0//
P49RGB_R1//
P48RGB_R2//
P23RGB_R3//
P22RGB_R4//
P21RGB_R5//
P20RGB_R6//
P19RGB_R7//
P52RGB_G0//
P51RGB_G1//
P42RGB_G2//
P41RGB_G3//
P40RGB_G4//
P26RGB_G5//
P25RGB_G6//
P24RGB_G7//
P55RGB_B0//
P54RGB_B1//
P53RGB_B2//
P47RGB_B2//
P46RGB_B5//
P45RGB_B5//
P44RGB_B6//
P43RGB_B7//
P14RGB_DCLK//
P15RGB_DISP//
P16RGB_DE//
P17RGB_HSYNC//
P18RGB_VSYNC//

8080

  • The module supports 1 MCU 8080 channel.
  • The 8080 interface only supports 3 pixel formats:
    • 8-bit or 16-bit width RGB888
    • 18-bit width RGB666
    • 8-bit width RGB565
  • If the data format is 8-bit width, then I8080_D8 - I8080_D17 will not be initialized. If the data format is 16-bit width, then I8080_D16 - I8080_D17 will not be initialized.
Board PinFunctionSoftware PinSoftware Port
P47I8080_D0//
P46I8080_D1//
P45I8080_D2//
P44I8080_D3//
P43I8080_D4//
P42I8080_D5//
P41I8080_D6//
P40I8080_D7//
P21I8080_D8//
P20I8080_D9//
P19I8080_D10//
P18I8080_D11//
P17I8080_D12//
P16I8080_D13//
P15I8080_D14//
P14I8080_D15//
P48I8080_D16//
P49I8080_D17//
P26I8080_RDX//
P25I8080_WDX//
P24I8080_RSX//
P23I8080_RESET//
P22I8080_CSX//

TOUCH

  • The module supports 16 capacitive sensing GPIO channels.
  • This feature is for debugging and learning purposes only. It is not recommended for use in production products. (Enabling this feature will cause ESD test failures)
Board PinFunctionSoftware PinSoftware Port
P12TOUCH0/0x00000001
P13TOUCH1/0x00000002
P28TOUCH2/0x00000004
P29TOUCH3/0x00000008
P30TOUCH4/0x00000010
P31TOUCH5/0x00000020
P32TOUCH6/0x00000040
P33TOUCH7/0x00000080
P34TOUCH8/0x00000100
P35TOUCH9/0x00000200
P36TOUCH10/0x00000400
P37TOUCH11/0x00000800
P38TOUCH12/0x00001000
P39TOUCH13/0x00002000
P46TOUCH14/0x00004000
P47TOUCH15/0x00008000

SDIO

  • The module supports 1 SDIO channel.
  • This SDIO channel supports 2 pin groups available for selection. You can call the tkl_io_pinmux_config interface to configure it before SDIO initialization.
  • Currently, the software only supports 1-bit SDIO, not 4-bit SDIO.
Board PinFunctionSoftware PinSoftware Port
P2 (default)SDIO_CLKTUYA_SDIO_HOST_CLK/
P3 (default)SDIO_CMDTUYA_SDIO_HOST_CMD/
P4 (default)SDIO_DATA0TUYA_SDIO_HOST_D0/
P5 (default)SDIO_DATA1TUYA_SDIO_HOST_D1/
P6 (default)SDIO_DATA2TUYA_SDIO_HOST_D2/
P7 (default)SDIO_DATA3TUYA_SDIO_HOST_D3/
P14SDIO_CLKTUYA_SDIO_HOST_CLK/
P15SDIO_CMDTUYA_SDIO_HOST_CMD/
P16SDIO_DATA0TUYA_SDIO_HOST_D0/
P17SDIO_DATA1TUYA_SDIO_HOST_D1/
P18SDIO_DATA2TUYA_SDIO_HOST_D2/
P19SDIO_DATA3TUYA_SDIO_HOST_D3/

DVP

  • The module supports 1 DVP channel.
  • If clk is set to 0, it is considered that the sensor does not need the module to output a drive clock, then CIS_MCLK will not be initialized.
Board PinFunctionSoftware PinSoftware Port
P27CIS_MCLK//
P29CIS_PCLK//
P30CIS_HSYNC//
P31CIS_VSYNC//
P32CIS_PXD0//
P33CIS_PXD1//
P34CIS_PXD2//
P35CIS_PXD3//
P36CIS_PXD4//
P37CIS_PXD5//
P38CIS_PXD6//
P39CIS_PXD7//