logo elektroda
logo elektroda
X
logo elektroda
Dostępna jest polska wersja

Czy wolisz polską wersję strony elektroda?

Nie, dziękuję Przekieruj mnie tam

How to upload OpenBeken to sockets with WB2S and BL0937? Flashing error

Mad_Maxs 2121 11
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 20950976
    Mad_Maxs
    Level 12  

    Hello, I have just received two WB2S sockets with BL0937, in which I am trying to install OpenBeneka, but without success.
    Screenshot showing an offer for the EWelink UE 20A smart Wi-Fi plug.
    https://pl.aliexpress.com/item/1005005979222799.html
    Image of a circuit board with attached wires. Close-up view of an ELIVCO smart socket with technical specifications. The image shows a circuit board with electronic components, held in a hand. Close-up of an electronic module held in hand.
    When reading flash, everything goes fine, although it takes over 100 seconds. When trying to upload the current version of OpenBK7231N_QIO_1.17.453.bin it is already FAILED.
    Screenshot of Beken Writer V1.60 software used for firmware flashing. Screenshot of Beken Writer software for programming the BK7231 microcontroller. Screenshot of Beken Writer software during OpenBK7231N flashing attempt.

    What could be wrong?
  • ADVERTISEMENT
  • #2 20951029
    p.kaczmarek2
    Moderator Smart Home
    Using bkWriter 1.60 is not recommended. The new flasher does better, also being able to detect Tuya configuration automatically:
    https://github.com/openshwprojects/BK7231GUIFlashTool
    In addition, from the post, it seems that you are uploading the N version on the T platform (WB2S is BK7231T). This will not work.

    Use the correct flasher for the BK version you have (you have WB2S, so BK7231T), if it still won't move then solder WB2S and program off-chip.
    In this video we show you how to solder the chip:


    .
    Helpful post? Buy me a coffee.
  • #3 20951233
    Mad_Maxs
    Level 12  
    Of course it works :) it's a pity that on startup, Eset Live Grid threw it out as a suspicious file when I tried to run it, because I was trying it on, but after that action I let it go :) no less, let loose outside the network on a separate laptop, it did the job.
    This socket of mine was not in the templates on the webapp, so below I give the pinout : "pins": {
    "6": "LED_n;1",
    "7": "BL0937CF;0",
    "8": "BL0937CF1;0",
    "10": "Btn;1",
    "24": "BL0937SEL;0",
    "26": "Rel;1"
    The socket has two LEDs, red and blue.
    With GPIO 6 set to LED, red indicates relay on, blue indicates relay off
    With GPIO 6 set to LED_n, both illuminate when the relay is on and neither when off

    I would prefer the blue one to indicate on and the red one to indicate off (or neither to light up), but I don't think this can be achieved since they are on the same pin
  • ADVERTISEMENT
  • #4 20951360
    p.kaczmarek2
    Moderator Smart Home
    I would ask for a full template, with the device name and links to the forum etc completed.

    The BK7231GUIFlashTool is compiled straight from Visual, but if you need to, you have the source here:
    https://github.com/openshwprojects/BK7231GUIFlashTool

    Very strange LED configuration, and what does it look like on the board, maybe there is a free GPIO to cut one of the paths and solder to a free pad, albeit on the back of the WB2S?
    Helpful post? Buy me a coffee.
  • #5 20951394
    divadiow
    Level 38  
    >>20951233

    Screenshot shows advanced settings in Eset Endpoint Antivirus with the detection exclusions tab open.

    I had to add exclusions to Eset
  • ADVERTISEMENT
  • #6 20951423
    Mad_Maxs
    Level 12  
    >>20951360
    Looking at the GPIO Finder, I see that driving the relay itself will turn off the red diode, so it would have to be cut off from the GPIO as the relay and driven separately, as you suggested.

    Added after 2 [hours] 8 [minutes]:


    View of an ELIVCO LSPA9 smart plug lying on a world map.

    Below is the template, without a photo because the sockets were left at work, I will complete it tomorrow :) There is already one in the template database, but it is from CB2S and the pinout is different than mine. If there`s anything else missing, let me know and I`ll fix it
    Code: JSON
    Log in, to see the code
  • ADVERTISEMENT
  • #7 20952520
    divadiow
    Level 38  
    did you happen to take a factory fw backup?
  • #8 20953608
    Mad_Maxs
    Level 12  
    @divadiow probably yes, do you need it?
  • #9 20960837
    divadiow
    Level 38  
    was only curious. feel free to post it.
  • #10 21350498
    piteqpl
    Level 12  
    Allow me to refresh the subject a little. Well, I also encountered a difficult piece, and this already at the stage of reading. Apparently it reads the contents of the memory and writes them to the file, but it does not want to read the Tuya configuration and gives such an error:
    Quote:
    Loaded total 0x200000 bytes
    Wrote 2097152 to readResult_BK7231T_QIO_2024-03-12-58-22.bin
    Backup 2MB created, now will attempt to extract OBK config.
    It's not an OBK config, header is bad
    OBK config not found.
    Backup 2MB created, now will attempt to extract Tuya config.
    Tuya config extractor - magic is at 2023424
    Saving debug Tuya decryption data to lastRawDecryptedStrings.bin
    Failed to extract Tuya keys - no json start found
    Sorry, failed to extract keys from Tuya Config in backup binary.

    Model to:
    Quote:
    LSPA9BPv2.1DL
    .
    This is exactly what is written on the laminate of the board.
    What am I doing wrong that it won't read my configuration?
  • #11 21350506
    p.kaczmarek2
    Moderator Smart Home
    Post a copy of the 2MB batch, unless you paired with Tuya and are afraid to share your WiFi data....

    But still, it might not work sometimes, then you have other options:
    - test to the limit with templates of similar sockets:
    https://openbekeniot.github.io/webapp/devicesList.html
    - open the case and visually see what is connected where, a multimeter will also help
    - use the GPIO doctor and experimentally hit where the relay is and where the LED and button are:
    GPIODoctor in OpenBeken - a convenient way to learn about GPIO roles in an IoT device .

    But since you say you have the LSPA9 model then there's probably a WB2S or CB2S inside, it doesn't have a lot of pins so there's not a lot of potential combinations to test. And probably some template from the base will already fit anyway.
    Helpful post? Buy me a coffee.
  • #12 21350676
    piteqpl
    Level 12  
    Inside is a WB2S.The socket is even twinned with the one in the photos. Admittedly it was paired, but with a network that is only switched on for testing and experimentation purposes, so even if the password leaks it won't be much of a tragedy. Right now I'm away from home and have no way to make the dump available, but somewhere around 7pm I'll be happy to make it available. I'd just like to add that I tried to pull the configurations from the dump with BK7231Flasher, but it gives an error about no key or something similar.

    Edit1
    Ok.Attached the dump.

    Edit2
    Continuation of my battle: I opened the dump in hexeditor, searched for the words "pin" and here is the result:
    {sel_pin_pin:24,rl1_lv:1,bt1_pin:10,net_trig:2,jv:1.1.5,netled1_lv:0,bt1_type:0,nety_led:1,vi_pin:8,resistor:1,over_cur:16000,bt1_lv:0,reset_t:5,netled1_pin:6,chip_type:0,lose_vol:90,over_vol:265,module:WB2S,ele_pin:7,ch_cddpid1:9,ch1_stat:2,rl1_type:0,ch_num:1,rl1_pin:26,netn_led:0,vol_def:0,ch_dpid1:1,sel_pin_lv:1,crc:40,}         
    .
    Attachments:
    • dump.bin (2 MB) You must be logged in to download this attachment.

