openshwprojects / BK7231GUIFlashTool

Easy to use, GUI, BK7231T/BK7231N flash tool and GPIO config extractor for beginners. Dedicated for Windows platform, but works on Linux with Mono. This tool can automatically download latest firmware (on user request) and then do a full BK backup and then write new flash cycle. This tool replaces old bkWriter 1.60 and hid_download_py.
232 stars 24 forks source link
beken bk7231 bk7231n bk7231t tuya uart

BK7231 GUI Flash Tool

BK7231 GUI Flash Tool a simple Windows application that allows you to flash the OpenBK firmware to Beken chipset (BK7231T or BK7231N, can also flash BK7231M and BL2028N) based devices without having extensive programming knowledge.

Futhermore, it automatically creates an original firmware backup, and uses it to extract GPIO configuration that you can later import in OBK Web Application (Import Tab).

❗ NOTE: The flash dump may contain your SSID and pass if the device was paired at the time of the backup

See also Russian guide for this tool and BK7231N.

Youtube Tutorial for example usage - CB2S flashing

See also the secondary example: WB3S flashing.

Per device flashing guides (NOTE: they may use obsolete flash tools, so always prefer to use new tool from this repo):

See also our youtube channel and forum

Compiling and Running on Linux

It should be possible to compile and run this tool on Linux by using Mono. Mono is an open-source implementation of the .NET Framework which is also sponsored by Microsoft.

Please note that if you're opting to run this tool under Linux, it is highly recommended for you to install Mono using your distro's package manager.

Once it's installed, you can compile this software by executing xbuild on the project directory. To execute the program, you can simply execute the following command:

mono BK7231Flasher/bin/debug/BK7231Flasher.exe

Brief usage instructions

  1. Connect UART to USB converter to Beken TXD1/RXD1
  2. Start flasher tool
  3. Select N or T platform
  4. Click "Download latest from web" to get firmware binary
  5. Click "Do backup and flash new"
  6. Reset/repower Beken
  7. Tool will do both read and flash in one row.
  8. Done!

No command line and no strange arguments required.

Detailed usage instructions

  1. Download and unpack executable from Releases tab on the right

  2. Prepare flashing circuit for BK7231 (both T and N)

    • Get a USB to UART bridge with 3.3V voltage signals
    • Connect the Bridge RX to Module TXD1, and Bridge TX to Module RXD1
    • If necessary, solder a wire to the CEN pad (if you want to RESET through shorting CEN to ground)
    • Power the device from either the bridge or an external power source. All Beken based modules require 3.3v.
      ⚠️ NEVER try hacking devices while connected to mains power!
  3. Open our flasher:

image

  1. Select proper platform - BK7231T or BK7231N
  2. Select your COM port of USB to UART converter
  3. Click "Download latest from Web" to get proper binary file
  4. Wait for download to finish

image

  1. Close download window
  2. Click "Backup and flash new"
  3. When the log window is waiting for "Getting bus", do a device reboot/reset. You can do this in two ways, choose one:

    • Option A: short CEN to GND for 0.25s (it is tricky to get this right, requires precise timing)
    • Option B: power off and on device (of course, it should not be connected to mains, use your own safe 3.3V power supply that can supply enough current)

image

  1. It will begin reading (it does first backup, then write)

image

  1. After reading, it will start the new firmware erase

image

  1. And then, automatically, write:

image

  1. Done:

image

  1. Firmware access point show appear now. Connect to it and enter 192.168.4.1 configuration page.
  2. Remember that saved firmware backup is in the "backups" dir

CRC Mismatch?

CRCs are calculated correctly for both N and T. If you get CRC mismatch, you are most likely selecting a wrong chip type. image

OBK Configuration via UART

See this tutorial: https://www.elektroda.com/rtvforum/viewtopic.php?p=20733610#20733610

Can't auto download firmware?

Firmware download will not work on systems without newer TLS version required by Github. You can always manually download release from here: https://github.com/openshwprojects/OpenBK7231T_App and put into firmwares bin, then restart flasher.

Automatic reboot on read/write (so you don't have to power cycle manually)

This tool supports automatic reboot command, just like bkWriter 1.60, but you have to enable UART command line in OBK for it first: image With this option enabled, OBK will receive the "reboot" string send by flasher on UART before any read/write operation is started and will automatically get bus.

Other problems?

You can also try changing the baudrate for flashing. Remember - sometimes higher baud rate might worker better than lower one!

If you still need help, you can ask on our forums: https://www.elektroda.com/