logo elektroda
logo elektroda
X
logo elektroda

Flashing OpenBeken on BK7238 Module (WB43-M5 V1.1) with Surplife App

Jinaria 1485 30
ADVERTISEMENT
  • #1 21375936
    Jinaria
    Level 8  
    I have some light bulbs with BK7238 Module (PCB Marking WB43-M5 V1.1) - Surplife app. I bought the same bulb from the same seller and they used to have BL602 modules. Now they are shipping it with this chip, same app, same box.
    I managed to dump the flash and rom, how can I flash OpenBeken?

    You can check the dumps here: https://github.com/tuya-cloudcutter/tuya-cloudcutter/issues/765

    Moderated By p.kaczmarek2:


    I am splitting this to separate topic from https://www.elektroda.com/rtvforum/topic4064640.html

  • ADVERTISEMENT
  • Helpful post
    #2 21375947
    divadiow
    Level 34  
    Interesting. I saw your post over there and was planning to look over that firmware backup in the morning.

    BK7238 development is still a work in progress but there are OpenBK7238 firmwares that could be flashed

    https://www.elektroda.com/rtvforum/topic4092465-60.html#21361724

    Added after 7 [hours] 28 [minutes]:

    so yes, your device is a Zengge/SurpLife RGBCCT - BulbD46D - with BP5758D

    Here is boot log 115200/2000000

    Code: Text
    Log in, to see the code


    Added after 7 [minutes]:

    maybe this new device should be its own new thread @p.kaczmarek2 for BK7238 testing/progress?
  • #3 21376355
    Jinaria
    Level 8  
    Thanks,

    - I'm not sure how to flash the experimental firmware, I dumped the flash and ROM using ltchiptool but it cannot write to the flash.
    - How did you get the boot log? Did you flash it to a development board?
    - I'll add PCB and module photos later this evening.
  • Helpful post
    #4 21376381
    divadiow
    Level 34  
    Jinaria wrote:

    - I'm not sure how to flash the experimental firmware, I dumped the flash and rom using ltchiptool but it cannot write to the flash.


    Easy Flasher can be used to read/write firmware from BK7238 - https://github.com/openshwprojects/BK7231GUIFlashTool

    To burn the latest BK7238 firmware, place OpenBK7238_QIO__beken_sdk_f866976df64b.bin from the attached zip into the EasyFlasher firmwares subdir and rename to OpenBK7231N_QIO__beken_sdk_f866976df64b.bin

    View of the firmware folder in BK7231GUIFlashTool.

    Be sure to reveal advanced options and to choose skip key check

    Screenshot of the Easy UART Flasher software with BK7231N selected and OpenBK7231N_QIO__beken_sdk_f866976df64b firmware chosen.

    or flash with BKFIL https://www.elektroda.com/rtvforum/topic4059172.html

    Jinaria wrote:

    - How did you get the bootlog? did you flash it to a development board?


    Yes - the NiceMCU board with XH-WBS3 module
  • #5 21376384
    divadiow
    Level 34  
    please be aware that not everything may work yet and that flashing is at your own risk :)
  • ADVERTISEMENT
  • #6 21376434
    Jinaria
    Level 8  
    divadiow wrote:
    please be aware that not everything may work yet and that flashing is at your own risk :)


    Thank you for the step by step guide, I managed to flash the firmware successfully but for some reason the AP does not show up. I noticed that the factory firmware dump is 2MB but the experimental firmware size is only 1224KB.

    Added after 24 [minutes]:

    Cannot edit the first post, here are some photos of the smart bulb:

    Close-up of a circuit board inside a smart bulb showing electronic components. 10W smart bulb with visible technical markings. LED smart bulb circuit board with LEDs and integrated circuits. Close-up of a circuit board with visible electronic components.
  • #7 21376492
    divadiow
    Level 34  
    Jinaria wrote:
    I managed to flash the firmware successfully but for some reason the AP does not show up


    are you able to see if there is any log UART log out from TX to see if it's booting at all? I'm not sure we know much about this module. Does it have labels on the reverse of the module?

    Added after 2 [minutes]:

    if you're able to, please post clear head-on front and rear pictures of the module
  • ADVERTISEMENT
  • #8 21376511
    Jinaria
    Level 8  
    divadiow wrote:
    Jinaria wrote:
    I managed to flash the firmware successfully but for some reason the AP does not show up


    are you able to see if there is any UART log out from TX to see if it's booting at all? I'm not sure we know much about this module. Does it have labels on the reverse of the module?


    Here is a boot log, seems to be in some kind of boot loop :
    BK7238_1.0.14
    REG:cpsr        spsr        r13         r14
    SVC:0x400000D3              0x0042F810  0x00010008
    IRQ:0x400000D2  0x00000010  0x0042FC10  0x48C01942
    FIR:0x400000D1  0x00000010  0x00430000  0x30602F40
    SYS:0x400000DF              0x0042B820  0x00000158
    ST:0x00010000
    [I/FAL] Fal(V0.4.0)success
                              [I/OTA] RT-Thread OTA package(V0.2.8-beken-1133282d-20    220604) initialize success.
    
    
    go os_addr(0x10000)..........
    BK7238_1.0.14
    REG:cpsr        spsr        r13         r14
    SVC:0x400000D3              0x0042F810  0x00010008
    IRQ:0x400000D2  0x00000010  0x0042FC10  0x48C01942
    FIR:0x400000D1  0x00000010  0x00430000  0x30602F40
    SYS:0x400000DF              0x0042B820  0x00000158
    ST:0x00010000
    [I/FAL] Fal(V0.4.0)success
                              [I/OTA] RT-Thread OTA package(V0.2.8-beken-1133282d-20    220604) initialize success.


    The module has RX/TX/CEN/V3.3/GND on the back.
  • #9 21376519
    divadiow
    Level 34  
    interesting.

    I'll just flash it myself. I can't remember if there was something about the QIO file. We might have to slice it up and flash from a certain address or do OTA
  • #11 21376560
    divadiow
    Level 34  
    so yes, flashing the QIO from 0x0 (I used BKFIL) does not result in any output for me - not even bootloader.

    I've flashed your original firmware in its entirety

    Screenshot of BKFIL software with a selected binary file for flashing.

    then flashed OpenBK7238__beken_sdk_f866976df64b.rbl.bin (from zip file above - add .bin to the end) from 0x132000

    Screenshot of the BKFIL tool showing device flashing configuration.

    if you can open the COM port quick enough you'll see the tail-end of the OTA

    Screenshot of OTA process on a black terminal background.

    then the AP broadcasts

    OpenBK7238 user interface with technical data and configuration options.
  • #12 21438048
    taggbricka
    Level 6  
    I just bought (accidentally) a few of these XH-WB3S modules. I was not aware they were BK7238 based.
    XH-WB3S electronic module with labeled pins. XH-WB3S module with visible connectors and markings.


    However I have reprogrammed one with BK723flasher like so:

    The Easy UART Flasher screen with BK7231N chip and OpenBK7231N firmware selected. The interface shows the operation is idle.

    After this the module seems to be idle after power up, draws only 4mA.
    I am wondering if some of the port pins need to be at 3.3V or 0V at startup for the module to boot correctly.
  • #13 21438126
    insmod
    Level 24  
    >>21438048
    Try this firmware, it's the latest version available.

    EDIT: deleted, this version fails to boot.
  • #14 21438169
    p.kaczmarek2
    Moderator Smart Home
    I've seen your PR is ready to merge @insmod, is it working well now? I didn't manage to check it myself yet, first XR806 took my time and now real life stuff.
    Helpful post? Buy me a coffee.
  • #15 21438266
    insmod
    Level 24  
    >>21438169 Probably not, i just tried to flash QIO - and it failed to boot. Shows bootloader log, delays a few seconds, repeatedly. Flashing rbl works.
  • #16 21438289
    p.kaczmarek2
    Moderator Smart Home
    Interesting, but it worked before, right? So maybe checking last commits can give us some insights?

    I can also try to get my NiceMCU and test tomorrow morning and report back
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #19 21438394
    insmod
    Level 24  
    @p.kaczmarek2 now it can probably be merged, boots ok.
    Everything bar SPIDMA should work.
    For some reason, flasher fails to read config, encryption problems or something else?
    Will try to read device flash MID (for unprotect N):
    Flash MID loaded: 152085
    Will now search for Flash def in out database...
    Flash def found! For: 152085
    Flash information: mid: 152085, icName: P25Q16HBK, manufacturer: Puya, szMem: 1000000, szSR: 2, cwUnp: 0, cwEnp: 7, cwMsk: 407C, sb: 2, lb: 5, cwdRd: 05-35-FF-FF, cwdWr: 01-31-FF-FF
    Entering SetProtectState(True)...
    sr: 4
    sr: 4004
    final sr: 4004
    msk: 407c
    cw: 0, sb: 2, lb: 5
    bfd: 0
    sr: 0
    sr: 0
    final sr: 0
    msk: 407c
    cw: 0, sb: 2, lb: 5
    bfd: 0
    SetProtectState(True) success!
    Going to read encryption key...
    Encryption key read done!
    Encryption key: 84f67900 84f67900 84f67900 84f67900
    ^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^
    WARNING! Non-standard encryption key!
    If it's all zero, it may also mean that read is disabled.
    Please report to forum https://www.elektroda.com/rtvforum/forum51.html 
    Or just try using BK7231M mode 
    ^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^
    Going to start reading at offset 0x1D1000...
    Reading 0x1D1000... Ok! 
    Basic read operation finished, but now it's time to verify...
    Data is entirely filled with 0xff, something must went wrong!
    OBK config load failed.
  • #20 21438506
    taggbricka
    Level 6  
    Lovely, Thank you!

    Flashing OpenBeken on BK7238 Module (WB43-M5 V1.1) with Surplife App

    Added after 1 [hours] 6 [minutes]:

    One device starts up and then goes to zero current consumtion after 2 seconds. (other devices consumes 35mA in operation)
    Tried to reprogram it, programming succeds.

    This is on the serial port:

    BK7238_1.0.14
    REG:cpsr spsr r13 r14
    SVC:0x000000D3 0x00401C1C 0x000033A0
    IRQ:0x000000D2 0x00000010 0x00401E0C 0x09BCA98D
    FIR:0x000000D1 0x00000010 0x00401FFC 0x10F08789
    SYS:0x000000DF 0x0040192C 0x00000158
    ST:0x00000000
    [I/FAL] Fal(V0.4.0)success
    [I/OTA] RT-Thread OTA package(V0.2.8-beken-1133282d-20
    220604) initialize success.


    go os_addr(0x10000)..........
  • #21 21438705
    insmod
    Level 24  
    >>21438506 You either flashed an older firmware, or looking at wrong uart port. OBK sends log to UART1 by default, so try to connect your adapter to either P0 or P1 (i don't remember which).
    If you reflash with bootloader overwrite, then bootloader will also log to uart1.
  • #22 21439888
    p.kaczmarek2
    Moderator Smart Home
    It seems @insmod did a very good job. Works for me at first try. I just need to update the flasher.
    Screenshot of Easy UART Flasher software showing firmware write success.
    Log from programming UART:
    Screenshot of the Serial Capture Program showing a UART programming log.
    ( didnt have time to connect debug uart)
    Screenshot showing a dialog box for connecting to a Wi-Fi network named OpenBK7238_8C10262A.

    OpenBK7238_8C10262A user interface with options for configuration, restart, and web application.

    Screenshot showing a table listing network devices and their IP addresses.
    LED RGB is on P6, P24, P26..
    Helpful post? Buy me a coffee.
  • #23 21439906
    taggbricka
    Level 6  
    There is something funny with my last unit.

    I reflash it with "bk7231flasherfirmwaresOpenBK7231N_QIO_1527_merge_2cd87167de38.bin"
    That works OK.
    I connect to the device AP 192.168.4.1
    There I get a full UI.
    I go to wifi setup and enter my net's local credentials and submit.
    After this the UI at 192.168.4.1 is still active. I can navigate in it freely. The wifi credentials are there to see.
    Then I power cycle the device, it powers up to 35mA and after 2 seconds crashes to 5mA. It is not possible to access anymore.

    I have repeated this twice.

    EDIT:
    I will try to check debug output and see if there is something.
  • #24 21439932
    p.kaczmarek2
    Moderator Smart Home
    Here my BK7238 is stable:
    Screenshot of OpenBK7238 user interface showing the state of toggle switches.

    OpenBK7238 board with USB power connection, in front of a screen displaying a graphical interface.
    I am updating flasher:

    User interface of BK7231 Easy UART Flasher with a dropdown menu selecting BK7238 chip.
    Helpful post? Buy me a coffee.
  • #25 21439934
    divadiow
    Level 34  
    p.kaczmarek2 wrote:
    I am updating flasher:

    YES!!
    (and an option to relax filename matching restrictions?) :D :D <3
  • #26 21439937
    p.kaczmarek2
    Moderator Smart Home
    Is Custom read working or not? I don't really remember at the moment:

    Screenshot of software for downloading and flashing firmware on BK7231T/BK7231N devices with open configuration windows.
    Helpful post? Buy me a coffee.
  • #27 21439939
    divadiow
    Level 34  
    p.kaczmarek2 wrote:
    Is Custom read working or not? I don't really remember at the moment:

    I haven't got round to testing it yet

    Added after 11 [hours] 39 [minutes]:

    insmod wrote:
    Everything bar SPIDMA should work.

    If this is a showstopper for SPI/PixelAnim/SM16703P then I can test using

    https://www.elektroda.com/rtvforum/topic4090758.html
    https://www.elektroda.com/rtvforum/topic4064640.html

    when/if required
  • #28 21440237
    p.kaczmarek2
    Moderator Smart Home
    I am fixing small stuff for BK7238, I altered flash tool for it, I am fixing OTA in the Web App, etc, I will try to fix DHT11 and later maybe SPI DMA, depending on what is the problem, is the SPI DMA driver totally missing or just different? https://github.com/OpenBekenIOT/webapp/commit/39fde8263f682323bb4b8ced6b0cfe8fa3b1b006

    Added after 1 [minutes]:



    Screenshot of the OTA interface for the BK7238 chipset.

    Added after 1 [minutes]:

    ajh one more fix needed
    https://github.com/OpenBekenIOT/webapp/commit/7cdc1daadd54a10a01bbac2516e3e56d96775a19
    Helpful post? Buy me a coffee.
  • #29 21440318
    taggbricka
    Level 6  
    Here is the startup debug output on pin P0.

    "bk7231flasherfirmwaresOpenBK7238_QIO_1527_merge_2cd87167de38.bin"
    Flashed with today's version of bk7231flasher.
  • #30 21440502
    p.kaczmarek2
    Moderator Smart Home
    Looks like a random crash? What does the reboot reason say?

    I'm testing BK7238 NiceMCU on latest release with MQTT and it seems ok so far:
    Screenshot of OpenBK7238 interface displaying temperature and humidity data.
    User interface of a monitoring application for BK7238 device with charts of temperature and humidity, event log, and light control.
    Helpful post? Buy me a coffee.

Topic summary

Discussion revolves around flashing OpenBeken firmware onto light bulbs equipped with the BK7238 module (PCB Marking WB43-M5 V1.1). Users share experiences and methods for successfully dumping and flashing firmware, including the use of tools like Easy Flasher and BKFIL. Several users report issues with boot loops and connectivity after flashing, while others provide insights into the flashing process, including the importance of using the correct firmware size and addressing. The conversation highlights the ongoing development of the BK7238 firmware and the need for careful handling during the flashing process to avoid bricking the devices.
Summary generated by the language model.
ADVERTISEMENT