logo elektroda
logo elektroda
X
logo elektroda

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

p.kaczmarek2 184086 1296
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1261 21630205
    divadiow
    Level 35  
    >>21615185

    I see

    Code: Text
    Log in, to see the code


    are one row now in platforms.md. I have a yes for WPA3 on DN, presumably yes for CS too
  • ADVERTISEMENT
  • #1262 21630210
    insmod
    Level 27  
    >>21630205
    ECR6600 supports WPA3?
    Is it with current or with new?

    Does Ameba1/AmebaZ support it?

    LN882H will support WPA3 by default in next release.
  • #1263 21630212
    divadiow
    Level 35  
    I have ticks in spreadsheet from testing a couple of weeks ago,

    Wi-Fi module comparison chart showing WPA3 support

    I don't have any Ameba1 but I'm sure you posted that Ameba1 supports WPA3 if AmebaZ does. Have I imagined that? I can't find the post.




    I reverted Ameba1 to unknown for WPA3
  • #1264 21630316
    p.kaczmarek2
    Moderator Smart Home
    Great progress, btw, it seems BK7231U can be bought on Aliexpress now? AS a single chip... but still. I wonder would it fit to WB3S form?

    Also... is it just me or is WB3S documentation taken down from Tuya?
    Helpful post? Buy me a coffee.
  • #1265 21630334
    insmod
    Level 27  
    >>21630316
    I guess? They are pretty much identical. If you manage to flash unencrypted T bootloader to U via SPI, then you can basically use T firmware.
    Or maybe not. U on ali is QFN40, T is QFN32. You need BK7231(S/U)QN32A.

    All WB-series datasheets are removed.
  • #1266 21630654
    p.kaczmarek2
    Moderator Smart Home
    There is also a little side project I started recently. I managed to run C# code on each commit and save results to html and publish them to GH pages:
    https://github.com/openshwprojects/FlashDumps
    The idea is to analyze the repository on each commit and create stats of bootloaders, firmwares, etc.
    Ultimately I will probably merge the RBL extraction with easy flasher and just call easy flasher, but current version is here:
    https://github.com/openshwprojects/FlashDumps/tree/main/Analyzer
    So far it just extracts RBLs from beken dumps.
    Here is where output will be saved, not finished, of course - at first i tried just grouping binary streams https://openshwprojects.github.io/FlashDumps/
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #1267 21632836
    p.kaczmarek2
    Moderator Smart Home
    @insmod is this ready to merge?
    https://github.com/openshwprojects/OpenBK7231T_App/pull/1718
    I would like to merge it today, as I am going to move OTA code to HALs and I want to avoid futher merge issues.
    Helpful post? Buy me a coffee.
  • #1268 21632857
    insmod
    Level 27  
    >>21632836
    Not yet. But i'll get it ready today, as my RTL8710ECF board has finally arrived.
  • #1269 21632863
    p.kaczmarek2
    Moderator Smart Home
    Ok I will wait with OTA clearup, I am planning to mova OTA platform-specific code to HAL and make ota_progress global
    Helpful post? Buy me a coffee.
  • #1270 21634383
    p.kaczmarek2
    Moderator Smart Home
    First version done. I would like to merge it and move to futher improvements.
    https://github.com/openshwprojects/OpenBK7231T_App/pull/1762
    I basically just moved http_rest_post_flash to separate files, I also moved flash read there.

    Questions - @insmod, can you do a basic code review, check if I didn't break anything?
    Maybe we can also test later on some test devices with @divadiow.

    Futher plans:
    - probably will need to change http_rest_post_flash just to OTA function, as in most of the platforms it's used only for OTA, however, on Beken it's also used to write config/RF from web app Flash Section?
    - make "ota_progress" multiplatform
    - lock all driver ticks as soon as OTA starts
    Helpful post? Buy me a coffee.
  • #1271 21634390
    insmod
    Level 27  
    >>21634383
    Looks fine to me.
    Though i think realtek and ecr/tr ota should be split per platform.
    + add move http ota to hals.
    And flash read to hal_generic.
    Then write flash write and erase, and use them for lfs/easyflash.
  • #1272 21635041
    p.kaczmarek2
    Moderator Smart Home
    I've did ecr/tr split.

    @divadiow can you check if it's possible to OTA from this PR to release?
    Helpful post? Buy me a coffee.
  • #1273 21635058
    divadiow
    Level 35  
    ECR6600 - REST

    1.18.145 -> 1762_merge_76656c0aeee1 -> 1.18.154 ✅
  • #1274 21635547
    p.kaczmarek2
    Moderator Smart Home
    BK7238 - ok, RTL8720D - ok, please test futher if you can, i will soon merge it, and if I merge earlier, then just check on main
    Helpful post? Buy me a coffee.
  • #1275 21635556
    divadiow
    Level 35  
    oh yes. sure. I zoomed in on ECR and nothing else for some reason.
  • ADVERTISEMENT
  • #1276 21635567
    p.kaczmarek2
    Moderator Smart Home
    I am making now OTA_Progress guard check public. I will probably also disable driver ticks when OTA is in progress. However, the OTA_Progress is not implement for other OTAs already, so I have to add it as well.
    Helpful post? Buy me a coffee.
  • #1277 21635872
    divadiow
    Level 35  
    I hope to start this eve. Is latest build the one to use or shall I wait for more changes
  • #1278 21635898
    p.kaczmarek2
    Moderator Smart Home
    Latest commit is this:
    https://github.com/openshwprojects/OpenBK7231...mits/ffa9ab6f6140b2aaf16346d6f44de04f3feada73
    This should make OTA_GetProgress different than -1 on OTA start on every platform - at least for web app OTA. This should lock drivers and show this message (albeit without valid size info) on HTTP page:
    C code snippet checking OTA progress using OTA_GetProgress
    This should be good enough for the start, but at this stage, it won't track how many bytes were flashed... we would need to connect this counter per each platform, as we don't have universal "OTA_FLASH"-style API
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #1279 21636006
    divadiow
    Level 35  
    BL602
    1.18.140 -> 1762_merge_9817f031a022 -> 1.18.154 ✅

    Screenshot with system info: reboot reason, MQTT state, and OTA update progress

    W800
    1.18.145 -> 1762_merge_9817f031a022 -> 1.18.154 ✅

    OTA status in progress. Downloaded: 0 B, Flashed: 000000h

    BK7231U
    1749_merge_d7303c6b5b1d -> 1762_merge_9817f031a022 -> 1.18.154 ✅

    Screen showing OTA status with 0 B downloaded and 033000h flashed




    this kind of test result ?

    Added after 27 [minutes]:

    W600

    patch-1_387f507681ec -> 1762_merge_9817f031a022 -> 1.18.154 ✅

    OTA screen showing software download and flashing progress

    ESP32S3

    1.18.102 -> Aug 15 2025 14:55:52 version ESP32S3_Test (ESPs don't have build variable thing yet) -> 1.18.154 ✅

    Screenshot: OTA In Progress. Downloaded: 0 B Flashed: 000000h message displayed

    BK7231N (old SDK)

    1762_merge_9817f031a022_sensors -> 1.18.154 ✅

    OTA update screen showing: 0 B downloaded, 00E000h flashed

    BK7231N (ALT)

    1.18.154 -> 1762_merge_9817f031a022 -> 1.18.154 ✅

    OTA interface with message: Downloaded: 0 B Flashed: 004000h

    Added after 2 [minutes]:

    how granular - platform/variation etc?

    Added after 25 [minutes]:

    ESP8266

    1.18.154 -> 1762_merge_9817f031a022 -> 1.18.154 ✅

    no progress
    MQTT State: not configured text above a blue 'Config' button

    LN882H

    1.18.154 -> 1762_merge_9817f031a022 -> 1.18.154 ✅

    Screen showing OTA status: 0 B downloaded, 0 B flashed

    XF16/XR872

    1.18.140 -> 1762_merge_9817f031a022 ✅ -> 1.18.154 ❌

    says it's flashing but then doesn't reboot. after manual reset it comes back up as 1762_merge_9817f031a022
    OTA Status: in progress, no data downloaded or flashed yet

    Code: Text
    Log in, to see the code


    Added after 39 [minutes]:

    WAIT. XF16 OTA does work. I've been using the downloaded file from quick list which is UART flash file not OTA, Will find and do PR

    Screenshot of OTA interface for XR872 chipset with 1.18.154 file selected

    so..
    1.18.154 -> 1762_merge_9817f031a022 -> 1.18.154 ✅


  • #1280 21636077
    p.kaczmarek2
    Moderator Smart Home
    Oh, so we accidentally found Web App bug, nice! Thank you for testing
    Helpful post? Buy me a coffee.
  • #1282 21636131
    p.kaczmarek2
    Moderator Smart Home
    Yes, this needs to be done:
    Code change in vue/ota.vue: XR872 and XR806 cases added with specific prefixes and postfixes
    Variants are not covered at all there yet, it's open question how to handle them. Probably just put them on the same list and hope that users can read...
    Helpful post? Buy me a coffee.
  • #1283 21636163
    divadiow
    Level 35  



    ECR6600

    1.18.154 -> 1762_merge_9817f031a022 -> 1.18.154 ✅

    MQTT State not configured, OTA in progress, 0 B downloaded, 000000h flashed

    RTL87x0C

    1.18.140 -> 1762_merge_9817f031a022 -> 1.18.154 ✅

    MQTT state and OTA progress message with a Config button

    RTL8710B

    1.18.140 -> 1762_merge_9817f031a022 -> 1.18.154 ✅

    OTA progress interface showing 0 bytes downloaded and 0 flashed

    XR806

    1.18.140 -> 1762_merge_9817f031a022 -> 1.18.154 ✅

    MQTT state not configured, OTA update in progress, 0 B downloaded

    Added after 9 [minutes]:

    p.kaczmarek2 wrote:
    Yes, this needs to be done:

    added RTL-A/B/D/DA/E and ECR6600

    Added after 21 [minutes]:

    yay

    List of .img files for OpenRTL8710B versions 1.18.151 to 1.18.154

    just missed some late RTLs by a few seconds :)

    https://github.com/OpenBekenIOT/webapp/pull/214
  • #1284 21656174
    krzakx
    Level 12  
    Hello.
    Somehow, since October 2024, I've been using a couple of devices (aftermarket switches) on a Beken BK7231N. I successfully uploaded OpenBeken, I even used LittleFS and scripts to send a double click event.
    This all worked for a long time, until about 2 months ago the devices disconnected from WiFi and switching with the built-in button stopped working. And so about 4 devices died.... today I've taken to trying to reprogram them, but it doesn't help anything trying to connect to other WiFi doesn't help.
    Did something important happen in the meantime that could have caused problems with my devices? After all, they were disconnected from the Tuya cloud.... so nothing remote I can suspect.... surges in the network?
  • #1285 21656187
    p.kaczmarek2
    Moderator Smart Home
    Maybe the PowerSave is missing and the capacitors are dead?
    How do I fix a smart device that crunches, squeaks and makes strange noises?
    Helpful post? Buy me a coffee.
  • #1286 21656616
    krzakx
    Level 12  
    Yes PowerSave was not activated and the capacitors actually died.
    Electronics module with capacitors, relay, and screw terminals on a PCB .

    However, most likely there is still a problem somewhere, because I took new unused pieces of similar switches off the shelf (admittedly they have been lying around for 1 year) i.e. https://www.elektroda.com/rtvforum/topic4026798.html, I zaflash them (Tuya config reading was successful) and they don't connect to my WiFi either :/.
    Could it be that the quality is so bad that even the recumbents are damaged?

    And oh this is the Realterm window on the newly sflashed pcs

    RealTerm window showing serial port data and connection configuration .

    If so, can you please recommend b.good quality aftermarket switches that will last for years - need to use them and not experiment ;)
  • #1287 21656635
    p.kaczmarek2
    Moderator Smart Home
    Can you check the log on the correct pin - TX2 in Beken? There is information there about what the soft is doing and this will help diagnose what goes wrong. TX1 and RX1 is only for programming, you won't get a log from it.
    Helpful post? Buy me a coffee.
  • #1289 21656780
    p.kaczmarek2
    Moderator Smart Home
    There are two options. Either a weak power supply - I'd check with a reliable 3.3V LDO, or I'd try uploading the full 2MB of the original batch to this and then overwriting it with OpenBeken. I associate the problem with battery-powered devices, where if the voltage was too low, something internal to the BK SDK would get corrupted and the full 2MB had to be re-flashed.

    Uploading the OBK alone again will not help.
    Helpful post? Buy me a coffee.
  • #1290 21656816
    divadiow
    Level 35  
    p.kaczmarek2 wrote:
    The issue with devices not booting is known, but we don't have final solution yet. Of course, restoring flash backup should work. Otherwise we might need to try to reproduce it ourselves, maybe with variable power supply and investigate which part of flash breaks, exactly. Do you have variable power supply, @divadiow ?


    i still mean to do this

