Opens in a new tab

Tuya CBU Pinout (BK7231N)

CBU is a Tuya module with the Beken BK7231N chip and 21 pins – it has the most free GPIO of all common Tuya modules. You’ll find it in multi-button switches, LED controllers and development boards.

Flashed with OpenBeken or LibreTiny, it becomes an inexpensive Wi-Fi microcontroller with 18 GPIO.

Specifications

  • BK7231N: 32-bit Arm, Wi-Fi 4 (2.4 GHz) and Bluetooth LE
  • 2 MB flash
  • 21 pins (7 + 7 on the sides with a 1.4 mm pitch, 7 at the bottom), 15.8 × 20.3 mm
  • 18 GPIO, 6 PWM channels, 1 analog input (P23), SPI, 2× UART, I2C
  • 3.3 V power

Flashing goes through UART1 (P10 RX, P11 TX) and the CEN reset. Pin P21 is only a test pad on the bottom of the module.

Pinout and pin table

Hover over a pin in the diagram or a table row; use the filter to highlight a bus. You can download the pinout as PNG or SVG.

Tuya CBU (BK7231N) – pinoutTuya CBU (BK7231N) – pinoutchiptron.eu · CC BY 4.0CBUBK7231N 1 P14 SCK 2 P16 MOSI 3 P20 SCL1 TCK 4 P22 TDI 5 P23 ADC3 TDO 6 P1 RX2 7 P0 TX2 21 P15 CS 20 P17 MISO 19 P9 PWM3 18 CEN ← Reset – connecting to GND restarts the chip 17 P28 16 P10 RX1 15 P11 TX1 8 P8 PWM2 9 P7 PWM1 10 P6 PWM0 11 P26 PWM5 14 3V3 ← Power 3.3 V 13 GND 12 P24 PWM4 GPIO UART I2C SPI ADC (analog) PWM Power Ground (GND) Control / reset
Download:PNGSVG
Pin table – Tuya CBU (BK7231N)
PinNameDirectionUARTI2CSPIPWMADCNote
1P14input/outputSCK
2P16input/outputMOSI
3P20input/outputSCL1I2C1 SCL; JTAG TCK; flash programming via SPI (FSCK)
4P22input/outputJTAG TDI; flash programming via SPI (FSI)
5P23input/outputADC3ADC3 – the only analog input; JTAG TDO; flash programming (FSO)
6P1input/outputRX2SDA2UART2 RX; I2C2 SDA
7P0input/outputTX2SCL2UART2 TX – log output; I2C2 SCL
8P8input/outputPWM2
9P7input/outputPWM1
10P6input/outputPWM0
11P26input/outputPWM5
12P24input/outputPWM4
13GND–
143V3inputPower 3.3 V
15P11input/outputTX1UART1 TX – firmware upload
16P10input/outputRX1UART1 RX – firmware upload (bk7231tools, ltchiptool, OpenBeken)
17P28input/output
18CENinputReset (CEN, active low) – connecting to GND restarts the chip; when uploading via UART1 it is used to enter the bootloader
19P9input/outputPWM3
20P17input/outputMISO
21P15input/outputCS
test padP21input/outputSDA1Test pad on the bottom (TCSN): I2C1 SDA; JTAG TMS; flash programming (FCS). Must not be logic 0 at power-up (test mode)

What to watch out for

  • Disconnect the device from the 230 V mains before opening it. Program the module only from a 3.3 V USB-serial converter.
  • The pad pitch is 1.4 mm – a fine tip and flux help when soldering wires.
  • Before overwriting the firmware, back up the original flash contents.
  • P23 is the only analog input.

More pinouts

See all pinouts on the Pinouts page.

Related Articles