logo elektroda
logo elektroda
X
logo elektroda

[BK7231N/CB2S] Comparison of multiple smart switch modules, differences on PCB, patched firmware

erlipan2001 10497 75
ADVERTISEMENT
  • #61 20594831
    p.kaczmarek2
    Moderator Smart Home
    What do you mean by "WiFi parameters"? If you want to get Template from tuya config, you can do "Read 2MB backup", or use any approach from here:



    If you have entered wrong SSID/ETC, you can do quick 5 power on/off cycles of device, so it will return to AP mode.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #62 20600888
    ttp1106
    Level 6  
    Hi Guys, I still need your help. I desoldered two chips of my devices and solder the 4 pins.
    It will not work.

    [BK7231N/CB2S] Comparison of multiple smart switch modules, differences on PCB, patched firmware

    If I put CEN to ground nothing happens. Also if I disconnected ground or VCC completely for a few seconds, nothing will happen.
    I don't get it what I'm doing wrong...

    [BK7231N/CB2S] Comparison of multiple smart switch modules, differences on PCB, patched firmware

    Now Port 5 is stable and it's my CP210x Adapter.

    Also Writer 1.60 fails
    [BK7231N/CB2S] Comparison of multiple smart switch modules, differences on PCB, patched firmware
  • #63 20600974
    p.kaczmarek2
    Moderator Smart Home
    You have white wire on ground and black on VDD? I hope you didn't swap them..
    bkWriter 1.60 won't work for BK7231N.

    How do you power the module? Maybe you haven't swapped RX to TX and TX to RX? Maybe wires are too long?
    Maybe try this method of resetting:
    1. start flashing process
    2. disconnect VDD
    3. temporary connectect VDD wire of BK7231 (NOT THE ONE of power supply! That would be short-circuit) to GND
    4. connect VDD of BK7231 to power supply VDD (3.3V)
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #64 20601283
    rakalexei
    Level 8  
    [BK7231N/CB2S] Comparison of multiple smart switch modules, differences on PCB, patched firmware [BK7231N/CB2S] Comparison of multiple smart switch modules, differences on PCB, patched firmware

    I also having issues, tried to put CEN to GND - nothing, tried your method above with VDD and GND, got this error message. Not sure what I'm doing wrong.
    Could you please help?
  • #65 20833381
    RobertoD91
    Level 2  

    erlipan2001 wrote:
    Second one:
    Also patched firmware


    Device configuration, as extracted from Tuya:
    - Pair/Toggle All Pin on P23
    - WiFi LED on P26
    - TglChannelToggle (channel 1) on P6
    - Relay (channel 1) on P7
    Device seems to be using CB2S module, which is using BK7231N.


    Hi, I found this version. Is it similar to version 2, or is it different?

    The chip is OU2224FQ instead of NU2134FQ.
    There is an energy monitor chip.
    I'm a novice. Does someone think I can use the same pin for flashing?

    Close-up of a circuit board with an OU2224FQ chip. Image of an electronic circuit board with Fanhar FH17-1A2TLE DC5V components on a PCB. Device update screen showing the firmware is up to date. Phone screen showing the addition of a device WBP-1G.
  • #66 21007006
    t2004dd
    Level 5  
    HI All! I have a lot of switches based on this chip, but with different PCB layouts. I have bought the next bundle of smart switches from AliExpress, and they are without RX TX pads at all, based on T34 chip.

    Close-up of a PCB fragment with electronic components and a T34 chip. Multilayer printed circuit board with T34 chip and electronic components.

    I blew off the chip. It seems that there is only one way to flash it. Pin 26 is not attached at all. According to the picture I have connected CEN ( pin 9) but it is not necessary. It is much easier to break the 3.3V (pin 8).

    Close-up of a chip with several connected wires placed on a white base.

    See also the topic here
    https://www.elektroda.pl/rtvforum/topic4033216.html#20942683

    Used ports:
    P26 pin 15
    P23 pin 17
    P6 pin 21
    P8 pin 23
  • #68 21011456
    p.kaczmarek2
    Moderator Smart Home
    @mawe22 which platform is that? I had reports about Linux instability with the flasher.
    Try this method:
    https://youtu.be/PKkiqDNFIx8?t=293
    Here is a link to hid_download_py:
    https://github.com/OpenBekenIOT/hid_download_py
    See the steps on the video. You can see there both read and flash commands.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #69 21011813
    mawe22
    Level 4  

    p.kaczmarek2 wrote:
    @mawe22 which platform is that? I had reports about Linux instability with the flasher.
    [...]
    Here is a link to hid_download_py:
    https://github.com/OpenBekenIOT/hid_download_py


    this is what I did:

    ## installation according to the documentation
    git clone https://github.com/OpenBekenIOT/hid_download_py.git
    cd hid_download_py/
    sudo apt install python3-hid python3-serial python3-tqdm
    python3 setup.py install --user
    ## execute program
    ./uartprogram -r first.dump
    UartDownloader....
    Read Getting Bus...
    Gotten Bus...
    Set baudrate successful
    len: 119000
    startAddr: 11000
    Reading 11000
    ReadSector Success 11000 len 1000
    4096
    Reading 12000
    ReadSector Success 12000 len 1000
    8192
    [...]
    Reading 129000
    ReadSector Success 129000 len 1000
    1150976
    CRC should be 602db5a9
    CRC is 9d3b7c60
    CRC check failed
    Wrote 119000 bytes to 2.dump
    ## extract Dump
    ./uartprogram -p first.dump
    


    BK7231Flasher.exe -> Extract config from Tuya binary ->
    Neither first.dump nor first.dump.unpackage.bin can be read.

    Failed to extract Tuya keys - magic constant header not found in binary

  • #70 21012246
    p.kaczmarek2
    Moderator Smart Home
    hid_download_py CRC error can be ignored, but I can see that you are not using the command from the video. You need to use the command as we've shown on our video, it also specifies 2MB backup size.

    Futhermore, some devices just don't have Tuya keys. It happens from time to time. Then it's recommended to use GPIO Doctor from the OBK Web App to find out GPIO roles.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #72 21092514
    p.kaczmarek2
    Moderator Smart Home
    This may be the one that I also have. Just make sure to run it with PowerSave 1.
    Helpful post? Buy me a coffee.
  • #73 21095539
    donut343
    Level 2  
    I have two of the switches OP listed, but can't manage to flash them, they also have firmware 1.3.10 v102. I wired them up like you showed in your first post.
    I get several errors during the flashing process after repeatedly clicking the "write only" button, I added them at the bottom of this post. Things I tried:

    - Swapped arduino nano for uno
    - Used SoftwareSerial (see added code)
    - Wiped arduinos and used Rx Tx pins with gnd and reset pins shorted (cant set baud rate with that setup)
    - Tried standalone psu @ 3.3v instead of arduino 3.3v pin
    - Tried hid_download_py and to flash through CMD, to no avail. It fails to set baud rate.
    - Tried different USB ports

    Does anyone have some advice? I'm about to order some USB to TTL uart bridge adapters to try instead of the arduinos..

    Arduino Nano connected to a PCB on a breadboard.
    Code: Arduino
    Log in, to see the code


    
    Starting flash new (no backup)!
    Now is: Saturday, May 25, 2024 11:40:32 AM.
    Flasher mode: BK7231N
    Going to open port: COM7.
    Serial port open!
    Getting bus... (now, please do reboot by CEN or by power off/on)
    Getting bus success!
    Going to set baud rate setting (115200)!
    Will try to read device flash MID (for unprotect N):
    Flash MID loaded: 1560EB
    Will now search for Flash def in out database...
    Flash def found! For: 1560EB
    Flash information: mid: 1560EB, icName: TH25Q_16HB, manufacturer: TH, szMem: 1000000, szSR: 2, cwUnp: 0, cwEnp: 7, cwMsk: 407C, sb: 2, lb: 5, cwdRd: 05-35-FF-FF, cwdWr: 01-FF-FF-FF
    Entering SetProtectState(True)...
    sr: 0
    sr: 0
    final sr: 0
    msk: 407c
    cw: 0, sb: 2, lb: 5
    bfd: 0
    SetProtectState(True) success!
    Reading file firmwares/OpenBK7231N_QIO_1.17.592.bin...
    Loaded 1220464 bytes from firmwares/OpenBK7231N_QIO_1.17.592.bin...
    Preparing to write data file to chip - resetting bus and baud...
    Getting bus... (now, please do reboot by CEN or by power off/on)
    Getting bus success!
    Going to set baud rate setting (115200)!
    Failed to set baud rate!
    
    Starting flash new (no backup)!
    Now is: Saturday, May 25, 2024 11:40:39 AM.
    Flasher mode: BK7231N
    Going to open port: COM7.
    Serial port open!
    Getting bus... (now, please do reboot by CEN or by power off/on)
    Getting bus success!
    Going to set baud rate setting (115200)!
    Will try to read device flash MID (for unprotect N):
    Flash MID loaded: 1560EB
    Will now search for Flash def in out database...
    Flash def found! For: 1560EB
    Flash information: mid: 1560EB, icName: TH25Q_16HB, manufacturer: TH, szMem: 1000000, szSR: 2, cwUnp: 0, cwEnp: 7, cwMsk: 407C, sb: 2, lb: 5, cwdRd: 05-35-FF-FF, cwdWr: 01-FF-FF-FF
    Entering SetProtectState(True)...
    sr: 0
    sr: 0
    final sr: 0
    msk: 407c
    cw: 0, sb: 2, lb: 5
    bfd: 0
    SetProtectState(True) success!
    Reading file firmwares/OpenBK7231N_QIO_1.17.592.bin...
    Loaded 1220464 bytes from firmwares/OpenBK7231N_QIO_1.17.592.bin...
    Preparing to write data file to chip - resetting bus and baud...
    Getting bus... (now, please do reboot by CEN or by power off/on)
    Getting bus success!
    Going to set baud rate setting (115200)!
    Will try to read device flash MID (for unprotect N):
    Flash MID loaded: 1560EB
    Will now search for Flash def in out database...
    Flash def found! For: 1560EB
    Flash information: mid: 1560EB, icName: TH25Q_16HB, manufacturer: TH, szMem: 1000000, szSR: 2, cwUnp: 0, cwEnp: 7, cwMsk: 407C, sb: 2, lb: 5, cwdRd: 05-35-FF-FF, cwdWr: 01-FF-FF-FF
    Entering SetProtectState(True)...
    sr: 0
    sr: 0
    final sr: 0
    msk: 407c
    cw: 0, sb: 2, lb: 5
    bfd: 0
    SetProtectState(True) success!
    Going to do erase, start 0, sec count 298!
    Erasing sector 0... ok! Erasing sector 4096... ok! Erasing sector 8192... ok! Erasing sector 12288... ok! Erasing sector 16384... ok! Erasing sector 20480... ok! Erasing sector 24576... ok! Erasing sector 28672... ok! Erasing sector 32768... ok! Erasing sector 36864... ok! Erasing sector 40960... ok! Erasing sector 45056... Erasing sector 45056 failed!
    Writing file data to chip failed.
    
    Starting flash new (no backup)!
    Now is: Saturday, May 25, 2024 11:41:35 AM.
    Flasher mode: BK7231N
    Going to open port: COM7.
    Serial port open!
    Getting bus... (now, please do reboot by CEN or by power off/on)
    Getting bus success!
    Going to set baud rate setting (115200)!
    Will try to read device flash MID (for unprotect N):
    CheckRespond_FlashGetMID: bad value returned?
    Failed to read device MID!
    Reading file firmwares/OpenBK7231N_QIO_1.17.592.bin...
    Loaded 1220464 bytes from firmwares/OpenBK7231N_QIO_1.17.592.bin...
    Preparing to write data file to chip - resetting bus and baud...
    Getting bus... (now, please do reboot by CEN or by power off/on)
    Getting bus success!
    Going to set baud rate setting (115200)!
    Will try to read device flash MID (for unprotect N):
    CheckRespond_FlashGetMID: bad value returned?
    Failed to read device MID!
    Going to do erase, start 0, sec count 298!
    Erasing sector 0... Erasing sector 0 failed!
    Writing file data to chip failed.
    
    Starting flash new (no backup)!
    Now is: Saturday, May 25, 2024 11:42:06 AM.
    Flasher mode: BK7231N
    Going to open port: COM7.
    Serial port open!
    Getting bus... (now, please do reboot by CEN or by power off/on)
    Getting bus success!
    Going to set baud rate setting (115200)!
    Will try to read device flash MID (for unprotect N):
    CheckRespond_FlashGetMID: bad value returned?
    Failed to read device MID!
    Reading file firmwares/OpenBK7231N_QIO_1.17.592.bin...
    Loaded 1220464 bytes from firmwares/OpenBK7231N_QIO_1.17.592.bin...
    Preparing to write data file to chip - resetting bus and baud...
    Getting bus... (now, please do reboot by CEN or by power off/on)
    Getting bus success!
    Going to set baud rate setting (115200)!
    Will try to read device flash MID (for unprotect N):
    CheckRespond_FlashGetMID: bad value returned?
    Failed to read device MID!
    Going to do erase, start 0, sec count 298!
    Erasing sector 0... ok! Erasing sector 4096... ok! Erasing sector 8192... ok! Erasing sector 12288... ok! Erasing sector 16384... ok! Erasing sector 20480... ok! Erasing sector 24576... ok! Erasing sector 28672... ok! Erasing sector 32768... ok! Erasing sector 36864... ok! Erasing sector 40960... ok! Erasing sector 45056... ok! Erasing sector 49152... ok! Erasing sector 53248... ok! Erasing sector 57344... ok! Erasing sector 61440... ok! Erasing sector 65536... ok! Erasing sector 69632... ok! Erasing sector 73728... ok! Erasing sector 77824... ok! Erasing sector 81920... ok! Erasing sector 86016... ok! Erasing sector 90112... ok! Erasing sector 94208... ok! Erasing sector 98304... ok! Erasing sector 102400... ok! Erasing sector 106496... ok! Erasing sector 110592... ok! Erasing sector 114688... ok! Erasing sector 118784... ok! Erasing sector 122880... ok! Erasing sector 126976... ok! Erasing sector 131072... ok! Erasing sector 135168... ok! Erasing sector 139264... ok! Erasing sector 143360... ok! Erasing sector 147456... ok! Erasing sector 151552... ok! Erasing sector 155648... ok! Erasing sector 159744... ok! Erasing sector 163840... ok! Erasing sector 167936... ok! Erasing sector 172032... ok! Erasing sector 176128... ok! Erasing sector 180224... ok! Erasing sector 184320... ok! Erasing sector 188416... ok! Erasing sector 192512... ok! Erasing sector 196608... ok! Erasing sector 200704... ok! Erasing sector 204800... ok! Erasing sector 208896... ok! Erasing sector 212992... ok! Erasing sector 217088... ok! Erasing sector 221184... ok! Erasing sector 225280... ok! Erasing sector 229376... ok! Erasing sector 233472... Erasing sector 233472 failed!
    Writing file data to chip failed.
    
  • #74 21109310
    p.kaczmarek2
    Moderator Smart Home
    I will just add for clarity that @donut343 issue has been solved in :
    Reading/writing errors on tuya mini switches - issues with arduinos?
    Helpful post? Buy me a coffee.
  • #75 21109485
    donut343
    Level 2  

    >>21109310 Sorry, I should have mentioned! Indeed, turns out my Arduinos all resulted in poor communication with the chips. After using a USB TTL-UART converter I managed to work it out. Thanks @ OP for the information of soldering + pin layout though!
  • #76 21574120
    ttp1106
    Level 6  
    >>20600974

    I found out that I have 5 Ohms between RTX and GRD on this board.

    Electronic module with connected wires on a wooden table.
    A blue electronic module with connected wires, held in hand, on a wooden table background.

    I think that is causing the issue while I cannot flash it. Do you know how I can heal that?

Topic summary

The discussion revolves around the comparison of various smart switch modules, specifically focusing on the BK7231N and CB2S models. Users express confusion over identifying different variants due to their identical external appearances. The conversation highlights the challenges faced with patched firmware (version 1.3.10) that prevents the use of Tuya-Cloudcutter for flashing. Participants share experiences with the BK7231GUIFlashTool, discussing GPIO configurations, the importance of backing up firmware, and the difficulties encountered when attempting to read or flash the devices. Solutions include using alternative flashing tools, ensuring proper connections, and the potential for extracting configurations even after flashing. The need for better documentation and community support for flashing these devices is emphasized, along with the exploration of new modules with different chipsets.
Summary generated by the language model.
ADVERTISEMENT