Skip to content

Generic - BK7238 (Tuya T1)

by Generic - product page

Information  
Board code generic-bk7238-tuya
MCU Beken BK7238
Series BK72XX
Partition layout Tuya default for T1/BK7238 (dynamic OTA, RF 0x1E3000)
Encryption keys -- no encryption --
Specifications  
Frequency 120 MHz
Flash size 2 MiB
RAM size 256 KiB
Voltage 3.0V - 3.6V
I/O 19x GPIO, 6x PWM, 2x UART, 6x ADC
Wi-Fi 802.11 b/g/n
Bluetooth BLE v5.2

Usage

Board code: generic-bk7238-tuya

In platformio.ini:

[env:generic-bk7238-tuya]
platform = libretiny
board = generic-bk7238-tuya
framework = arduino

In ESPHome YAML:

bk72xx:
  board: generic-bk7238-tuya

Quick flashing guide

Pin Connection
P10 / RX1 TX of USB-UART adapter
P11 / TX1 RX of USB-UART adapter
CEN (Chip-Enable) GND to reset the chip
  1. Connect the USB-UART adapter.
  2. Start the flashing process.
  3. Keep shorting CEN to GND or power-cycling the device, until flashing starts.

Pin functions

Name(s) UART I²C SPI PWM Other
P0 TX2
P1, ADC5 RX2
P6 PWM0 TCK
P7 PWM1 TMS
P8 PWM2 TDI
P9 PWM3 TDO
P10, ADC6 RX1
P11 TX1
P14 SCK
P15 SCL2 CS
P16 MOSI
P17 SDA2 MISO
P20, ADC3
P21
P22
P23
P24, ADC2 SCL2 PWM4
P26, ADC1 SDA2 PWM5
P28, ADC4

Flash memory map

Flash size: 2 MiB / 2,097,152 B / 0x200000

Hex values are in bytes.

Name Code Start Length End
Bootloader bootloader 0x000000 68 KiB / 0x11000 0x011000
App Image app 0x011000 1.1 MiB / 0x11B000 0x12C000
OTA Image download 0x12C000 724 KiB / 0xB5000 0x1E1000
OTA Info (Tuya) diff2ya 0x1E1000 4 KiB / 0x1000 0x1E2000
(reserved) - 0x1E2000 4 KiB / 0x1000 0x1E3000
Calibration calibration 0x1E3000 4 KiB / 0x1000 0x1E4000
LibreTiny Storage kvs 0x1E4000 32 KiB / 0x8000 0x1EC000
User Data userdata 0x1EC000 80 KiB / 0x14000 0x200000
Tuya Storage tuya 0x1F5000 44 KiB / 0xB000 0x200000

Bootloader and app partitions contain CRC16 sums every 32 bytes. That results in the actual flash offsets/sizes not aligned to sector boundaries. To simplify calculations, the values shown in the table (extracted from bootloader's partition table) were aligned to 4096 bytes.