logo elektroda
logo elektroda
X
logo elektroda

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

p.kaczmarek2 3942 113
ADVERTISEMENT
📢 Listen (AI):
  • ADVERTISEMENT
  • #93 21719187
    p.kaczmarek2
    Moderator Smart Home
    Nice, W800 read seem to work.
    BK7231 Easy UART Flasher interface reading firmware from device via COM3
    @insmod by msvc didn't see System.Text.Json and I had to install it via NuGet , is it intended, or is my MSVC old?
    Screenshot of NuGet Package Manager showing System.Text.Json package

    Added after 6 [hours] 34 [minutes]:

    PS: I tried to add retry for BK7231T on UART in EF:
    Flashing tool UI with UART errors and flash process log failing at sector 69362
    It fails to retry everytime.
    On the other hand... on N:
    Screenshot of BK7231 Easy UART Flasher erasing firmware from BK7231N chip
    I cause interference by shorting RX and TX together.
    Helpful post? Buy me a coffee.
  • #94 21719650
    insmod
    Level 29  
    >>21718744
    Nothing interesting here

    >>21719187
    Intended.

    Maybe move all the other chips bar bk spi into another topic? But what to call it...
  • ADVERTISEMENT
  • #95 21720013
    p.kaczmarek2
    Moderator Smart Home
    Well, considering the discussion is more or less about new features of the flasher, I can say it's marginally acceptable to at least let it stay here.

    I am posting a WiFi flasher demo. Currently, it's a dirty copy of BK7123 flashing routines to C# with serial port changed to TCP socket.
    It is available here: https://www.elektroda.com/rtvforum/topic4148743.html
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #97 21720718
    divadiow
    Level 36  
    >>21720700

    amazing! in that case I might have to have another stab at backing up the ELM327 W600 I still have on stock fw, though the pins are quite small and IC placement particularly awkward. PB6 is right next to VDD33 too. xtal could be removed I guess

    Added after 40 [minutes]:

    very good. does EF acknowledge flash completion for you?

    BK7231 Easy UART Flasher program writing firmware to W600 chip.

    boots, AP, HC-25 web
    Visible Wi-Fi network named HC-25-286dcd0b8d1 with a signal iconHC-25 login page with password field and two buttons on a white background

    Added after 13 [minutes]:

    divadiow wrote:
    does EF acknowledge flash completion for you?

    if writing custom bin*

    OpenW600 written OK and boots. Air602

    BK7231N Easy UART Flasher interface with “Writing done” message

    Added after 1 [minutes]:

    insmod wrote:
    there was no log on any UART

    same.
  • #98 21721526
    divadiow
    Level 36  
    hello.

    I'm curious about the current state of BK7252U backup in EF. I've got a new 2MB BK7252UQN48 and I took an SPI backup with Neo and Beken SPI. Easy Flasher BK7231T and BK7231U uart mode takes identical backup to both SPI - so 4 identical backups. But if you take a BK7252U backup it will get it wrong, creating a different backup to the rest.

    Comparison of two binary files showing identical hex code and confirmation message

    EF says it is starting at 0x11000:

    Code: Text
    Log in, to see the code


    and at the end:

    Code: Text
    Log in, to see the code


    but then makes a 2,097,152 bytes file with UA in the name.

    If you do a custom read from 0x0 for 0x200000 length you get this, which has been seen in posts before:

    Code: Text
    Log in, to see the code


    I gather there's an ongoing issue with 4mb BK7252U and wrap-around but a 2mb backup should just be the same as T/U but with different names?

    Terminal window showing list of duplicate and unique binary files by hash

    I attach all backups for reference.
  • #99 21722488
    divadiow
    Level 36  
    insmod wrote:
    Since it's a 24pin camera, would it work in ESP32-CAM?


    ESP32 modules and OV3660 camera on a blue background

    GPT sketch. it got OmniVision OV3660 right

    Code: Text
    Log in, to see the code


    Detects some stuff if 24-pin doorbell GC0328C inserted

    Code: Text
    Log in, to see the code
  • #100 21730989
    divadiow
    Level 36  
    ah yes, this old chestnut.
    Screenshot showing BK7231 flasher writing error and IC not responding in programmer log

    fiddling with https://www.elektroda.com/rtvforum/topic4150112.html

    Screenshot of flash programming tool with successful full chip erase in BekenSPI mode.

    it's weird because unchecking SREG2:14 then allows erase/write but subsequent reads of values in AS shows it checked still BUT you can continue to erase/write. hmm

    Also, could we have an SPI-entry/D2 mode only for Beken SPI? At the moment you have to do an operation (erase/write/read) to get into SPI mode, but sometimes you my just want to get into SPI mode to then use other apps.
  • #101 21731041
    p.kaczmarek2
    Moderator Smart Home
    Good idea, I added "Detect" button, it currently works by doing custom operation with 0 read and 0 write size. Can you check if it works?
    Helpful post? Buy me a coffee.
  • #103 21734531
    divadiow
    Level 36  
    forgot I'd tried W806 too. pretty sure this is the same as when tried with Python thing. detect flash size but nothing more
    BK7231 Easy UART Flasher interface with a flash memory reading error.

    Write works OK though. Or says it does. Doesn't boot.

    BK7231 Easy UART Flasher interface with Writing done message

    Added after 2 [hours] 17 [minutes]:

    here's what seems to be a working full erase inspired by Upgrade Tool's serialthread.py
    Code: Python
    Log in, to see the code


    CMD window showing flash erase process for W806 microcontroller

    Erase success for 1mb W806 too but I can't confirm it.

    on 2mb W800 read-backs appear blank apart from the first few bytes. Read-back content is the same after stopping Upgrade Tool's own erase function just before it starts to write new image (erase selection requires flash image selection too to start).

    Four flash memory dump windows in hex editor view with decoded text
  • #104 21747802
    divadiow
    Level 36  
    there was a suggestion somewhere that BK7238 in EF might default to QIO I think. Or maybe the option, and why, should be made clearer when the user hits the flash button without "overwrite bootloader" selected. It just feels like with BK7238's increasing popularity, there will potentially be a number of people that don't flash QIO then later realise OTA doesn't work and be annoyed.

    Added after 1 [minutes]:

    or the need will arise to add a variant that caters for OTA at other popular offsets
  • ADVERTISEMENT
  • #105 21747805
    insmod
    Level 29  
    >>21747802
    If i remember correctly, bootloader is always overwritten on 7238 and 7252N.
  • Helpful post
    #107 21748843
    divadiow
    Level 36  
    does ECR6600 stub pr read OK for you @insmod ?

    I get this
    Screenshot of BK7231 Flasher tool showing SHA mismatch error in red text

    but v148 reads ok
    BK7231 Easy UART Flasher interface with firmware read completed
  • #109 21748866
    divadiow
    Level 36  
    cool. initial read fails but then click read again and it will start

    BK7231 Easy UART Flasher interface reading flash memory via COM46.

    same pattern with a few tries. device resets in between
  • Helpful post
    #111 21748882
    divadiow
    Level 36  
    Ta. Now afk until this evening

    Added after 8 [hours] 50 [minutes]:

    Screenshot of BK7231 Easy UART Flasher showing memory read completed

    Firmware flashing process for ECR6600 using file OpenECR6600_1.18.210.bin



    Added after 21 [minutes]:

    bit more.

    every baud in EF read first time apart from 460800 which errors with

    Code: Text
    Log in, to see the code


    Added after 2 [hours] 7 [minutes]:

    writing worked first time for all but 460800. I never flash at 460800 to be honest.
  • #113 21773694
    p.kaczmarek2
    Moderator Smart Home
    Seems acceptable, nice, thank you. Let me know if you are able to find more such issues in the flasher.
    Helpful post? Buy me a coffee.
📢 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