logo elektroda
logo elektroda
X
logo elektroda

[BK7231N] OpenBK Flashing and MQTT/Alexa Configuration for Casalux LED-RGB WiFi Flexband

alpenbeni 4605 31
ADVERTISEMENT
  • I just bought a bunch of LED stripes from our local supermarket and flashed them with OpenBK. My goal was to be able to control the device via MQTT in my iobroker instance as well as an Alexa Integration.

    Casalux LED RGB strip box with remote and lighting effects.

    If you're from germany, you can get the stripe at "Aldi Süd" for 7,99€ this week, and as you see in the following, you can also use it with OpenBK.
    The stripe itself is pretty cheap but it's not that bad. It comes with a small power adapter, a remote control and some stuff to mount the stripe. Also some cables to go around corners are included. The stripe itself is secured with IP20, so it has this type of glue on the top.

    Casalux RGB LED strip with remote and controller against the box background.

    So first of all after buying the stripe I had to take a deeper look to the chipset used in the controller. A screwdriver is a helpful friend to open the case.

    Close-up of BK7231N LED controller board with electronic components.

    After removing the mainboard, i had to remove the white plasic part under the ir-sensor to see the chipset

    Close-up of a circuit board featuring the BK7231N chip and various electronic components.

    Close-up of a circuit board featuring the BK7231N chip.

    So there it is, the BK7231N.
    The next step is to connect the controller to your pc with using your UART USB Converter.
    To do so, connect as following:
    - VCC from Controller to VCC of Converter
    - GND from Controller to GND of Converter
    - RX1 from Controller to TX of Converter
    - TX1 from Controller to RX of Converter

    Make sure to use 3.3V on your Converter and attach the usb cable of your converter to your pc.

    Close-up shot of a circuit board with soldered wires.

    Then download the FlashTool under the following URL:
    https://github.com/openshwprojects/BK7231GUIFlashTool/releases/tag/v1.1.5

    After starting the tool, i've chosen my com port "COM5", which my converter is using, chosen "BK7231N" as chip type and downloaded the newest version with the button next to the drop down where to select the firmware.
    Also i had to choose 115200 as baud rate, as i got errors with the suggested default rate.
    Then click in "Do backup and flash new" to start the firmware update.

    Screen of the BK7231 Easy UART Flasher program with COM5 port open and BK7231N chip set.

    Now you'll see the yellow lines that indicates that the device needs to be rebooted.
    In my case powering off the device did not help. Instead i just hold a cable from the GND pin to the CEN pin for a very short time and the flashing process continued ...

    BK7231 Easy UART Flasher interface with firmware loading

    The tool will create a backup of the firmware first. After that, the firmware is written to your device.
    When this is done, you will see the tuya config, which is helpful afterwards as it contains informations about which channel is located on which pin of the controller. So it's a good idea to save that information for later use.

    Screenshot of Tuya device configuration results after flashing.

    My Tuya Configuration:
    Device configuration, as extracted from Tuya: 
    - LED Blue (Channel 3) on P7
    - TODO1000
    - LED Red (Channel 1) on P6
    - LED Green (Channel 2) on P24
    Device seems to be using CBU module, which is using BK7231N.
    And the Tuya section starts, as usual, at 2023424
    


    Then i disconnect the USB cable and disconnect the Converter from the controller.
    Connect the controller with the power adapter to start the controller.
    On my smartphone i've then searched for the wifi called "OpenBK..." of the controller and connected to it.

    Screenshot of available Wi-Fi networks on a smartphone.

    Open the browser on your smartphone and enter the following uri to access the OpenBK firmware of your device.
    http://192.168.4.1


    OpenBK8231N configuration screen on a smartphone.

    First of all, you should go to "config - Configure WiFi" and configure the access to your local wifi here.

    OpenBK web interface on a smartphone for WiFi configuration.

    After that you can lookup the newly assigned ip adress on your local router and connect to this ip adress to continue the configuration.
    Go to "config - Configure Module". Here you'll need the information of the tuya config mentioned above and set the module as following:
    - P6 (PWM0) : PWM : 1
    - P7 (PWM1) : PWM : 3
    - P24 (PWM4) : PWM : 2

    Screenshot of a LED device GPIO configuration tool.

    Go back to the main screen. When you attach the stripe to your controller, you should now be able to control the device and change the colors.

    For access with iobroker, goto "config - Configure MQTT" and enter the ip adress where your iobroker is running and the authentication details of the running sonoff adapter.

    OpenBK user interface for configuring MQTT.

    Under "config - Configure General/Flags" i also had to enable the following flag to get data into my iobroker instance:
    Flag 30 - [MQTT] Enable Tasmota TELE etc publishes (for ioBroker etc)


    For Alexa Integration, goto "config - Change startup command text" and enter the following:
    backlog startDriver SSDP; startDriver Wemo

    This leads to starting up the Wemo driver at every reboot of the controller.
    After clicking on reboot on the main page, you can search for new devices on your Alexa and your controller should be found. It will only be found as a switch, so changing colors within alexa is not yet possible as the hue driver is not yet ready to use within OpenBK.

    Afterall the stripe is working fine with Alexa and also in my iobroker instance.

    Template:
    {
      "vendor": "Tuya",
      "bDetailed": "0",
      "name": "Casalux LED-RGB WiFi Flexband",
      "model": "56279",
      "chip": "BK7231N",
      "board": "TODO",
      "flags": "1074004992",
      "keywords": [
        "TODO",
        "TODO",
        "TODO"
      ],
      "pins": {
        "6": "PWM;1",
        "7": "PWM;3",
        "24": "PWM;2"
      },
      "command": "backlog startDriver SSDP; startDriver Wemo",
      "image": "https://obrazki.elektroda.pl/4560293800_1702338662.jpg",
      "wiki": "https://www.elektroda.com/rtvforum/topic4020803.html"
    }

    Cool? Ranking DIY
    About Author
    alpenbeni
    Level 2  
    Offline 
    alpenbeni wrote 3 posts with rating 3. Been with us since 2023 year.
  • ADVERTISEMENT
  • #2 20857811
    p.kaczmarek2
    Moderator Smart Home
    Hello, can you attach here Tuya config binary? I would like to check which JSON field gave "TODO 1000" in text description, maybe that's something I need to fix
    Helpful post? Buy me a coffee.
  • #3 20859975
    alpenbeni
    Level 2  
    Do you mean the json version of the tuya config?
    {
    	"Jsonver":"1.0.4",
    	"gmwb":"75",
    	"title20":"0",
    	"brightmem":"1",
    	"1err":"40",
    	"gmwg":"70",
    	"knum":"1",
    	"leaderr":"15",
    	"wfcfg":"spcl_auto",
    	"colormin":"10",
    	"bitseq":"0",
    	"pmemory":"1",
    	"gmkb":"60",
    	"pairt":"120",
    	"wgmod":"0",
    	"cmod":"rgb",
    	"irkeytype":"1",
    	"cwtype":"0",
    	"tempstep":"25",
    	"customcode":"239",
    	"rstbr":"50",
    	"ktime":"5",
    	"0err":"70",
    	"colormax":"100",
    	"notdisturb":"0",
    	"module":"CBU",
    	"b_pin":"7",
    	"ir":"26",
    	"b_lv":"1",
    	"rstmode":"2",
    	"dmod":"0",
    	"sfunc":"3",
    	"key_lv":"0",
    	"wfct":"3",
    	"pwmhz":"1000",
    	"r_pin":"6",
    	"scenespct":"5",
    	"defbright":"100",
    	"md":"0",
    	"wfb64":"1",
    	"stat":"0",
    	"token":"null",
    	"region":"null",
    	"reg_key":"null",
    	"dns_prio":"0 }{uuid",
    	"psk_key":"VmF2VTp4vgY09NqblINC19Ob0s7qlppB82TuB",
    	"auth_key":"AoAfvbyszjcBevTcGTyVrXJR1Rh3O2L1",
    	"ap_ssid":"SmartLife",
    	"ap_passwd":"null",
    	"country_code":"CN",
    	"bt_mac":"null",
    	"bt_hid":"null",
    	"prod_test":"false",
    	"fac_pin":"epsvjhf8jgfauspx }rr",
    	"rstnum":"3",
    	"rstcor":"r",
    	"r_lv":"1",
    	"deftemp":"100",
    	"k1dfunc":"0",
    	"keyfunc":"1",
    	"irfunc":"1",
    	"g_lv":"1",
    	"irfunSet":"[[58",
    	"ismusic":"0",
    	"irstep":"10",
    	"key_pin":"20",
    	"remdmode":"0",
    	"g_pin":"24",
    	"swgmod":"0",
    	"gmwr":"100",
    	"gmkg":"60",
    	"onoffmode":"0",
    	"aging":"0",
    	"rsttemp":"100",
    	"category":"0503",
    	"gmkr":"80",
    	"defcolor":"r",
    	"crc":"91"
    }
    


    Added after 6 [minutes]:

    Also have this binary, if it's helpful?
    lastRawDec...trings.bin Download (71.86 kB)
  • #4 20860012
    p.kaczmarek2
    Moderator Smart Home
    Thank you, I can see now, it was pwmhz. The PWM frequency of this device is 1000Hz. Okay, I will fix it in my decryptor, by basically replacing "TODO" string with "PWM Frequency". Thanks
    Helpful post? Buy me a coffee.
  • #5 20862599
    Helmi_Beh
    Level 2  

    Did you try the remote control to get it working? I need a "translation table" from key messages to controller messages, maybe at the MQTT level.
  • #6 20862609
    p.kaczmarek2
    Moderator Smart Home
    You need to do IR capture and just script IR events, maybe even in OBK, like we did on our tutorial:


    Helpful post? Buy me a coffee.
  • #7 20865771
    luebbe
    Level 6  
    Hi everybody,
    Is there anything special with this device that I have to take care of? I'm trying to flash the same device, but no luck so far.
    When I try to create a backup, it always fails when reading address 0xF000 or sometimes 0x10000.

    It doesn't make a difference if I set 115200 or 921600 baud rate

    The output of the log is the following:
    
    Backup name has not been set, so output file will only contain flash type/date.
    Starting read backup and flash new!
    Now is: Sonntag, 17. Dezember 2023 17:26:23.
    Flasher mode: BK7231N
    Going to open port: COM8.
    Serial port open!
    Getting bus... (now, please do reboot by CEN or by power off/on)
    Getting bus failed, will try again - 0/100!
    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: 34
    sr: 34
    final sr: 34
    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 start reading at offset 0x00...
    Reading 0x00... Ok! Reading 0x1000... Ok! Reading 0x2000... Ok! Reading 0x3000... Ok! Reading 0x4000... Ok! Reading 0x5000... Ok! Reading 0x6000... Ok! Reading 0x7000... Ok! Reading 0x8000... Ok! Reading 0x9000... Ok! Reading 0xA000... Ok! Reading 0xB000... Ok! Reading 0xC000... Ok! Reading 0xD000... Ok! Reading 0xE000... Ok! Reading 0xF000... Ok! Reading 0x10000... failed with serial.BytesToRead 2065 (expected 4111)
    The beginning of buffer in UART contains FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF data.
    Failed!
    
  • ADVERTISEMENT
  • #8 20865791
    p.kaczmarek2
    Moderator Smart Home
    Hello, can you try hid_download_py method, as shown here:
    https://www.youtube.com/watch?v=PKkiqDNFIx8
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #9 20865844
    luebbe
    Level 6  
    Will try, thanks for the hint.
  • #11 20869355
    luebbe
    Level 6  
    OK, I managed to download a ~2MB file from the device using uartreader on linux with 115200 baud. At the end it complained that the CRC is not equal. How can I proceed from here? I do not dare to flash the device (yet), because I do not want to brick it.
  • ADVERTISEMENT
  • #12 20869390
    p.kaczmarek2
    Moderator Smart Home
    Well, if you post this file here, I can extract config for you. Was it paired with Tuya before? You can also extract config yourself with this tool:
    https://github.com/openshwprojects/BK7231GUIFlashTool
    This may work even on Linux with mono
    Helpful post? Buy me a coffee.
  • #13 20869405
    luebbe
    Level 6  
    No, it wasn't paired with Tuya yet. I'll SCP the file on my windows PC and will try to extract the config.
  • #14 20869411
    p.kaczmarek2
    Moderator Smart Home
    If it wasn't paired with Tuya, then feel free to share, it may be useful for other purposes too.
    Helpful post? Buy me a coffee.
  • #15 20869414
    luebbe
    Level 6  
    Here's the json config:
    Code: JSON
    Log in, to see the code


    And here's the Text description:

    Device configuration, as extracted from Tuya:
    - LED Blue (Channel 3) on P7
    - PWM Frequency1000
    - LED Red (Channel 1) on P6
    Device seems to be using CBU module, which is using BK7231N.
    And the Tuya section starts at UNCOMMON POSITION 2019328

    I'm missing the LED Green Channel.
    In theory my device is exactly the same as the one from helmi_beh, but maybe I've got one from a different batch
  • #16 20869417
    p.kaczmarek2
    Moderator Smart Home
    No problem here, PWMs are only on P6, P7, P8, P24, P26, so now.... you have only 3 options to check. It's either P8, P24, or P26
    Helpful post? Buy me a coffee.
  • #17 20869421
    luebbe
    Level 6  

    Probably P24, because it should be the same device as the one from helmi_beh and green is on P24 there.
    Should I also post the binary here?
  • #20 20870228
    luebbe
    Level 6  
    Today I connected the device directly to a USB port on my PC (no USB hub in between) and it looked like the UI flasher could read the device without problems and extract the configuration. This encouraged me to flash the device, but unfortunately it failed at sector 0xf000 again and I have a bricked device now.
    I'll try with the python uartprogram again, but this hung after a few percent when I tried for the first time. So probably the same problem.

    Here's the log output of the GUI tool:

    
    Starting flash new (no backup)!
    Now is: Mittwoch, 20. Dezember 2023 17:03:46.
    Flasher mode: BK7231N
    Going to open port: COM8.
    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.366.bin...
    Loaded 1220464 bytes from firmwares/OpenBK7231N_QIO_1.17.366.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... 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... ok! Erasing sector 237568... ok! Erasing sector 241664... ok! Erasing sector 245760... ok! Erasing sector 249856... ok! Erasing sector 253952... ok! Erasing sector 258048... ok! Erasing sector 262144... ok! Erasing sector 266240... ok! Erasing sector 270336... ok! Erasing sector 274432... ok! Erasing sector 278528... ok! Erasing sector 282624... ok! Erasing sector 286720... ok! Erasing sector 290816... ok! Erasing sector 294912... ok! Erasing sector 299008... ok! Erasing sector 303104... ok! Erasing sector 307200... ok! Erasing sector 311296... ok! Erasing sector 315392... ok! Erasing sector 319488... ok! Erasing sector 323584... ok! Erasing sector 327680... ok! Erasing sector 331776... ok! Erasing sector 335872... ok! Erasing sector 339968... ok! Erasing sector 344064... ok! Erasing sector 348160... ok! Erasing sector 352256... ok! Erasing sector 356352... ok! Erasing sector 360448... ok! Erasing sector 364544... ok! Erasing sector 368640... ok! Erasing sector 372736... ok! Erasing sector 376832... ok! Erasing sector 380928... ok! Erasing sector 385024... ok! Erasing sector 389120... ok! Erasing sector 393216... ok! Erasing sector 397312... ok! Erasing sector 401408... ok! Erasing sector 405504... ok! Erasing sector 409600... ok! Erasing sector 413696... ok! Erasing sector 417792... ok! Erasing sector 421888... ok! Erasing sector 425984... ok! Erasing sector 430080... ok! Erasing sector 434176... ok! Erasing sector 438272... ok! Erasing sector 442368... ok! Erasing sector 446464... ok! Erasing sector 450560... ok! Erasing sector 454656... ok! Erasing sector 458752... ok! Erasing sector 462848... ok! Erasing sector 466944... ok! Erasing sector 471040... ok! Erasing sector 475136... ok! Erasing sector 479232... ok! Erasing sector 483328... ok! Erasing sector 487424... ok! Erasing sector 491520... ok! Erasing sector 495616... ok! Erasing sector 499712... ok! Erasing sector 503808... ok! Erasing sector 507904... ok! Erasing sector 512000... ok! Erasing sector 516096... ok! Erasing sector 520192... ok! Erasing sector 524288... ok! Erasing sector 528384... ok! Erasing sector 532480... ok! Erasing sector 536576... ok! Erasing sector 540672... ok! Erasing sector 544768... ok! Erasing sector 548864... ok! Erasing sector 552960... ok! Erasing sector 557056... ok! Erasing sector 561152... ok! Erasing sector 565248... ok! Erasing sector 569344... ok! Erasing sector 573440... ok! Erasing sector 577536... ok! Erasing sector 581632... ok! Erasing sector 585728... ok! Erasing sector 589824... ok! Erasing sector 593920... ok! Erasing sector 598016... ok! Erasing sector 602112... ok! Erasing sector 606208... ok! Erasing sector 610304... ok! Erasing sector 614400... ok! Erasing sector 618496... ok! Erasing sector 622592... ok! Erasing sector 626688... ok! Erasing sector 630784... ok! Erasing sector 634880... ok! Erasing sector 638976... ok! Erasing sector 643072... ok! Erasing sector 647168... ok! Erasing sector 651264... ok! Erasing sector 655360... ok! Erasing sector 659456... ok! Erasing sector 663552... ok! Erasing sector 667648... ok! Erasing sector 671744... ok! Erasing sector 675840... ok! Erasing sector 679936... ok! Erasing sector 684032... ok! Erasing sector 688128... ok! Erasing sector 692224... ok! Erasing sector 696320... ok! Erasing sector 700416... ok! Erasing sector 704512... ok! Erasing sector 708608... ok! Erasing sector 712704... ok! Erasing sector 716800... ok! Erasing sector 720896... ok! Erasing sector 724992... ok! Erasing sector 729088... ok! Erasing sector 733184... ok! Erasing sector 737280... ok! Erasing sector 741376... ok! Erasing sector 745472... ok! Erasing sector 749568... ok! Erasing sector 753664... ok! Erasing sector 757760... ok! Erasing sector 761856... ok! Erasing sector 765952... ok! Erasing sector 770048... ok! Erasing sector 774144... ok! Erasing sector 778240... ok! Erasing sector 782336... ok! Erasing sector 786432... ok! Erasing sector 790528... ok! Erasing sector 794624... ok! Erasing sector 798720... ok! Erasing sector 802816... ok! Erasing sector 806912... ok! Erasing sector 811008... ok! Erasing sector 815104... ok! Erasing sector 819200... ok! Erasing sector 823296... ok! Erasing sector 827392... ok! Erasing sector 831488... ok! Erasing sector 835584... ok! Erasing sector 839680... ok! Erasing sector 843776... ok! Erasing sector 847872... ok! Erasing sector 851968... ok! Erasing sector 856064... ok! Erasing sector 860160... ok! Erasing sector 864256... ok! Erasing sector 868352... ok! Erasing sector 872448... ok! Erasing sector 876544... ok! Erasing sector 880640... ok! Erasing sector 884736... ok! Erasing sector 888832... ok! Erasing sector 892928... ok! Erasing sector 897024... ok! Erasing sector 901120... ok! Erasing sector 905216... ok! Erasing sector 909312... ok! Erasing sector 913408... ok! Erasing sector 917504... ok! Erasing sector 921600... ok! Erasing sector 925696... ok! Erasing sector 929792... ok! Erasing sector 933888... ok! Erasing sector 937984... ok! Erasing sector 942080... ok! Erasing sector 946176... ok! Erasing sector 950272... ok! Erasing sector 954368... ok! Erasing sector 958464... ok! Erasing sector 962560... ok! Erasing sector 966656... ok! Erasing sector 970752... ok! Erasing sector 974848... ok! Erasing sector 978944... ok! Erasing sector 983040... ok! Erasing sector 987136... ok! Erasing sector 991232... ok! Erasing sector 995328... ok! Erasing sector 999424... ok! Erasing sector 1003520... ok! Erasing sector 1007616... ok! Erasing sector 1011712... ok! Erasing sector 1015808... ok! Erasing sector 1019904... ok! Erasing sector 1024000... ok! Erasing sector 1028096... ok! Erasing sector 1032192... ok! Erasing sector 1036288... ok! Erasing sector 1040384... ok! Erasing sector 1044480... ok! Erasing sector 1048576... ok! Erasing sector 1052672... ok! Erasing sector 1056768... ok! Erasing sector 1060864... ok! Erasing sector 1064960... ok! Erasing sector 1069056... ok! Erasing sector 1073152... ok! Erasing sector 1077248... ok! Erasing sector 1081344... ok! Erasing sector 1085440... ok! Erasing sector 1089536... ok! Erasing sector 1093632... ok! Erasing sector 1097728... ok! Erasing sector 1101824... ok! Erasing sector 1105920... ok! Erasing sector 1110016... ok! Erasing sector 1114112... ok! Erasing sector 1118208... ok! Erasing sector 1122304... ok! Erasing sector 1126400... ok! Erasing sector 1130496... ok! Erasing sector 1134592... ok! Erasing sector 1138688... ok! Erasing sector 1142784... ok! Erasing sector 1146880... ok! Erasing sector 1150976... ok! Erasing sector 1155072... ok! Erasing sector 1159168... ok! Erasing sector 1163264... ok! Erasing sector 1167360... ok! Erasing sector 1171456... ok! Erasing sector 1175552... ok! Erasing sector 1179648... ok! Erasing sector 1183744... ok! Erasing sector 1187840... ok! Erasing sector 1191936... ok! Erasing sector 1196032... ok! Erasing sector 1200128... ok! Erasing sector 1204224... ok! Erasing sector 1208320... ok! Erasing sector 1212416... ok! Erasing sector 1216512... ok! 
    All selected sectors erased!
    Writing sector 0x00... ok! Writing sector 0x1000... ok! Writing sector 0x2000... ok! Writing sector 0x3000... ok! Writing sector 0x4000... ok! Writing sector 0x5000... ok! Writing sector 0x6000... ok! Writing sector 0x7000... ok! Writing sector 0x8000... ok! Writing sector 0x9000... ok! Writing sector 0xA000... ok! Writing sector 0xB000... ok! Writing sector 0xC000... ok! Writing sector 0xD000... ok! Writing sector 0xE000... ok! failed with serial.BytesToRead 0 (expected 15)
    The beginning of buffer in UART contains  data.
    Writing sector 0xF000... Writing sector 61440 failed!
    Writing file data to chip failed.
    
  • #21 20870268
    p.kaczmarek2
    Moderator Smart Home
    How your connection looks like? It may be caused by too long wires, too high flashing speed or bad quality power supply used
    Helpful post? Buy me a coffee.
  • #22 20871571
    luebbe
    Level 6  
    OK, so next try today. Thanks for the heads up.
    The baud rate is set to 115200 in the GUI flasher. I haven't tried with the python tool again.
    The wires that I soldered to the device are about 15cm long. I can shorten them, if you think that it helps. The USB cable is ~80cm long.
    Until yesterday I ran the device on the 3.3V provided by the USB->Serial converter, which wasn't strong enough to supply an ESP8266 while flashing.
    Today I used a breadboard power supply which is strong enough for an ESP8266, so it should hopefully also be strong enough for the BK7231N. But it didn't make a difference. Flashing failed at block 0xF000 with the same message as yesterday.

    Quote:

    ... failed with serial.BytesToRead 0 (expected 15)
    The beginning of buffer in UART contains data.
    Writing sector 0xF000... Writing sector 61440 failed!
    Writing file data to chip failed.


    Anything else that I can try?
  • #23 20876167
    p.kaczmarek2
    Moderator Smart Home
    You can try the hid_download_py flasher:


    Helpful post? Buy me a coffee.
  • #24 20884964
    luebbe
    Level 6  
    Unfortunately that doesn't work either. "uartprogram -b 115200 OpenBK7231N_QIO_1.17.360.bin"
    either fails after almost immediately or finishes 2 blocks and hangs at "|##5 |" until I kill it. YMMV.
  • #25 20885081
    p.kaczmarek2
    Moderator Smart Home
    Well, if that's the case, then you most likely power the board incorrectly or have too long wires or use low quality USB to UART converter. We already had situations like this on our forum and it was always either too long wires, or bad power supply, or bad USB to UART converter.
    Helpful post? Buy me a coffee.
  • #26 20902081
    luebbe
    Level 6  
    Thanks for your support. I finally was able to flash the device. First I shortened the wires from 10cm to 5cm, but that didn't help. Then I bought a "DTECH USB to UART TTL cable (3.3v logic level, 1m long)" from Amazon, which arrived yesterday evening.
    Using this cable I was able to flash the device. Looks like my FTDI USB to serial adapter was the cause of the problem although it never failed me with all my ESP projects.
    Now into configuring everything. Thanks again!
  • #27 20905537
    luebbe
    Level 6  
    Another question about the same device: How can I see that the IR receiver is working?
    Following https://www.elektroda.com/rtvforum/topic4021599.html by @Helmi_Beh I set P20 to Btn and P26 ot IRRecv. When I press the button, the LEDs turn on and off and I see a log entry. But when I press a button on the IR remote, nothing happens. The remote is ok. I have an original strip lying next to the one with openbk and this one reacts to the IR commands.

    Is P26 really the correct pin for the IR receiver or is more parameterization needed to see something in the console log?
  • #28 20905552
    p.kaczmarek2
    Moderator Smart Home
    Is IR driver running? Maybe you just need a reboot?
    Helpful post? Buy me a coffee.
  • #29 20906938
    luebbe
    Level 6  
    Indeed. It just needed a reboot.
    In German we (IT people) use to say: "Reboot tut gut", literally "reboot does/is good" :)
    Thanks again.
  • #30 20907216
    p.kaczmarek2
    Moderator Smart Home
    Here you have some sample scripts, some of them are also for IR devices:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/autoexecExamples.md
    Helpful post? Buy me a coffee.

Topic summary

The discussion centers on flashing Casalux LED-RGB WiFi Flexband LED strips (sold at Aldi Süd) with OpenBK firmware to enable MQTT control via iobroker and Alexa integration. Users explored the device's BK7231N chipset, flashing challenges, and configuration extraction. Initial flashing attempts failed due to issues like long wiring, insufficient power supply, and USB-to-UART adapter quality. Success was achieved using a DTECH USB to UART TTL cable with 3.3V logic and shorter wires. The device's Tuya JSON configuration was extracted, revealing PWM frequency at 1000Hz and pin assignments: LED Blue on P7, LED Red on P6, and likely LED Green on P24. IR remote control integration required correct pin setup (P20 as button input, P26 as IR receiver) and rebooting the device to activate the IR driver. Sample autoexec scripts for IR event handling were shared. A newer Aldi version of the strip was noted with different PWM pin mappings: P6 (PWM3), P7 (PWM1), P8 (PWM2), P20 (IRRecv), and an unused P24 (PWM4) pad. Users shared flashing methods including hid_download_py and uartreader tools, and troubleshooting tips for stable flashing and configuration extraction.
Summary generated by the language model.
ADVERTISEMENT