logo elektroda
logo elektroda
X
logo elektroda

Qiachip Smart Switch - BK7231N / CB2S - interior, programming

p.kaczmarek2 64368 288
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • ADVERTISEMENT
  • #92 20147555
    SFMax
    Level 8  
    Firmware is not stable or does not suit every CB2S (BK7231N) device. For example aliexpress Tyua Smart switch device (https://aliexpress.ru/item/1005003717555224.htmlsku_id=12000026918681830&spm=a2g2w.productlist.search_results.34.22782e78rUNe84) fails to work with this firmware. After some time of working passed (amount of time depends on intensity of work with device) it is rebooted on attempts to work with device (reading or writing config, controling relay and so on).
  • #93 20147567
    p.kaczmarek2
    Moderator Smart Home
    I haven't noticed any such issues yet, but indeed, most of my devices are BK7231T. Some of them ran for month without restarting.

    Can you provide more information, UART logs, maybe also check is the memory usage increasing over time? Maybe there is some memory leak.

    Have you checked also earlier version or can you determine when the problem has started?

    Are you using MQTT?

    EDIT: since it seems to be the N-version problem, it might be worth looking into BK7231T and BK7231N SDKs used for compile and trying to determine if something was changed there by Tuya
    Helpful post? Buy me a coffee.
  • #94 20147573
    SFMax
    Level 8  
    00svd00 wrote:
    I've bought two more of these modules
    https://aliexpress.ru/item/1005003596386767.html
    And with FW version OpenBK7231N_QIO_1.12.33 got no problems so far(execpt TCP console - it's still broken, but it doesn't matter alot for me)
    Really great work, thank you very much!


    Hello. Can you explain what is FW version OpenBK7231N_QIO_1.12.33? Is it OpenBK7231N_QIO_1.12.33.bin with 1.16 MB size from https://github.com/openshwprojects/OpenBK7231...download/1.12.33/OpenBK7231N_QIO_1.12.33.bin?

    p.kaczmarek2 wrote:
    Can you provide more information, UART logs, maybe also check is the memory usage increasing over time?


    Sorry but I can't get logs of UART becuase device is not soldered now. Only log of WebApp are available but it seems to look good. In this log "free" number is stable.

    p.kaczmarek2 wrote:
    Have you checked also earlier version or can you determine when the problem has started?


    I started to work with v.1.0.0 and had the same results as with v. 1.12.30

    p.kaczmarek2 wrote:
    Are you using MQTT?


    MQTT is active by default. I've tried to work both with connection to broker and with no broker available. Results are identical.

    It looks like overheating (device is hot enough) or flash memory problem.
  • ADVERTISEMENT
  • #96 20147969
    SFMax
    Level 8  
    00svd00 wrote:
    SFMax wrote:

    Hello. Can you explain what is FW version OpenBK7231N_QIO_1.12.33? Is it OpenBK7231N_QIO_1.12.33.bin with 1.16 MB size from https://github.com/openshwprojects/OpenBK7231...download/1.12.33/OpenBK7231N_QIO_1.12.33.bin?


    Yes, this one. On version 1.12.7 I've got lots of strange bugs, and on 1.12.33 they are all gone


    Unfortunately I have lots of strange bugs in different versions of FW (1.0.0, 1.12.30, 1.12.35) on similar as your (Aubess) devices.
  • #97 20148023
    p.kaczmarek2
    Moderator Smart Home
    How did you get version 1.0.0?

    Strange bugs should be gone with HTTP server fix, just as @00svd00 said.

    It would be good to know what really happens that it crash.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #98 20148034
    00svd00
    Level 8  
    SFMax wrote:
    00svd00 wrote:
    SFMax wrote:

    Hello. Can you explain what is FW version OpenBK7231N_QIO_1.12.33? Is it OpenBK7231N_QIO_1.12.33.bin with 1.16 MB size from https://github.com/openshwprojects/OpenBK7231...download/1.12.33/OpenBK7231N_QIO_1.12.33.bin?


    Yes, this one. On version 1.12.7 I've got lots of strange bugs, and on 1.12.33 they are all gone


    Unfortunately I have lots of strange bugs in different versions of FW (1.0.0, 1.12.30, 1.12.35) on similar as your (Aubess) devices.

    What kind of bugs? With my first switch I had strange problems untill I've flashed full-sized(2mb) firmware to delete all garbage left from official FW.
    You can also try it, but firstly back up your MAC address (it will be gone). Attached last 1.12.33 FW, blown up to 2mb. Flash will finish with CRC mismatch, but it's OK
  • #99 20148200
    SFMax
    Level 8  
    p.kaczmarek2 wrote:
    How did you get version 1.0.0?

    Strange bugs should be gone with HTTP server fix, just as @00svd00 said.

    It would be good to know what really happens that it crash.


    I made my own compilation from github according to instructions from https://github.com/openshwprojects/OpenBK7231N/

    Added after 12 [minutes]:

    00svd00 wrote:
    SFMax wrote:
    00svd00 wrote:
    SFMax wrote:

    Hello. Can you explain what is FW version OpenBK7231N_QIO_1.12.33? Is it OpenBK7231N_QIO_1.12.33.bin with 1.16 MB size from https://github.com/openshwprojects/OpenBK7231...download/1.12.33/OpenBK7231N_QIO_1.12.33.bin?


    Yes, this one. On version 1.12.7 I've got lots of strange bugs, and on 1.12.33 they are all gone


    Unfortunately I have lots of strange bugs in different versions of FW (1.0.0, 1.12.30, 1.12.35) on similar as your (Aubess) devices.

    What kind of bugs? With my first switch I had strange problems untill I've flashed full-sized(2mb) firmware to delete all garbage left from official FW.
    You can also try it, but firstly back up your MAC address (it will be gone). Attached last 1.12.33 FW, blown up to 2mb. Flash will finish with CRC mismatch, but it's OK


    After flashing full-sized firmware I've got Read CRC Failed and WiFi AP is not appeared...
  • #100 20148469
    p.kaczmarek2
    Moderator Smart Home
    SFMax wrote:

    I made my own compilation from github according to instructions from https://github.com/openshwprojects/OpenBK7231N/

    SFMax wrote:

    After flashing full-sized firmware I've got Read CRC Failed and WiFi AP is not appeared...


    Something seems very wrong here, but please provide some basic information first.

    Where do you get "Read CRC failed", from the flash utility (hid_download_py), from Beken chip on boot somehow, or from OpenBeken after OBK boot and tries to read my config structure?

    Can you post screenshot, full log?

    I am compiling with that N version SDK often (not using Github online compilation) and it works correctly.

    The only thing you have to be aware of is that you're supposed to flash QIO version at offset 0 on N platform and UA version at default offset at T platform.

    I have been recently playing with CB3S module and no problems here (about 2 days ago):
    Qiachip Smart Switch - BK7231N / CB2S - interior, programming Qiachip Smart Switch - BK7231N / CB2S - interior, programming Qiachip Smart Switch - BK7231N / CB2S - interior, programming Qiachip Smart Switch - BK7231N / CB2S - interior, programming Qiachip Smart Switch - BK7231N / CB2S - interior, programming Qiachip Smart Switch - BK7231N / CB2S - interior, programming
    It's a TuyaMCU water sensor, MCU enables WiFI module for a minute to send state update to server and then disables WiFi module again.


    
    python uartprogram W:\GIT\OpenBK7231N\apps\OpenBK7231N_App\output\1.0.0\OpenBK7231N_app_QIO_1.0.0.bin --unprotect -d com10 -w --startaddr 0x0
    
    Helpful post? Buy me a coffee.
  • #101 20148513
    00svd00
    Level 8  
    SFMax wrote:
    p.kaczmarek2 wrote:
    How did you get version 1.0.0?

    Strange bugs should be gone with HTTP server fix, just as @00svd00 said.

    It would be good to know what really happens that it crash.


    I made my own compilation from github according to instructions from https://github.com/openshwprojects/OpenBK7231N/

    Added after 12 [minutes]:

    00svd00 wrote:
    SFMax wrote:
    00svd00 wrote:
    SFMax wrote:

    Hello. Can you explain what is FW version OpenBK7231N_QIO_1.12.33? Is it OpenBK7231N_QIO_1.12.33.bin with 1.16 MB size from https://github.com/openshwprojects/OpenBK7231...download/1.12.33/OpenBK7231N_QIO_1.12.33.bin?


    Yes, this one. On version 1.12.7 I've got lots of strange bugs, and on 1.12.33 they are all gone


    Unfortunately I have lots of strange bugs in different versions of FW (1.0.0, 1.12.30, 1.12.35) on similar as your (Aubess) devices.

    What kind of bugs? With my first switch I had strange problems untill I've flashed full-sized(2mb) firmware to delete all garbage left from official FW.
    You can also try it, but firstly back up your MAC address (it will be gone). Attached last 1.12.33 FW, blown up to 2mb. Flash will finish with CRC mismatch, but it's OK


    After flashing full-sized firmware I've got Read CRC Failed and WiFi AP is not appeared...

    For me it worked. At this point, if nothing helps you can try to flash my dump with stock FW and try again from the scratch
  • #102 20148654
    SFMax
    Level 8  
    00svd00 wrote:
    SFMax wrote:
    p.kaczmarek2 wrote:
    How did you get version 1.0.0?

    Strange bugs should be gone with HTTP server fix, just as @00svd00 said.

    It would be good to know what really happens that it crash.


    I made my own compilation from github according to instructions from https://github.com/openshwprojects/OpenBK7231N/

    Added after 12 [minutes]:

    00svd00 wrote:
    SFMax wrote:
    00svd00 wrote:
    SFMax wrote:

    Hello. Can you explain what is FW version OpenBK7231N_QIO_1.12.33? Is it OpenBK7231N_QIO_1.12.33.bin with 1.16 MB size from https://github.com/openshwprojects/OpenBK7231...download/1.12.33/OpenBK7231N_QIO_1.12.33.bin?


    Yes, this one. On version 1.12.7 I've got lots of strange bugs, and on 1.12.33 they are all gone


    Unfortunately I have lots of strange bugs in different versions of FW (1.0.0, 1.12.30, 1.12.35) on similar as your (Aubess) devices.

    What kind of bugs? With my first switch I had strange problems untill I've flashed full-sized(2mb) firmware to delete all garbage left from official FW.
    You can also try it, but firstly back up your MAC address (it will be gone). Attached last 1.12.33 FW, blown up to 2mb. Flash will finish with CRC mismatch, but it's OK


    After flashing full-sized firmware I've got Read CRC Failed and WiFi AP is not appeared...

    For me it worked. At this point, if nothing helps you can try to flash my dump with stock FW and try again from the scratch


    After flashing your dump I've got Write successful and WiFi AP is not appeared again...
  • #103 20148675
    p.kaczmarek2
    Moderator Smart Home
    @SFMax can you please show the debug output of your Beken chip from UART TX pin, the one used for logging?

    At the moment I am not able to help you, I don't even know if your device boots into OpenBeken and fails to create AP, fails to connect, or something else....

    QUICK GUESS: if you're using dump from another user, maybe it has this user SSID and OpenBeken tries to connect to SSID that does not exist so AP don't show up?
    SOLUTION: do 5 quick power on/off cycles to enter Safe Mode and enter new WiFi SSID and passport...
    Helpful post? Buy me a coffee.
  • #104 20148689
    SFMax
    Level 8  
    p.kaczmarek2 wrote:
    @SFMax can you please show the debug output of your Beken chip from UART TX pin, the one used for logging

    How can I get such debug logs from TX?
  • #105 20148701
    p.kaczmarek2
    Moderator Smart Home
    Connect UART RX port o TX2 from the module (not the TX you used for programming; the second TX pin. .There are two UART ports on Beken).
    Helpful post? Buy me a coffee.
  • #106 20148746
    SFMax
    Level 8  
    p.kaczmarek2 wrote:
    Connect UART RX port o TX2 from the module (not the TX you used for programming; the second TX pin. .There are two UART ports on Beken).


    Unfortunately TX2 is not available. CB2S module is soldered flat on other scheme.
    Qiachip Smart Switch - BK7231N / CB2S - interior, programming
  • #107 20148758
    p.kaczmarek2
    Moderator Smart Home
    That's no good. It will be hard to determine what goes wrong.

    Have you tried repowering device 5 times to go into Safe Mode?
    Helpful post? Buy me a coffee.
  • #108 20148763
    SFMax
    Level 8  
    p.kaczmarek2 wrote:
    That's no good. It will be hard to determine what goes wrong.

    Have you tried repowering device 5 times to go into Safe Mode?


    After repowering nothing changes.
  • #109 20148806
    p.kaczmarek2
    Moderator Smart Home
    Ok let's try different approach.
    I created a AP only demo for you (simple BK7231N program, no OBK):
    https://github.com/openshwprojects/OpenBK7231...mmit/15bd888de014ca403e99eda5d5b70104f8a39a82
    compiled it:
    Qiachip Smart Switch - BK7231N / CB2S - interior, programming
    Flashed it to CB3S:
    Qiachip Smart Switch - BK7231N / CB2S - interior, programming
    Qiachip Smart Switch - BK7231N / CB2S - interior, programming
    Qiachip Smart Switch - BK7231N / CB2S - interior, programming
    and it creates AP:
    Qiachip Smart Switch - BK7231N / CB2S - interior, programming


    Please flash this demo app to your device and tell me if a AP shows up.
    Helpful post? Buy me a coffee.
  • #110 20148831
    SFMax
    Level 8  
    p.kaczmarek2 wrote:
    Ok let's try different approach.
    I created a AP only demo for you (simple BK7231N program, no OBK):
    https://github.com/openshwprojects/OpenBK7231...mmit/15bd888de014ca403e99eda5d5b70104f8a39a82
    compiled it:
    Qiachip Smart Switch - BK7231N / CB2S - interior, programming
    Flashed it to CB3S:
    Qiachip Smart Switch - BK7231N / CB2S - interior, programming
    Qiachip Smart Switch - BK7231N / CB2S - interior, programming
    Qiachip Smart Switch - BK7231N / CB2S - interior, programming
    and it creates AP:
    Qiachip Smart Switch - BK7231N / CB2S - interior, programming


    Please flash this demo app to your device and tell me if a AP shows up.


    Is it necessary to flash full-sized (2 MB) firmware with FF at the end or just overwite original flash memory with demo app (1 MB)?
  • #111 20148835
    p.kaczmarek2
    Moderator Smart Home
    i always flash only the QIO generated by build and never had any problems.... I am suprised by @00svd00 experience, that's a new thing to me.
    
    python uartprogram W:\GIT\OpenBK7231N\apps\obk_demo_openAccessPoint\output\git\obk_demo_openAccessPoint_QIO_git.bin --unprotect -d com10 -w --startaddr 0x0
    pause
    

    You are the first ones to report such issues.

    EDIT: it's almost as like you're both doing something wrong, I don't know, but still, maybe something changed in the firmware or I made some kind of bug that I am not aware of yet... still, very strange. Other users also tested N version and there were no such issues with 0xFF and flashing

    EDIT2: Maybe at one point you
    a) flashed UA at wrong offset (zero) and overwrote bootloader?
    b) flashed QIO at wrong offset (non-zero?) (but it should be recoverable)
    well, no idea
    Helpful post? Buy me a coffee.
  • #112 20148839
    SFMax
    Level 8  
    p.kaczmarek2 wrote:
    i always flash only the QIO generated by build and never had any problems.... I am suprised by @00svd00 experience, that's a new thing to me.
    
    python uartprogram W:\GIT\OpenBK7231N\apps\obk_demo_openAccessPoint\output\git\obk_demo_openAccessPoint_QIO_git.bin --unprotect -d com10 -w --startaddr 0x0
    pause
    

    You are the first ones to report such issues.

    EDIT: it's almost as like you're both doing something wrong, I don't know, but still, maybe something changed in the firmware or I made some kind of bug that I am not aware of yet... still, very strange. Other users also tested N version and there were no such issues with 0xFF and flashing

    EDIT2: Maybe at one point you
    a) flashed UA at wrong offset (zero) and overwrote bootloader?
    b) flashed QIO at wrong offset (non-zero?) (but it should be recoverable)
    well, no idea


    I backup my original firmware first and then flash obk_demo_openAccessPoint_QIO_git.bin. OpenBK2731N_WiFi_Demo is appeared and I can connect to it but nothing is available by ip 192.168.4.1.
  • #113 20148845
    p.kaczmarek2
    Moderator Smart Home
    SFMax wrote:
    [
    OpenBK2731N_WiFi_Demo is appeared

    This is good news.

    SFMax wrote:
    [
    nothing is available by ip 192.168.4.1.

    it is OK, as said, it's only AP demo... it's not OpenBeken.... it's just to test if your device boots.

    Ok, now, can you send me your firmware backup so I will flash to my CB3S and see if it boots?
    Helpful post? Buy me a coffee.
  • #114 20148851
    SFMax
    Level 8  
    p.kaczmarek2 wrote:

    Ok, now, can you send me your firmware backup so I will flash to my CB3S and see if it boots?


    Ok. File is attached. It is probably the same as you sent as demo.
  • ADVERTISEMENT
  • #115 20148854
    p.kaczmarek2
    Moderator Smart Home
    To be clear - I meant I want your firmware dump with the OpenBeken that does not boot, not my AP demo back. Preferrably full 2MB.

    I see no other way of testing why it doesn't boot for you... of course this test assumes that our chips and setups are identical and that the culprit is in the flash.

    Also, please do the read from 0x0 offset, when you do backup. Because if you do read from 0x11000 or so, and I flash it to 0x0, I might brick my device.
    Helpful post? Buy me a coffee.
  • #116 20148875
    SFMax
    Level 8  
    p.kaczmarek2 wrote:
    To be clear - I meant I want your firmware dump with the OpenBeken that does not boot, not my AP demo back. Preferrably full 2MB.

    I see no other way of testing why it doesn't boot for you... of course this test assumes that our chips and setups are identical and that the culprit is in the flash.

    Also, please do the read from 0x0 offset, when you do backup.


    I restore original firmware again and then flash OpenBK7231N_QIO_1.12.36.bin. Device is booted, AP is appeared and I could made some config (Name, Mac, Pins) except WiFi settings in Web OpenBeken.

    For backup I use BekenWriterV1.60 and set settings:
    Start address - 0x00000000
    Operate length - 0x00200000.
    Reading is made by button "Read flash".

    UPD: After restarting device AP disappeared (WiFi fields are empty).
  • #117 20148883
    00svd00
    Level 8  
    p.kaczmarek2 wrote:
    i always flash only the QIO generated by build and never had any problems.... I am suprised by @00svd00 experience, that's a new thing to me.
    
    python uartprogram W:\GIT\OpenBK7231N\apps\obk_demo_openAccessPoint\output\git\obk_demo_openAccessPoint_QIO_git.bin --unprotect -d com10 -w --startaddr 0x0
    pause
    

    You are the first ones to report such issues.

    EDIT: it's almost as like you're both doing something wrong, I don't know, but still, maybe something changed in the firmware or I made some kind of bug that I am not aware of yet... still, very strange. Other users also tested N version and there were no such issues with 0xFF and flashing

    EDIT2: Maybe at one point you
    a) flashed UA at wrong offset (zero) and overwrote bootloader?
    b) flashed QIO at wrong offset (non-zero?) (but it should be recoverable)
    well, no idea

    For me with latest FW version there was no need to make full flash. Everything was OK without that step. I thought that some devices(my first one for example) may have defective flash memory and full reflash can somehow fix it
  • #118 20148885
    p.kaczmarek2
    Moderator Smart Home
    SFMax wrote:

    I restore original firmware again and then flash OpenBK7231N_QIO_1.12.36.bin. Device is booted, AP is appeared and I could made some config (Name, Mac, Pins) except WiFi settings in Web OpenBeken.

    I don't understand. What do you mean "could make name/pin/mac config" but except for WiFi?
    a) wifi page does not load?
    b) wifi page does not safe entered data in fields?
    c) ...? idk

    SFMax wrote:

    UPD: After restarting device AP disappeared (WiFi fields are empty).

    If wifi fields are empty, then AP show still show up.

    Can you check your router DHCP clients list, maybe the device is actually there but you just didn't notice it?
    Helpful post? Buy me a coffee.
  • #119 20149069
    SFMax
    Level 8  
    p.kaczmarek2 wrote:

    I don't understand. What do you mean "could make name/pin/mac config" but except for WiFi?

    I just mean that I left WiFi settings empty. Page was working correctly.

    p.kaczmarek2 wrote:

    If wifi fields are empty, then AP show still show up.

    No. Something went wrong and AP disappeared. When I tried to reset device by repowering AP appeared for sometime and then disappeared quickly. So I could not connect to device anymore.

    p.kaczmarek2 wrote:

    Can you check your router DHCP clients list, maybe the device is actually there but you just didn't notice it?


    Device is not present in router list. WiFiled is blinking fast.


    UPDATE:
    AP disappearing was caused by changing MAC address to random one.
    I've reflashed device one more time the same way and tried to leave original MAC. Now AP is working correctly (even after restarting of device). But after some time of work when I power device by 220V (not by 3.3V and GND pins) and start to work intensively (saving pins, name, mqtt settings more than one time, toggling relay state, watching WebApp log) device was rebooted (or just disconnected from WiFi connection as AP) one moment and than it began to be rebooted (or just disconnected from WiFi connection as AP) on some random actions (some time on attempt to open pin config page, some time on toggling relay state and so on). After every rebooting (disconnection) it is still available as AP and IP address - 192.168.4.1 and I need to reconnect again. More actions I make more often rebooting (disconnection) of device I have.
    I made new full dump of flash memory (2 MB).
  • #120 20149206
    p.kaczmarek2
    Moderator Smart Home
    I have tested your flash and it seems there is a certain MAC address issue which later causes the the AP to be non-connectable for my router. My router fails to connect to AP that has 00 00 etc mac.

    Qiachip Smart Switch - BK7231N / CB2S - interior, programming

    It seemed like MAC flash sector was broken, but I don't know if it was wrong in the first place or did it break during the 0xFF overwrite made by @00svd00 if I remember correctly.

    I changed MAC code handling and moved whole MAC storage to our CFG struct on N platform. So broken flash won't cause wrong MAC any more.

    It works for me now:
    Qiachip Smart Switch - BK7231N / CB2S - interior, programming
    Qiachip Smart Switch - BK7231N / CB2S - interior, programming
    Qiachip Smart Switch - BK7231N / CB2S - interior, programming
    Device connects to wifi, reconnects, etc.

    Can you try this QIO firmware update?
    Helpful post? Buy me a coffee.

Topic summary

The discussion revolves around the Qiachip Smart Switch utilizing the BK7231N chip and the CB2S module, focusing on programming, firmware flashing, and integration with Home Assistant. Users share experiences with flashing the device using various tools like hid_download_py and uartprogram, troubleshooting issues such as connection problems, firmware compatibility, and device reboots. Key challenges include configuring WiFi settings, handling relay operations, and ensuring stable operation with different firmware versions. The community provides insights on soldering techniques, pin configurations, and the importance of power supply stability. Additionally, there are discussions about integrating DHT sensors and the need for improved firmware features.
Summary generated by the language model.
ADVERTISEMENT