logo elektroda
logo elektroda
X
logo elektroda

Beken BK7231/BK7252 SPI flashing and recovery - new flasher tool and protocol specs

p.kaczmarek2 6768 213
ADVERTISEMENT
📢 Listen (AI):
  • #211 21821133
    p.kaczmarek2
    Moderator Smart Home
    Why not move flash vars elsewhere on BK7238 and update offset in obk?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • ADVERTISEMENT
  • #213 21821592
    max4elektroda
    Level 22  
    max4elektroda wrote:
    But at least a first try to fix the things you mentioned (rl_on\d+_pin and rl_off\d+_pin)

    Added some code to use regex finding these keys instead of looping through the numbers.

    For now, mainly coded, not tested thoroughly, not sure if it's even ready for a PR......

    https://github.com/MaxineMuster/OBK_webapp/tree/templateparser


    Made some more changes and (hopefully) improvements to "templateParser.js".
    Now all cases from "TuyaConfig.cs" should be here, too + added code for (seldom) "sel_pin_lv: 0" needing BL0937SEL_n.

    Also tried to fix import.vue "ignoring" WebApp source, but always loading "https://openbekeniot.github.io/webapp/templateParser.js" and "https://openbekeniot.github.io/webapp/tuyaExporter.js".
    Since I wanted this to work even in strange configs, I had to find the location, from which script was loaded.
    For me it now worked with both on a single machine, e.g. simulators web interface running on default port 80 and WebApp served locally e.g. on port 8080.
    Just had to make sure, httpd will send "Access-Control-Allow-Origin: *"...

    But let's get sure about some questions:

    rl_on1_pin / rl_off1_pin: What is the correct role? BridgeFWD/BridgeREV or Rel/Rel_n ??
    r_pin/g_pin/b_pin/c_pin/w_pin: What's the correct channel to use? templateParser.js assigns 1 to 5, C# code in TuyaConfig.cs assigns 0 to 4 (though in description it's 1 - 5):

                       case "r_pin":
                            desc += "- LED Red (Channel 1) on P" + value + Environment.NewLine;
                            tg?.setPinRole(value, PinRole.PWM);
                            tg?.setPinChannel(value, 0);
                            break;
                        case "g_pin":
                            desc += "- LED Green (Channel 2) on P" + value + Environment.NewLine;
                            tg?.setPinRole(value, PinRole.PWM);
                            tg?.setPinChannel(value, 1);
                            break;
                        case "b_pin":
                            desc += "- LED Blue (Channel 3) on P" + value + Environment.NewLine;
                            tg?.setPinRole(value, PinRole.PWM);
                            tg?.setPinChannel(value, 2);
                            break;
                        case "c_pin":
                            desc += "- LED Cool (Channel 4) on P" + value + Environment.NewLine;
                            tg?.setPinRole(value, PinRole.PWM);
                            tg?.setPinChannel(value, 3);
                            break;
                        case "w_pin":
                            desc += "- LED Warm (Channel 5) on P" + value + Environment.NewLine;
                            tg?.setPinRole(value, PinRole.PWM);
                            tg?.setPinChannel(value, 4);
                            break;
    
  • #214 21823610
    divadiow
    Level 37  
    max4elektroda wrote:
    rl_on1_pin / rl_off1_pin: What is the correct role? BridgeFWD/BridgeREV or Rel/Rel_n ??

    there's this maybe pivotal moment here https://www.elektroda.com/rtvforum/topic4000770.html#20869388

    I can't find an obvious change to templateParser.js to coincide.

    My feeling is that this detection should be BridgeFWD/BridgeREV and not Rel/Rel_n

    lt detects it as bistable / H-Bridge if there is no normal relay pin and both ON and OFF drive pins exist

    Added after 40 [minutes]:

    hmm, there must be quite a few more out there to be added too. eg:

    https://www.elektroda.com/rtvforum/topic4093780.html#21790729

    in the json we see

    Code: Text
    Log in, to see the code


    chip_type:2 = HLW8032
📢 Listen (AI):

Topic summary

BK7231GUIFlashTool version 98 and later introduces a new SPI flashing method for Beken BK7231/BK7252 devices using only a CH341 SPI programmer. This method enables recovery of bricked devices with overwritten bootloaders and functions as a general-purpose SPI flasher supporting various memory chips. The approach builds on previous SPI programming techniques using Python and Banana Pi, adapting them for CH341 hardware and C# implementation. Required hardware includes a CH341 programmer and soldering tools for wire attachment. Recent user feedback on version 98 highlights issues such as the tool requiring a COM port selection in SPI mode, lack of CH341A detection warnings, and missing ch341dll.dll errors. The developer has addressed the COM port requirement and plans to add the missing DLL, requesting further debugging via Visual Studio to handle CH341 initialization exceptions.
Summary generated by the language model.
ADVERTISEMENT