logo elektroda
logo elektroda
X
logo elektroda

BK7231T/BK7231N WiFi, MQTT, template and IP configuration at flash time via UART - OpenBeken flasher

p.kaczmarek2 
Close-up view of BK7231 chip on a circuit board.
BK7231GUIFlashTool allows you to configure OpenBeken at the flash time - there is no need for Open Access Point configuration, everything can be done on your PC. Here I will show you how to do it step by step.

Why?
The usual BK7231 flashing and configuration process is similar to Tasmota/Esphome/Etc. First you flash firmware via UART (there is also a wireless option, but this topic refers to wired method), then software creates open access point where you connect and configure your device.
However, there is an alternate way to do it in OpenBeken.
With OpenBeken, you can configure OBK at the flash time - that way you can read and write OBK config via UART.
This lets you skip the "open access point" part and enter your WiFi data from your PC.
This has several advantages, including:
- it is quicker than open access point method
- it does not disconnect you from internet, if you connect to web via the same WiFi you'd use for OBK
- if your device is battery powered, there is no risk of device going back to sleep
- this can help you recover from potential wrong configuration and boot problems
- this can be one of the ways of automatic GPIO config (but we'll cover it another time)
- soon this can help you batch-convert devices

Step 1: Flash your device via UART
Just do the usual process of programming BK7231, see our readme for more information:
https://github.com/openshwprojects/BK7231GUIFlashTool
You can also watch tutorials on our YT channel:
https://www.youtube.com/@elektrodacom

Step 2: Once OBK is flashed, do the OBK config read
Click "Read only OBK config" to read the OBK config from device flash to the application memory via UART:
BK7231 Easy UART Flasher interface with configuration and flashing options.
Do the CEN reset or power cycle if required. If you want to have automatic restart while using BK7231GUIFlashTool flash tool, please enable flag 31 ("enable UART command line")

Step 3: Modify OBK config
Click "Change OBK settings" and change settings to suit your needs:
BK7231GUIFlashTool software interface displaying configuration read success.
Here you can enter your WiFi data, IP settings, MQTT settings, flags, and even a short startup command. More options will be added soon.

Step 4: Save back OBK config
Now, press "Write only OBK config" and do power cycle if needed (if UART command line is enabled, it will not be needed):
BK7231GUIFlashTool interface with successful OBK configuration read.


Summary
That's all! This way you can configure your OBK without even creating an access point, so there is also no potential security risk of someone else accessing it at the config time. This can be very hand for many users. Let me know what you think about this option.
Soon I will also cover more options of BK7231GUIFlashTool , so stay tuned for another topic! If you have any feature request, feel free to ask.

About Author
p.kaczmarek2
p.kaczmarek2 wrote 11922 posts with rating 9984 , helped 572 times. Been with us since 2014 year.

Comments

Tony2k 08 Nov 2023 09:28

I'm trying to flash a bk7231N smart switch but I have write fails. Changing baud rate only changes the sector at which the error occurs, this is the log: All selected sectors erased! Writing sector... [Read more]

p.kaczmarek2 08 Nov 2023 10:27

You can try to shorten the wires to the programmer. You can also use old hid_download_py method: Which USB to UART dongle are you using? [Read more]

Tony2k 08 Nov 2023 10:40

I use FT232 (probably not genuine). I'll try to shorten wires. [Read more]

p.kaczmarek2 08 Nov 2023 10:43

And how do you power the device? You can also try to set longer delays in one of the tabs of BK7231 flasher [Read more]

Tony2k 08 Nov 2023 10:49

I tried powering it both from FT232 and from the onboard power supply. Do you mean UART timeouts? I tried to set 10/10/5 but nothing. [Read more]

Tony2k 11 Nov 2023 14:03

@pkaczmarek262 could the problem be related to the MCU that is integrated on the mainboard and it's connected to the wifi module? https://obrazki.elektroda.pl/2704743200_1699707682_thumb.jpg [Read more]

p.kaczmarek2 11 Nov 2023 14:19

It indeed seems that RXD trace is used for some other purpose. Can you check where it leads? Maybe you need to temporarily cut it, just like we did on our video tutorial: [Read more]

Tony2k 11 Nov 2023 15:12

I cutted the trace (it goes to the button, now led doesn't works) but nothing changed. I also tried so set delay to 50 and now flash ends but I have CRC fail. [Read more]

divadiow 26 May 2024 13:17

please compile and release latest easy flasher with commits since last in December https://github.com/openshwprojects/BK7231GUIFlashTool/commit/29c2881a6e32b5f6e90e47fa65a0bc5378a2cc60#commitcomment-142314938 and... [Read more]

p.kaczmarek2 26 May 2024 14:15

Sure, here is a latest release, please check if it's ok: https://github.com/openshwprojects/BK7231GUIFlashTool What is the use case of custom offsets/lengths? PS: In general, please try to open requests... [Read more]

divadiow 26 May 2024 14:20

thank you. I can't recall most recent use, but when playing with flashing unknown or odd chips it's useful. I've used non-Easy Flasher tools in the past to achieve this. It's fine, most people won't... [Read more]