Topic summary

The discussion centers on the development and testing of an open-source firmware project for the BK7231T microcontroller, focusing on creating a cross-platform mini HTTP server, web-based pin configuration, MQTT integration, and Home Assistant compatibility. The project includes a Visual Studio project for Windows and firmware flashing tools like Beken Writer and a Python-based uartprogram. Users report challenges with flashing devices, including issues with firmware size limits (956KB), UART converter compatibility, and power supply stability during flashing. Solutions include using specific UART adapters (e.g., FT232R, CP2102), resetting devices via the CEN pin instead of power cycling, and trimming firmware binaries. The firmware supports devices with BK7231T and BK7231N chips, with ongoing work to add PWM dimmer support, BLE, TuyaMCU protocol integration, and OTA updates. Various smart devices such as WB2S/WB3S modules, smart plugs, LED bulbs, and switches from brands like MOES, Nedis, Hama, and Calex are tested. Users share detailed hardware teardowns, pinouts, and flashing procedures. MQTT topic naming issues related to MAC address usage were identified and fixed. The project emphasizes community collaboration, with suggestions for a Discord server to enhance real-time communication. Additional tools and SDK improvements, including CMake support and BLE integration, are under development to facilitate firmware building and device support expansion.
Summary generated by the language model.
ADVERTISEMENT