Topic summary

✨ The discussion centers on difficulties flashing the OpenBeken firmware (OpenBK7231N_QIO_1.17.453.bin) onto WB2S smart sockets equipped with the BL0937 energy monitoring chip. While reading the flash memory succeeds, uploading the firmware fails with errors. The user shared images and links to the device and firmware attempts. Suggestions include adding antivirus exclusions (Eset) to prevent interference, verifying GPIO pin assignments using GPIO Finder and GPIODoctor tools, and creating or adjusting device templates for the ELIVCO LSPA9 WB2S with BL0937, which uses the BK7231T chip. A partial device template with pin mappings was provided, highlighting pins for LED, BL0937 signals, button, and relay. Backup of factory firmware dumps was discussed to aid in analysis, though extracting Tuya configuration keys proved problematic. Troubleshooting steps recommended include testing similar device templates, physically inspecting the board with a multimeter, and confirming correct pinouts due to limited pin availability on WB2S/CB2S boards. The user also examined the firmware dump in a hex editor to identify configuration parameters such as pin assignments and voltage thresholds. Overall, the challenge involves overcoming flashing errors and correctly mapping hardware interfaces to successfully deploy OpenBeken firmware on WB2S sockets with BL0937 metering.
Generated by the language model.

FAQ

TL;DR: If flashing WB2S (BK7231T) fails, switch tools—"Using bkWriter 1.60 is not recommended"—and use the T build; reads can take 100+ seconds. [Elektroda, p.kaczmarek2, post #20951029]

Why it matters: This FAQ helps makers fix flashing errors, map pins, and recover Tuya configs on WB2S/BL0937 smart sockets.

Quick Facts

How do I fix OpenBeken flashing failures on WB2S with BL0937?

Use BK7231GUIFlashTool and the BK7231T firmware, not the N build. “Using bkWriter 1.60 is not recommended.” If in-circuit flashing still fails, program off‑chip after desoldering. How‑To: 1. Open BK7231GUIFlashTool. 2. Select BK7231T image and flash. 3. If it won’t move, desolder WB2S and program off‑board. [Elektroda, p.kaczmarek2, post #20951029]

Which OpenBeken binary should I flash on WB2S?

WB2S uses the BK7231T platform. Flash the BK7231T build (not the BK7231N build). A T/N mismatch will fail every time. [Elektroda, p.kaczmarek2, post #20951029]

What flasher should I use instead of bkWriter 1.60?

Use BK7231GUIFlashTool. It’s more reliable than bkWriter 1.60 and can auto-detect Tuya configuration during backup/extraction. [Elektroda, p.kaczmarek2, post #20951029]

My antivirus flags the BK7231GUIFlashTool. What should I do?

Users report ESET flagging the tool. Add an antivirus exclusion and, if concerned, run it offline on a separate machine. “I had to add exclusions to Eset.” [Elektroda, divadiow, post #20951394]

Should I back up the factory firmware before flashing?

Yes. The flasher creates a 2MB backup; keep it safe for recovery or analysis. This preserves Tuya data and device configuration. [Elektroda, piteqpl, post #21350498]

What is the pinout/template for ELIVCO LSPA9 WB2S with BL0937?

Use this mapping: P6 LED_n; P7 BL0937CF; P8 BL0937CF1; P10 Btn_n; P24 BL0937SEL; P26 Relay. Apply it in OpenBeken’s template. [Elektroda, Mad_Maxs, post #20951423]

Can I swap blue/red LED behavior on this socket via software?

Not with stock wiring. Both LEDs share one GPIO, so roles invert together. A hardware mod is required. “Maybe there is a free GPIO to cut one of the paths and solder...” [Elektroda, p.kaczmarek2, post #20951360]

BK7231GUIFlashTool failed to extract Tuya keys. What next?

Extraction can fail. Then try known templates, inspect the board, or use OpenBeken’s GPIO Doctor to probe relay/LED/button. This quickly yields a working config. [Elektroda, p.kaczmarek2, post #21350506]

How long does a full flash read typically take on WB2S?

Expect longer reads; one user reported over 100 seconds for a successful read. Slow reads do not imply a bad dump. [Elektroda, Mad_Maxs, post #20950976]

Which pins are BL0937 CF/CF1/SEL on the LSPA9 board?

CF is on P7, CF1 on P8, and SEL on P24. Configure these roles in OpenBeken for power metering. [Elektroda, Mad_Maxs, post #20951423]

In-circuit flashing still fails. Can I program WB2S off the board?

Yes. Desolder WB2S and program it off‑chip. This bypasses on‑board circuitry that can block flashing and improves reliability. [Elektroda, p.kaczmarek2, post #20951029]

Is the ELIVCO LSPA9 always WB2S, and will a template fit?

LSPA9 commonly uses WB2S or CB2S. Pin count is limited, so testing nearby templates often works. Open the case to confirm. [Elektroda, p.kaczmarek2, post #21350506]

How can I quickly find relay, LED, and button pins without a template?

Use OpenBeken’s GPIO Doctor to probe pins interactively. It helps map relay, LEDs, and button in minutes. [Elektroda, p.kaczmarek2, post #21350506]

Why do I see “Failed to extract Tuya keys – no json start found”?

It means the extractor failed to locate/decrypt the Tuya JSON block in your dump. Configure manually or try another backup. [Elektroda, piteqpl, post #21350498]

Can I recover config details from a dump when key extraction fails?

Yes. Open the dump in a hex editor and search for “pin” to find readable mapping fields. This reveals roles quickly. [Elektroda, piteqpl, post #21350676]
Generated by the language model.
ADVERTISEMENT