logo elektroda
logo elektroda
X
logo elektroda

Uploading OpenBK7231N on the roller shutter controller FS-03W CB2S (BK7231N)

Nargo 1200 22
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 20787763
    Nargo
    Level 22  
    I have acquired such a controller for roller shutters:
    Roller blind controller with manual on a table. Roller blind controller on a table Roller shutter controller on a wooden table. Photo of an electronic controller circuit board on a wooden surface. Side view of a shutter control module.
    I soldered the chip, connected it to the programmer:
    Microcontroller with connected wires on a wooden background. Blue circuit board with various electronic components. Roller shutter controller with connected wires and tools on a table.
    I backed up with BK7231Flasher and started uploading OpenBK7231N_QIO_1.17.291.bin.
    After a while the program dumped me something like this:
    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.


    I tried to upload the backup - same thing.

    I tried to upload BK_writer:
    Flash ID:0x00000000
    Time:15.594s
    Speed of Programm:921600bps
    Init...FAILED


    I have no idea.
  • ADVERTISEMENT
  • #2 20787862
    p.kaczmarek2
    Moderator Smart Home
    Hello, have you tried reducing the baud rate?
    And maybe hid_download_py will work?
    [youtube]
    https://www.youtube.com/watch?v=0V0kaRVnk18
    [/youtube]





    And also those wires.... It might be worth shortening them a bit. There have already been situations on the forum that it was the length of the wires that got in the way.
    And the power supply on the 3.3V picture comes from some good LDO providing sufficient current or where from?
    Helpful post? Buy me a coffee.
  • #3 20788010
    Nargo
    Level 22  
    Only on such a cobweb was it possible to upload this OpenBK7231N_QIO_1.17.11 soft
    Microcontroller connected to a computer via USB cables and electronic wires.

    CRC matches 0x1A2FDBD2!
    Writing file data to chip successs.

    Then I will solder in the circuit and check if it works properly.
  • ADVERTISEMENT
  • #4 20788018
    p.kaczmarek2
    Moderator Smart Home
    Now it would only be useful to know whether using hid_download_py or shortening the wires helped. Hid_download_py miscounts CRC so for N the error can be ignored
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #5 20788025
    Nargo
    Level 22  
    Flashing BK7231 Easy UART Flasher.
  • #6 20788029
    p.kaczmarek2
    Moderator Smart Home
    So did the length of the wires cause a problem though?
    Helpful post? Buy me a coffee.
  • #7 20788044
    Nargo
    Level 22  
    I don't know myself.
    I powered from the programmer to the ESP-01, didn't go. (The previous one did.)
    Powered from the power supply for the contact boards, it did not go.
    Powered from the WEMOSd1Mini, it did not go.
    It only worked on the programmer from the ESP and the power supply from the latter (YP-05).

    And also not versions 1.17.291 and 1.17.15, but versions 1.17.11

    Also black magic is at work, but I have already recently succeeded with Tasmota and the drivers for AHT20.

    EDIT:
    I am looking at the pictures and it appears to me that this module is a mirror image of CB2S on the power side.
  • #8 20788085
    p.kaczmarek2
    Moderator Smart Home
    Nargo wrote:
    Yes I'm looking at the pictures and it appears to me that this module is a mirror image of the CB2S on the power side.
    Wait, the lettering on the description layer doesn't match those on the Tuya documentation?
    If so then please check how it was soldered! Diagram of the CB2S integrated circuit with labeled pins: CEN, ADC, P8, P7, P6. Diagram of a board with pin labels 3V3, GND, RX1, TX1, P24, P26. Diagram of a board with pin labels 3V3, GND, RX1, TX1, P24, P26. I am familiar with this problem. I have seen a series of devices with CB2S where there was a bad description layer reflected, the pins were wrongly signed, so GND was not GND, and 3.3V was not 3.3V
    Wrong connection of such a module can damage it!
    Please check and verify everything with where the 3.3V and GND on the motherboard.

    Added after 1 [minutes]:

    @Nargo in my opinion you have a module with a badly bounced description layer, in Tuya's documentation there are correct leads, if you haven't burned it yet it's just a fart, thanks to the fact that GPIO has protective diodes to ground and power supply
    Helpful post? Buy me a coffee.
  • #9 20788094
    Nargo
    Level 22  
    You don't start a sentence with "So".
    So I soldered the chip in after programming, it fired up, updated and the relays on P6 and P7 are working, the LED on P24, the button on P26.
    I just can't figure out where the status of the roller shutter buttons appear.
  • #10 20788113
    p.kaczmarek2
    Moderator Smart Home
    Execute and post the result:
    https://www.youtube.com/watch?v=WunlqIMAdgw
    Helpful post? Buy me a coffee.
  • #11 20788227
    Nargo
    Level 22  
    It doesn't go.
    Error message stating that the given binary is an erased flash sector, full of 0xFF. .
  • #12 20788229
    p.kaczmarek2
    Moderator Smart Home
    Then take the first backup you have and drag and drop it onto the flasher
    Helpful post? Buy me a coffee.
  • #13 20788283
    Nargo
    Level 22  
    Failed to extract Tuya keys - magic constant header not found in binary
    It seems that dragged binary is full of 0xff, someone must have erased the flash
    Failed to extract Tuya keys - magic constant header not found in binary
    It seems that dragged binary is full of 0xff, someone must have erased the flash
    Failed to extract Tuya keys - magic constant header not found in binary
    It seems that dragged binary is full of 0xff, someone must have erased the flash
    Failed to extract Tuya keys - magic constant header not found in binary
    Failed to extract Tuya keys - magic constant header not found in binary
    Failed to extract Tuya keys - magic constant header not found in binary
    Failed to extract Tuya keys - magic constant header not found in binary
    .
  • #14 20788292
    p.kaczmarek2
    Moderator Smart Home
    Open the file in a hex editor. It looks like it is full of 0xff itself. This is not a valid backup.

    Maybe better to use GPIODoctor and by method of elimination check what of the CB2S pins are not used yet. Also delete the ones that are not soldered on the PCB. There won't be many options left.

    And what device model is written on the housing of this relay?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #15 20788321
    Nargo
    Level 22  
    Smart curtain controller model FS-03W with technical specifications and connectors.


    Smart Curtain Controller

    "pins": {
    "6": "Rel;1",
    "7": "Rel;2",
    "10": "dInput_n;1",
    "11": "dInput_n;2",
    "24": "LED_n;3",
    "26": "dInput;0"
    },

    Now still to find how to configure this as a roller shutter controller and it will be GIT.
  • #16 20788350
    p.kaczmarek2
    Moderator Smart Home
    FS-03W, this is important information. Model name.

    We do not have a ready-made system for roller shutters in the firmware. I do not have roller shutters at my home so I had no way to prepare it. We can either e.g. prepare it together (if you know C or at least want to test a bit) or we can use ready scripts from other users:
    https://www.elektroda.com/rtvforum/topic3972935.html
    Helpful post? Buy me a coffee.
  • #17 20788804
    Nargo
    Level 22  
    This came out of the "first, first" Backup.
    {
    	"rl1_lv":"1",
    	"bt1_pin":"10",
    	"on_off_cnt":"10",
    	"onoff_rst_m":"0",
    	"rl3_pin":"7",
    	"rl3_lv":"1",
    	"onoff_clear_t":"10",
    	"travel_calibra1":"3",
    	"reverse_ctrl1":"8",
    	"net_trig":"4",
    	"dev_ctrl1":"1",
    	"netled1_lv":"0",
    	"jv":"101",
    	"travel_t":"10",
    	"onoff_rst_type":"1",
    	"delay_t":"300",
    	"total_bt_pin":"26",
    	"nety_led":"1",
    	"bt3_lv":"0",
    	"bt1_lv":"0",
    	"bt_reuse":"1",
    	"reset_t":"5",
    	"netled1_pin":"24",
    	"travel_t1":"10",
    	"net_type":"0",
    	"bt3_pin":"11",
    	"module":"CB2S",
    	"percent_ctrl1":"2",
    	"onoff_type":"2",
    	"total_bt_lv":"0",
    	"ch_num":"1",
    	"rl1_pin":"6",
    	"netn_led":"0",
    	"crc":"44",
    	"} ).Agw_wsm{nc_tp":"0",
    	"ssid":"null",
    	"passwd":"null",
    	"md":"0",
    	"random":"0",
    	"wfb64":"1",
    	"stat":"0",
    	"token":"null",
    	"region":"null",
    	"reg_key":"null",
    	"dns_prio":"0 }{uuid",
    	"psk_key":"c1ocYrc0oM3dvMQbOTTu5gHAP1v3HZfSjxgzt",
    	"auth_key":"qGUEHBpOLMAVfZCDHaGLqalmiV6r3WvN",
    	"ap_ssid":"SmartLife",
    	"ap_passwd":"null",
    	"country_code":"null",
    	"bt_mac":"null",
    	"bt_hid":"null",
    	"prod_test":"false",
    	"fac_pin":"enrribhu0xheehid }{nc_tp"
    }
    



    Device configuration, as extracted from Tuya: 
    - Button (channel 1) on P10
    - Relay (channel 3) on P7
    - Pair/Toggle All Button on P26
    - WiFi LED on P24
    - Button (channel 3) on P11
    - Relay (channel 1) on P6
    Device seems to be using CB2S module, which is using BK7231N.
    And the Tuya section starts, as usual, at 2023424
    

    Quote:
    We don't have a ready-made system for roller shutters in the firmware. I do not have roller shutters at my place so I had no way to prepare it. We can either e.g. prepare it together (if you know C or at least want to test it a bit)

    I would be happy to learn new things.
    I can test it as time allows. I used to write something there.
  • #18 20789621
    p.kaczmarek2
    Moderator Smart Home
    So there was a first-first backup after all, just as I thought. That's good.

    I would like to add this device to https://openbekeniot.github.io/webapp/devicesList.html , could you provide where you bought it, maybe some screenshots from the auction?

    What about the roller shutter controller, what functionalities are needed? Are we trying to do something like in Tasmota?
    Helpful post? Buy me a coffee.
  • #19 20789687
    Nargo
    Level 22  
    Auction photo
    Image of a smart curtain switch on an online auction with price and description.

    Link to purchase


    I purchased together with AHT20+BMP280 modules on 14 day delivery. Purchase 8-09-2023 delivery 18-09-2023.

    Functionality-wise, suggesting the current roller shutter controller:
    Zamel SRP-02 controller
    Quote from manual:
    Quote:
    A short press (<2 s) on a transmitter button programmed in local mode,
    or a blind switch (optional), starts the movement of the roller shutter
    in the given direction. Briefly pressing the same button or
    switch again, stops the roller shutter at the set height. Longer pressing
    (>2 s) of the button or switch, activates the comfort mode
    (the roller shutter starts moving in the given direction and stops after the programmed
    time).
    Short pressing of the transmitter button programmed in the central mode
    activates full raising or lowering of the roller shutter.

    Quote:
    Convenience modes allow you to
    set the position of the roller shutter in a fixed
    position (at a fixed height) and
    store this position.
    Flexible modes allow you to
    set the position of the roller shutter in a fixed
    position (at a fixed height) and
    store this position.
  • Helpful post
    #21 20894773
    Nargo
    Level 22  
    In view of the FREE day modifying the script from this thread I came up with something like this:
    // Set up Aliases
    alias Set_Stop backlog setChannel 5 0; setChannel 6 0; setButtonColor 3 red; setButtonColor 2 red; setButtonColor 1 red
    alias Set_Finish backlog setButtonColor 2 blue
    alias Start_Opening backlog stopAllScripts; startScript autoexec.bat openSkylight
    alias Start_Closing backlog stopAllScripts; startScript autoexec.bat closeSkylight
    alias Stop_All backlog stopAllScripts; startScript autoexec.bat stopSkylight
    
    // Channel 60 is seconds for power to be applied
    setChannel 60 25
    
    // create GUI buttons for HTTP panel
    startDriver httpButtons
    
    setButtonEnabled 1 1
    setButtonLabel 1 "Open"
    setButtonCommand 1 Start_Opening
    setButtonColor 1 red
    
    setButtonEnabled 2 1
    setButtonLabel 2 "Stop"
    setButtonCommand 2 Stop_All
    setButtonColor 2 red
    
    setButtonEnabled 3 1
    setButtonLabel 3 "Close"
    setButtonCommand 3 Start_Closing
    setButtonColor 3 red
    
    // Hide the default GUI buttons
    setChannelVisible 5 0
    setChannelVisible 6 0
    setChannelVisible 3 1
    
    // Loading Event Handlers
    addChangeHandler Channel1 == 1 Start_Closing
    addChangeHandler Channel2 == 1 Start_Opening
    
    // Close Skylight on power up
    goto stopSkylight
    
    // do not proceed
    return
    
    openSkylight:
    setChannel 6 0
    setButtonColor 3 red
    delay_s 0.1
    toggleChannel 5
    setButtonColor 1 blue
    setChannel 2 0
    delay_s $CH60
    Set_Stop
    Set_Finish
    delay_s 3
    Set_Stop
    return
    
    closeSkylight:
    setChannel 5 0
    setButtonColor 1 red
    delay_s 0.1
    toggleChannel 6
    setButtonColor 3 blue
    setChannel 1 0
    delay_s $CH60
    Set_Stop
    Set_Finish
    delay_s 3
    Set_Stop
    return
    
    stopSkylight:
    Set_Stop
    Set_Finish
    delay_s 3
    Set_Stop
    return


    At the moment I have raising/lowering 100% with stopping at any time from physical buttons as well as from HA

    Channels 1 and 2 physical buttons
    Channels 5 and 6 roller shutter relays
  • #22 20896568
    Nargo
    Level 22  
    After testing, it appears that the above code does not work as intended.
    I rewrote everything
    alias akcja1 backlog stopAllScripts; startScript autoexec.bat rusz1
    alias akcja2 backlog stopAllScripts; startScript autoexec.bat rusz2
    alias akcja3 backlog setChannel 6 0; setChannel 5 1; setChannel 10 1; setChannel 60 25 
    alias akcja4 backlog setChannel 5 0; setChannel 6 1; setChannel 10 1; setChannel 60 25
    alias akcja_stop backlog setChannel 6 0; setChannel 5 0; setChannel 10 0; ; setChannel 60 1
    alias akcja50 setChannel 60 7
    
    
    //Channel 1 - wejście 1
    //Channel 2 - wejście 2
    
    //Channel 5 - wyjście 1
    //Channel 6 - wyjście 2
    //Channel 10 - stan 1 jakiekolwiek wyjście ON/ stan 0 jakiekolwiek wyjście OFF
    
    //Channel 60 - czas pełnego otwarcia 25s
    //Channel 60 - czas częściowego otwarcia 8s
    //Channel 60 - czas po zatrzymaniu 1s
    
    addChangeHandler Channel1 == 1 akcja1
    addChangeHandler Channel2 == 1 akcja2
    //Przyciski
    startDriver httpButtons
    
    setButtonEnabled 1 1
    setButtonLabel 1 "Open"
    setButtonCommand 1 akcja1
    setButtonColor 1 "#ff0000"
    
    setButtonEnabled 2 1
    setButtonLabel 2 "Close"
    setButtonCommand 2 akcja2
    setButtonColor 2 "#ff0000"
    
    // nic nie rób 
    goto start
    return
    
    rusz1:
    setButtonColor 1 "#0000ff"
    if $CH10==1 then akcja_stop else akcja3
    delay_s 0.1
    setButtonColor 1 "#ff0000"
    delay_s 1
    if $CH1==1 then akcja50 
    delay_s $CH60
    akcja_stop
    return
    
    rusz2:
    setButtonColor 2 "#0000ff"
    if $CH10==1 then akcja_stop else akcja4
    delay_s 0.1
    setButtonColor 2 "#ff0000"
    delay_s 1
    if $CH2==1 then akcja50 
    delay_s $CH60
    akcja_stop
    return
    
    start:
    akcja_stop
    setButtonColor 1 "#ff0000"
    setButtonColor 2 "#ff0000"
    return

    Now it works as follows:
    Short press (up to 1s) roller shutter up/down 100% (25s)
    Long press (over 1s) roller shutter up/down about 40% (8s)
    Second click with any key during operation stops roller shutter motor.

    As soon as there is enough time before the kids return from school, I will install and check on the roller shutter.
  • #23 21547844
    io2345
    Level 7  
    Nargo wrote:

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


    What I don't understand: How can the device use P10 and P11, if there are no P10 and 11 on a CB2S available (see Tuya Schematics above in #8)???

Topic summary

The discussion revolves around uploading the OpenBK7231N firmware onto the FS-03W CB2S roller shutter controller, which utilizes the BK7231N chip. The user successfully backed up the firmware using BK7231Flasher and attempted to upload OpenBK7231N_QIO_1.17.291.bin. Several users suggested troubleshooting steps, including reducing the baud rate, checking wire lengths, and ensuring proper power supply connections. The user later confirmed successful flashing with version 1.17.11 and noted that the relays and LED indicators functioned correctly. However, issues arose with the configuration of roller shutter buttons and the extraction of Tuya keys, indicating potential problems with the binary file. The conversation also included references to the need for custom scripts to enable roller shutter functionalities, as existing firmware lacked this capability.
Summary generated by the language model.
ADVERTISEMENT