logo elektroda
logo elektroda
X
logo elektroda

[BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

p.kaczmarek2 220194 1308

TL;DR

  • OpenBK7231T adds a cross-platform C HTTP mini-server, web pin configurator, and MQTT integration for BK7231T-based WB2S/WB3S modules with Home Assistant control.
  • The design splits Windows-specific networking from reusable HTTP and pin code, so the same configurator and packet parser can run on Windows and on the BK7231T firmware.
  • The server listens on port 80, uses one int as a channel bitmask, and therefore supports up to 32 channels on a 32-bit platform.
  • MQTT callbacks propagate relay/button changes to Home Assistant and accept commands back, and a 4-relay setup uses wildcard topics like wb2s/1/get through wb2s/4/set.
  • The current pin configurator does not save settings to Flash yet, so configuration is still coded and compiled into the firmware.
AI summary based on the discussion. May contain errors.
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
📢 Listen (AI voice):
  • #211 19889316
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14724
    Help: 659
    Rate: 12806
    ExploWare wrote:

    I have created a pull request on Github for that.
    Line 264 should be 'not' instead of '!' and line 271 and 272 should be on one line


    Thanks, I have merged the pull request.

    Still, @ferbulous , can you still tell me which python version are you using? I'm curious because the code seemingly worked before fine for at least @btsimonh , I presume.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • bk7231tools firmware dump stops midway despite UART activity

    #212 19889317
    ferbulous
    Level 18  
    Posts: 419
    Help: 8
    Rate: 56
    @kmhn I was able to get 2mb firmware bin from bk7231tools, there was some issue where it just stop midway (10-20%) when reading the firmware.
    I'm not sure what I did afterwards, but I finally got the firmware, one thing I noticed was the UART was still blinking even after it was finished.

    Dodano po 7 [minuty]:

    @p.kaczmarek2 it was 3.10, i added that previous post
    I'm trying to use the hid_download tool to try and read firmware but not successful yet since it keeps getting stopped midway

    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
  • #213 19889338
    boozeman
    Level 11  
    Posts: 73
    Rate: 2
    @p.kaczmarek2

    Can we use OpenBK7231_App Repository's Wiki section to collect Hookup Guides for devices? Articles with pics and schematics if possible, how to open the case, what must be do before flashing, etc.
  • Repository wiki for device hookup guides

    #214 19889398
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14724
    Help: 659
    Rate: 12806
    boozeman wrote:

    Can we use OpenBK7231_App Repository's Wiki section to collect Hookup Guides for devices? Articles with pics and schematics if possible, how to open the case, what must be do before flashing, etc.

    Well, I am doing the same thing in Elektroda's teardown section for about at least one year already:
    https://www.elektroda.pl/rtvforum/topic3825966.html
    https://www.elektroda.pl/rtvforum/topic3793509.html
    https://www.elektroda.pl/rtvforum/topic3822484.html
    https://www.elektroda.pl/rtvforum/topic3806108.html
    https://www.elektroda.pl/rtvforum/topic3816656.html
    https://www.elektroda.pl/rtvforum/topic3798114.html
    and much more.

    See, two example schematics as drawn by me:
    Electrical schematic of WF-DS01 TUYA dimmer.
    Electrical schematic of TUYA WF-DS01 dimmer.
    If you like my work remember to support it at: https://paypal.me/openshwprojects

    You are all welcome to post your teardowns here on Elektroda so we have everything in one place:
    English section: https://www.elektroda.com/rtvforum/forum507.html
    (many teardowns are yet to be translated from polish to english)
    Polish section: https://www.elektroda.pl/rtvforum/forum507.html
    but if you prefer github, you can also submit device information there. Of course you don't have to do as detailed teardowns as I do on Elektroda, any information is welcome. If you need anything from me as from OpenBK7231_App Repository's Wiki maintainer, just tell me, I will be happy to help.

    Just note that every mine device (including devices donated by people here - strigona, etc) will have a dedicated topic on Elektroda teardowns section.
    Helpful post? Buy me a coffee.
  • #215 19889815
    ferbulous
    Level 18  
    Posts: 419
    Help: 8
    Rate: 56
    @p.kaczmarek2 hi, which firmware bin file should i pick for the device?

    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    Using hid_download.py still fails to completely read the firmware though

    If I use bkwriter for bk7231n, anything else I should change on the settings or just stick with the default?
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
  • #216 19889833
    ExploWare
    Level 10  
    Posts: 48
    Rate: 2
    @ferbulous
    I think you might want to hold off a bit longer.

    This N version looks to be even more a work in progress for some time to come and you haven't read up. I'd suggest to do some more research, read each message in this topic (there are all the answers to the questions you've asked up to now) and be aware you can brick your device(s)
  • BK7231N flashing command with startaddr 0x0

    #217 19890168
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14724
    Help: 659
    Rate: 12806
    ExploWare wrote:

    This N version looks to be even more a work in progress for some time to come and you haven't read up.


    In fact, I have just received reports from one of our polish users saying that the current version of OpenBK7321N (N version) is working:
    wiktor_m wrote:
    python uartprogram openbk7231app_QIO_1.0.0.bin -u -d com13 -w --startaddr 0x0

    wiktor_m wrote:

    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    I am not sure why he is using QIO version of binary and not UA (maybe it has something to do with startaddr 0x0), but the startaddr 0x0 and -u params (unprotect) are taken from original Beken company python tool so can assume they are correct.

    Is anyone else here (except Wiktor) willing to take the risk and test BK7231N build from my previous post?
    Helpful post? Buy me a coffee.
  • #218 19890291
    boozeman
    Level 11  
    Posts: 73
    Rate: 2
    @p.kaczmarek2 The last commit about the naming. My WB2S modules are recognized as BK7231N. They're Clearly BK7231T modules... I happily flashed them with the T version :)

    I made PR for it.
  • Config save may be lost on N version

    #219 19890376
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14724
    Help: 659
    Rate: 12806
    Thank you for typo correction.

    I've just checked with the one and only N module I recently received:
    Electronic module with various components on a circuit board held by pliers.
    It seems that N version is working. I will post a separate teardown/flashing guide topic soon.
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    EDIT: < redacted >
    EDIT2 : it seems that configuration save (pins and wifi creditentials) works on N version as well, altough I have one report from user saying that in his case the config crashes module (?)
    EDIT3: No, it seems that config is sometimes lost on N version, I will look into it later. Maybe we have to deprotect flash before saving configuration.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • N version works; hid_download flashes easily

    #221 19890939
    ferbulous
    Level 18  
    Posts: 419
    Help: 8
    Rate: 56
    p.kaczmarek2 wrote:
    Thank you for typo correction.

    I've just checked with the one and only N module I recently received:
    Electronic module with various components on a circuit board held by pliers.
    It seems that N version is working. I will post a separate teardown/flashing guide topic soon.
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    EDIT: < redacted >
    EDIT2 : it seems that configuration save (pins and wifi creditentials) works on N version as well, altough I have one report from user saying that in his case the config crashes module (?)
    EDIT3: No, it seems that config is sometimes lost on N version, I will look into it later. Maybe we have to deprotect flash before saving configuration.


    Using hid_download tool i was able to flash the firmware with ease, didn't even need to use cen for reset. Not sure why bkwriter doesn't work for me

    As for the cbu, I used UA bin but then the device doesn't turn on (no led red). I'll try to solder the pins if it helps since I was still using probe pins. Hopefully the chip isn't bricked or something otherwise I'll have to transplant esp
  • Firmware needs GPIO setup and Wi-Fi AP appears

    #222 19890960
    ExploWare
    Level 10  
    Posts: 48
    Rate: 2
    @ferbulous after firmware upload is done, you'll need to setup the device
    The LED is often on a GPIO pin, which is controlled by the firmware, but that needs to be told first. Same for the relay and the button.
    Chances are big you'll see a new Wifi accesspoint when the device is switched on.

    Again:please read this whole thread to understand whats happening, you clearly are hoping to get more than you can expect at this state. As @p.kaczmarek2 said just a few posts before this, the N version is currently not storing settings as it should
  • ADVERTISEMENT
  • QIO binary required for BK7231N flashing

    #223 19890970
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14724
    Help: 659
    Rate: 12806
    ferbulous wrote:

    As for the cbu, I used UA bin but then the device doesn't turn on (no led red).

    At first I did the same - I used UA bin file but then device doesn't turn on (with no UART log at all).

    Then I used QIO and voila - it's alive:
    List of available Wi-Fi networks on a computer screen.
    but it seems that flash configuration is not retained after power off/power on cycle. It happens for both me and Wiktor. I suspect it has something to do with unprotecting the memory. I need to go out for a walk right now, but when I come, I will look into the N version sdk, maybe they have something more in their flash access code like "deprotect(1)" etc.

    Can anyone else check is the QIO binary working for them on N version chip, flashed as below:
    
    python uartprogram W:\GIT\OpenBK7231N\apps\OpenBK7231N_App\output\1.0.0\OpenBK7231N_app_QIO_1.0.0.bin --unprotect -d com10 -w --startaddr 0x0
    

    I just really need more test devices. Or testers.

    Also, can anyone include full debug logs here, both preflashing and after flashing?

    EDIT:
    ExploWare wrote:
    @ferbulous after firmware upload is done, you'll need to setup the device

    To be honest, I understood that @ferbulous has programmed the N chip incorrectly with UA version which doesn't work, it just stucks the module in the bootloop. I have tested it right now, while writing this post. In order to get OpenBK access point showing up, you have to use QIO version (and remember ofs 0x0 and --unprotect).
    Helpful post? Buy me a coffee.
  • QIO flash restores webpage and settings access

    #224 19892293
    ferbulous
    Level 18  
    Posts: 419
    Help: 8
    Rate: 56
    @p.kaczmarek2 got it working after flashing N chip with QIO bin file, I can access the webpage and the settings now
    Will be waiting for your fix on the flash configuration not saved after powered on/off
    Also how can I help with the debug log if I use the hid_download tool?

    @kmhn now that I have the 2mb firmware dump from the BK7231N chip, if i ever need to restore the original firmware again. do I just select that bin file or anything else needs to be done first?
  • #225 19892314
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14724
    Help: 659
    Rate: 12806
    @ferbulous , can you at least check if settings are lost for you after a longer power-off of the module?
    Helpful post? Buy me a coffee.
  • Settings lost after third power cycle in AP mode

    #226 19892763
    pvxvictor
    Level 6  
    Posts: 3
    LSPA9, CB2S module: BK7231N
    python uartprogram OpenBK7231N_app_QIO_1.0.0.bin -u -s 0 -d com20 -w
    UartDownloader....
    programm....
    Write Successful: |##################################################|[ 9.03k/s]
    

    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    Configuration and next power startup:
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    The third power startup is the loss of all settings and work in AP mode.
  • Settings persist after power-off, but Wi‑Fi reconnect is delayed

    #227 19892926
    ferbulous
    Level 18  
    Posts: 419
    Help: 8
    Rate: 56
    p.kaczmarek2 wrote:
    @ferbulous , can you at least check if settings are lost for you after a longer power-off of the module?


    Waited for 1 minute+ before it's powered on and the settings are still saved
    Setup the gpio pins, and webpage stopped responding, turn it off on the second time, does't look like it's connecting to the router just yet
    Restarted for 3rd time, and it's connected back to wifi with the settings still there

    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
  • QiaChip smart switch appears in BK7231N template list

    #228 19892992
    ExploWare
    Level 10  
    Posts: 48
    Rate: 2
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant


    I do have a Qia Smart Switch device with the T chip.
    I noticed in te Templates this was listed as an N module.
    Maybe this one is in two variants?

    
    template_t g_templates [] = {
    	{ Setup_Device_Empty, "Empty"},
    	// BK7231N devices
    	{ Setup_Device_BK7231N_CB2S_QiachipSmartSwitch, "[BK7231N][CB2S] QiaChip Smart Switch"},
    
  • RL_SUPPORT_FAST_CONNECT may overwrite BK_PARTITION_NET_PARAM

    #229 19893493
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14724
    Help: 659
    Rate: 12806
    ExploWare wrote:

    I do have a Qia Smart Switch device with the T chip.

    This is a very useful information. I was wondering whether should I separate configs for N and T versions and now I'm sure that those versions are sometimes used interchangeably. My Qia has a N chip.

    ferbulous wrote:

    Restarted for 3rd time, and it's connected back to wifi with the settings still there

    And today, no settings loss?

    PS: The N version has slightly different table offsets, I am investigating it now:
    https://github.com/tuya/tuya-iotos-embeded-sd..._os/beken378/func/user_driver/BkDriverFlash.c
    https://github.com/tuya/tuya-iotos-embeded-sd..._os/beken378/func/user_driver/BkDriverFlash.c
    Source code defining logical partitions on devices with BK7231T and BK7231N chips.

    Dodano po 5 [godziny] 2 [minuty]:

    UPDATE: after a brief investigation I am concluding that RL_SUPPORT_FAST_CONNECT option is overwriting the data from BK_PARTITION_NET_PARAM, thus making us lose our configs.

    See platforms/bk7231n/bk7231n_os/beken378/func/joint_up/role_launch.c :
    Source code in C language related to a function for reading BSSID information.
    I will try disabling it and see if the configuration issues are gone. If that's it, then we're getting a third supported platform (first was obviously BK7231T, second XR809 - yes, it works, even with config save, and third now will be BK7231N)

    As I said in the first post, the multiplatform, flexible approach is required for todays smart devices, so we don't have to create separate Tasmota clone for each platform. With both BK7231's supported (N and T), and of course XR809 supported (which is a totally different chip family), I will continue the development of main app and maybe add support for more platforms soon! Any suggestions of other popular chips that have public SDKs?
    Helpful post? Buy me a coffee.
  • WR3L module uses Realtek RTL8710 chip

    #230 19896479
    ExploWare
    Level 10  
    Posts: 48
    Rate: 2
    @p.kaczmarek2 the only other platform I've run into with Tuya is a bit older but I do have the module separated from the lightbulb: it was the WR3L with a Realtek RTL8710 chip onboard

    I've also created a pull request for the OpenBK7231 as well as the _App repositories, to include the Git clone version, I think thats easier for users as it is auto_incrementing and developers as it's always pointing to what version is in use.

    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    Dodano po 24 [minuty]:

    that version would lead to https://github.com/openshwprojects/OpenBK7231T_App/commit/e896a81e and that informs a lot on what version is cloned for the build
  • Git version fallback with user override

    #231 19896505
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14724
    Help: 659
    Rate: 12806
    I have posted a detailed teardown and programming guide (and short story of my experiences) about Qiachip BK7231N version on polish side of the forum:
    https://www.elektroda.pl/rtvforum/topic3874289.html#19896503
    I might translate it later.

    I also started working on readme:
    https://github.com/openshwprojects/OpenBK7231T_App/
    and pushed binaries to the App repo (for all 3 supported platforms):
    https://github.com/openshwprojects/OpenBK7231T_App/tree/main/releases

    Ah, I also reworked the buttons code - buttons will now work for XR809 platform.

    ExploWare wrote:

    I've also created a pull request for the OpenBK7231 as well as the _App repositories, to include the Git clone version, I think thats easier for users as it is auto_incrementing and developers as it's always pointing to what version is in use.

    It seems like a very nice idea, but my concern is that the SDKs doesn't have to be used only to build our app, they can be basically used to build any app for BK7231N or BK7231T or XR809. Could you modify your code in such a way that it takes the GIT version if there is not one specified, and if user specified a version then he's allowed to override it?
    Helpful post? Buy me a coffee.
  • Clarifying BK7231T serial 2 UART wiring

    #232 19896892
    sebastian48
    Level 9  
    Posts: 31
    Thanks for your continued work! Looks like this is getting more streamlined. Before I start trying to not wreck another device I just need to ask about the UART again as I see BKWriter is now replaced with a python tool: I should still connect everything as I tried with BKWriter (which always failed)?

    Specifically what does "connect the PC to serial 2 on the bk7231" mean? I have the WB2S with BK7231T. Just a bit perplexed about the "serial 2"?
  • Remove R33 and flash via RX1/TX1 on BK7231T

    #233 19896944
    boozeman
    Level 11  
    Posts: 73
    Rate: 2
    sebastian48 wrote:
    Thanks for your continued work! Looks like this is getting more streamlined. Before I start trying to not wreck another device I just need to ask about the UART again as I see BKWriter is now replaced with a python tool: I should still connect everything as I tried with BKWriter (which always failed)?

    Specifically what does "connect the PC to serial 2 on the bk7231" mean? I have the WB2S with BK7231T. Just a bit perplexed about the "serial 2"?


    Hi,

    The previous failed apptempts with Nedis WIFIPO 120FTW was caused the use of The pin of the RX1 is pulled up to 3.3 volts and is used to connection of the push button. When trying to flash, this causes that led flickering and relay klicking.

    Remove R33 before the first flash (if you use that Nedis 120FTW). You can use RX1 and TX1 for flashing. RX1 goes to your usb2serial adapter TX and TX1 to RX. Beken Writer should do the job, because the module is BK7231T. Start the programming and then short CEN and GND for a second.

    If you see new Access Point at your phone or computer after flashing, you can disassemble the wires and put R33 back on board. and assemble the covers back. Be careful on the resistor and use tweezers when removing or assembling it.
  • R33 removal needed to flash BK7231T safely

    #234 19896969
    sebastian48
    Level 9  
    Posts: 31
    boozeman wrote:
    sebastian48 wrote:
    Thanks for your continued work! Looks like this is getting more streamlined. Before I start trying to not wreck another device I just need to ask about the UART again as I see BKWriter is now replaced with a python tool: I should still connect everything as I tried with BKWriter (which always failed)?

    Specifically what does "connect the PC to serial 2 on the bk7231" mean? I have the WB2S with BK7231T. Just a bit perplexed about the "serial 2"?


    Hi,

    The previous failed apptempts with Nedis WIFIPO 120FTW was caused the use of The pin of the RX1 is pulled up to 3.3 volts and is used to connection of the push button. When trying to flash, this causes that led flickering and relay klicking.

    Remove R33 before the first flash (if you use that Nedis 120FTW). You can use RX1 and TX1 for flashing. RX1 goes to your usb2serial adapter TX and TX1 to RX. Beken Writer should do the job, because the module is BK7231T. Start the programming and then short CEN and GND for a second.

    If you see new Access Point at your phone or computer after flashing, you can disassemble the wires and put R33 back on board. and assemble the covers back. Be careful on the resistor and use tweezers when removing or assembling it.


    I guess I will have to try it once more. Getting a soldering station with a thinner tip first. But that begs to question: is the R33 resistor actually needed for function?

    The pad broke on the R33 when I trained on the already broken board so I probably need to be more careful. Anyway, I ordered a station with exchangeable tips and digital temperature setting. Any recommendations on temperatures when removing the R33?
  • R33 is a 0 ohm link needed for button function

    #235 19897032
    boozeman
    Level 11  
    Posts: 73
    Rate: 2
    sebastian48 wrote:
    I guess I will have to try it once more. Getting a soldering station with a thinner tip first. But that begs to question: is the R33 resistor actually needed for function?

    The pad broke on the R33 when I trained on the already broken board so I probably need to be more careful. Anyway, I ordered a station with exchangeable tips and digital temperature setting. Any recommendations on temperatures when removing the R33?


    The R33 is basically a trip wire, so you can replace it with shot piece of wire or take the 0 ohm resistor for your previous device. The R33 is possibly the easiest part to be desolder before first flash. This modules circuit board is one sized, so there's several 0 Ohm resistors like trip wires. Without R33 the button wont work.
  • Serial 2 is the optional logging bus on BK7231T modules

    #236 19897071
    ExploWare
    Level 10  
    Posts: 48
    Rate: 2
    @boozeman I think the English word you're looking for is Jump-wire. It Jumps the PCB Trace over another.

    @sebastian48 The Serial 2 is implying the 2TX and 2RX connections which are on the back of the module pcb. They are used to get log data. The 1TX and 1RX are the 'programming bus', and therefor most important, and the 'logging bus' is optional, but very useful if something unpredicted happens.
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
  • ADVERTISEMENT
  • Serial 2 is the optional logging UART

    #237 19897084
    sebastian48
    Level 9  
    Posts: 31
    ExploWare wrote:
    @boozeman I think the English word you're looking for is Jump-wire. It Jumps the PCB Trace over another.

    @sebastian48 The Serial 2 is implying the 2TX and 2RX connections which are on the back of the module pcb. They are used to get log data. The 1TX and 1RX are the 'programming bus', and therefor most important, and the 'logging bus' is optional, but very useful if something unpredicted happens.
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant


    Ah yes thanks for the clarification. I only got one UART device so that will have to do unless I pick up one additional.
  • Raspberry Pi or Arduino as UART flash station

    #238 19897117
    ExploWare
    Level 10  
    Posts: 48
    Rate: 2
    sebastian48 wrote:
    I only got one UART device so that will have to do unless I pick up one additional.

    Sure? Lots of us have an extra Arduino or Raspberry Pi laying around.

    They are quite capable to use as the flash station and logging feedback
    https://www.raspberrypi.com/documentation/computers/configuration.html#configuring-uarts

    or as an extra Serial to USB dongle
    https://www.arduino.cc/en/Reference/SoftwareSerial
  • Arduino as a flash station or serial adapter

    #239 19897135
    sebastian48
    Level 9  
    Posts: 31
    ExploWare wrote:
    sebastian48 wrote:
    I only got one UART device so that will have to do unless I pick up one additional.

    Sure? Lots of us have an extra Arduino or Raspberry Pi laying around.

    They are quite capable to use as the flash station and logging feedback
    https://www.raspberrypi.com/documentation/computers/configuration.html#configuring-uarts

    or as an extra Serial to USB dongle
    https://www.arduino.cc/en/Reference/SoftwareSerial


    HA! of course I didn't think of that! I do have an Arduino that I could use actually! Thanks :)
  • #240 19897203
    boozeman
    Level 11  
    Posts: 73
    Rate: 2
    sebastian48 wrote:
    HA! of course I didn't think of that! I do have an Arduino that I could use actually! Thanks


    You do not need the second UART because when you do successful flash and connect the device to your wlan, you can always use ip.address/app link. There is logs tab
📢 Listen (AI voice):

Topic summary

✨ Discussion about developing and testing open firmware for BK7231T-based Tuya devices, including a cross-platform mini HTTP server, web configurator for GPIO/pin mapping, MQTT integration, and Home Assistant control. The thread covers flashing procedures with Beken Writer and a Python UART downloader, backup of original firmware, UART wiring, CEN reset method, power-supply precautions, and troubleshooting of flashing failures, erase limits, baud-rate issues, and boot problems. As development progresses, PWM dimmer support is added, MQTT startup bugs are fixed, Wi‑Fi AP/client mode behavior is improved, network scanning is implemented, and support is extended toward BK7231N and related SDKs. Participants also identify device internals such as BL0937 power metering, AMS1117 regulators, TuyaMCU/UART peripherals, and various smart plugs, switches, bulbs, and dimmers that may be compatible with the firmware.
AI summary based on the discussion. May contain errors.

FAQ

TL;DR: 100 % flash-success reported on BK7231 T/N modules [Elektroda, p.kaczmarek2, post #19906676]; “OpenBK7231T now boots on three chip families” [Elektroda, p.kaczmarek2, post #19883071] Use QIO image for BK7231N, UA for BK7231T; erase only 0×11000-0×1EF000. Why it matters: a single workflow now replaces vendor firmware on 60 + low-cost IoT boards.

Quick Facts

• Supported MCUs: BK7231T, BK7231N, XR809 (Wi-Fi + BLE) [Elektroda, 19883071] • Recommended UART speed: 921 600 bps for write, 115 200 bps for read [Elektroda, 19857664] • Flash sizes: Typical 2 MB on-chip; config area starts @ 0×1EF000 [Elektroda, post #19893493] • OTA format: .rbl (gzip + AES, served by HTTP) [Elektroda, btsimonh, post #19880525] • Typical power: 5 V @ 500 mA to AMS1117 input for safe programming [Elektroda, ExploWare, post #19853546]

3. Writer stops at “Erasing 0×11000” – why?

The chip is protected. For BK7231N add --unprotect when using uartprogram, or choose BK7231N mode in BKWriter; baud 921 600 often succeeds after 115 200 fails [Elektroda, boozeman, post #19857804]

4. Relay clicks during flashing – safe fix?

A pull-up on RX1 ties the push-button to 3 V3, driving the relay. Remove jumper R33 on Nedis WIFIPO120FWT, flash, then solder it back [Elektroda, boozeman, post #19882233]

5. How can I back-up the Tuya stock firmware?

Run python bk7231tools.py read_flash -d COMx --no-verify-checksum -s 0 -c 512 dump.bin for T/N chips (2 MB, 512 × 4 KB) [GitHub bk7231tools].

6. My BK7231N loses settings after power-cycle.

Disable FAST_CONNECT (RL_SUPPORT_FAST_CONNECT) or use latest OpenBK build ≥ f6c3c8f6 that stores config outside NET_PARAM table [Elektroda, p.kaczmarek2, post #19893493]

7. Does OTA work and how do I host updates?

Yes. Serve *.rbl over HTTP (http-here --host 0.0.0.0 8000). In WebApp → OTA tab → enter http://<IP>:8000/firmware.rbl; device backs up filesystem, flashes, restores settings [Elektroda, btsimonh, post #19880525]

9. What are the default GPIO roles for common plugs?

• Nedis WIFIPO120FWT – P6 LED, P10 Button, P26 Relay [Elektroda, 19883937] • QiaChip Smart Switch (WB2S,T) – P24 Relay, P26 Button [Elektroda, 19906692]

10. How do I compile on Linux or Windows?

Clone SDK OpenBK7231T, then OpenBK7231T_App into /apps. Build: ./build_app.sh apps/OpenBK7231T_App OpenBK7231T_App git (Linux) or Cygwin on Windows; ensure build-essential and gcc-arm-none-eabi installed [Elektroda, boozeman, post #19885620]

11. Is there a no-solder exploit?

Yes. CloudCutter abuses 2019 Tuya SDK bug to OTA-flash BK7231 lights wirelessly; code published February 2022 [khalednassar/tuya-cloudcutter]. "It works on every test bulb so far" [Tom Clement, #19890768].
AI summary based on the discussion. May contain errors.
ADVERTISEMENT