Download mode - Beken 72xx
Downloading is done using UART. For best experience, you should have two USB<->UART adapters plugged in:
- One for flashing, preferably a real FT232RL or a good alternative. This connects to UART1 of the chip.
- One for log output - BK72xx outputs messages on a separate port. You can have a terminal session continuously open on this adapter. This connects to UART2 of the chip - but it's not necessary for flashing.
Read Using ltchiptool to learn the flashing procedure
Connect UART1 of the BK7231 to the USB-TTL adapter:
|RX||TX1 (GPIO11 / P11)|
|TX||RX1 (GPIO10 / P10)|
|RTS||CEN (or RST, optional)|
Make sure to use a good 3.3V power supply, otherwise the adapter might lose power during chip reset. Usually, the adapter's power regulator is not enough and an external power supply is needed (like AMS1117).
If you didn't connect RTS to CEN, after starting the flasher you have around 20 seconds to reset the chip manually. In order to do that, you need to bridge CEN to GND with a wire.
Note that the download mode can only be activated when the flasher is running (there's no GPIO-strapping like on ESP8266). Additionally, BK7231T (not N) will exit the download mode when the flasher finishes its work.
BK7231N can't be software-bricked, because it has a ROM that contains the download mode. BK7231T doesn't contain it, so be careful with this one.
ltchiptool's Beken flashing program is based on bk7231tools. Refer to the guide for information how to use it, but keep in mind that using the ltchiptool GUI is probably just easier.
If you have a recent version of LibreTiny installed on the chip, you can use Auto-download-reboot to reboot the chip automatically. This is enabled by default, so you don't have to change anything.
If you only have a single adapter, or just want to use the UART1 (upload) port only, you can change the logging port.
Refer to Options & config (
Serial output section). Set
1, which will use UART1 for all output.
Firmware output files
These files are present in the build directory after successful compilation:
|firmware.uf2||UF2 package for UART and OTA upload|
|image_bk7231t_app.ota.rbl||Beken OTA package (e.g. OpenBeken)|
|image_bk7231t_app.ota.ug.bin||Tuya OTA package (incl. Cloudcutter)|
|image_bk7231t_app.0x011000.rbl||App partition - flashable at 0x11000|
|image_bk7231t_app.0x011000.crc||Encrypted app image - not for flashing|
|image_bk7231t_app.0x129F0A.rblh||RBL header - not for flashing|
SPI flashing (unbricking BK7231T)
The bk7231_spi_flasher.py script can be used to put BK7231 in SPI flashing mode. Then, one can use flashrom to read/write the raw flash chip.
These tools are not recommended and are kept here for reference only. Don't use them, please.