logo elektroda
logo elektroda
X
logo elektroda

I flashed my switch that has a BK7231N chip on it,. Now what?

mannsteve 1695 18
ADVERTISEMENT
  • #1 20405536
    mannsteve
    Level 6  
    I flashed my switch that has a BK7231N chip on it, got the configuration menu at 192.168.4.1, added my WiFi credentials.

    Now what?

    I restarted the switch, but there is no new IP on my local network. How do I configure my GPIO pins?
  • ADVERTISEMENT
  • #2 20405637
    p.kaczmarek2
    Moderator Smart Home
    Is your WiFi 2.4Ghz? What does the UART log at TX2 say?
    Helpful post? Buy me a coffee.
  • #3 20406242
    mannsteve
    Level 6  
    p.kaczmarek2 wrote:
    Is your WiFi 2.4Ghz? What does the UART log at TX2 say?


    Yes, 2.4GHz. I am flashing the KS602S using this (https://www.elektroda.com/rtvforum/topic3944647.html#20355154) as a guide.

    It worked once!
    Do you mean TxD2? The KS602S is not using a carrier board, the naked chip is on the PCB and I don't know if TxD2 is broken out. The UART that was used to flash the device just reports gibberish at 115200 baud.

    While I was replying, I flashed again and a few minutes later I noticed that the device AP was once again available. I went to the WiFi settings again and entered the WiFi credentials again, and I am back to where this thread started:

    Reboot the device, wait a minute then do an IP scan on my network. Again, the MAC address did not appear in the scan (and the device AP is gone as well).

    I am sure I have misread a step. When I flash an ESP the device always appears on my net scan after restarting the device.

    It appears that I have two threads on this forum for this matter. I am unfamiliar with the topology here but I will try to remain in this thread.

    Your assistance is appreciated.


    UPDATE
    I discovered that if I power-cycle the KS602S device 6 times, the device resets and the AP at 192.168.4.1 is back.
    In the home page, it says, in red, "You are in safe mode (AP mode) because full reboot failed 0 times".

    Am I in the right place? Where next?

    I flashed my switch that has a BK7231N chip on it,. Now what?
  • ADVERTISEMENT
  • #4 20406386
    p.kaczmarek2
    Moderator Smart Home
    @mannsteve , it seems you are experiencing a rare wifi issue. It seems wifi connect fails for you. There are basically two things you can do.

    it is also possible that your wifi has strange configuration, not supported encryption, etc. Do other obk devices work for you?

    1. connect uart to TXD2 and get uart log, but i have read your linked topic and it seems TXD2 has no easy access
    2. do a full 2MB flash dump for me (for analysis), maybe set wifi password to garbage first if you are worried about leaking it, and then flash a dump from myself and see if it behaves better.
    CB2S hid_download_py backup (firmware read 2MB) and writing firmware binary tutorial is here:


    I flashed my switch that has a BK7231N chip on it,. Now what?
    In the following attachment, there are two bin files, try flashing both of them, do any of them connects to your wifi? You will need to reconfigure WiFi pass in safe mode. In order to get into safe/configuration mode, you need to do 5 quick reboots. In order to get out of safe mode, you need wait for the device to run without resets for more than 30 seconds.
    Helpful post? Buy me a coffee.
  • #5 20406755
    mannsteve
    Level 6  
    ... Do other obk devices work for you?
    This is my first exposure to Belkin devices. I do have another new switch (they came in pairs) that I haven't flashed yet.

    ... do a full 2MB flash dump for me (for analysis),
    I am using the Windows exe program- BK7231Flasher.exe. Is the backup file the one you want to look at?

    CB2S hid_download_py backup
    What is CB2S?

    In the following attachment, there are two bin files, try flashing both of them, do any of them connect to your wifi?
    Yes. FullFW.bin did accept my WiFi credentials and the index page is viewable on my local network:

    I flashed my switch that has a BK7231N chip on it,. Now what?

    I have NOT tried SFMax.bin, but I will if it would provide you with useful information. Otherwise, I will proceed with this binary if you don't have any issue. Now I just need to figure out the MQTT configuration for the KS602S.

    HOWEVER....
    Did the MAC address change??
    When I first started I noted the MAC address of the Belkin chip as A0:92:08:43:44:F4, and this was the MAC address I had been looking for in my IP scan. (I have over 100 devices on my network, so searching for the MAC is easiest). But after flashing FullFW.bin and entering my WiFi credentials, I noticed a new MAC address:

    I flashed my switch that has a BK7231N chip on it,. Now what?

    This new MAC address was in my IP scan and when I opened the IP address for the device I got the configuration screen. I am now wondering if I was looking for the wrong MAC address using the latest release OpenBK7231N_QIO_1.15.391.bin ??? Should I go back and try .391.bin?

    You will need to reconfigure WiFi pass in safe mode. In order to get into safe/configuration mode, you need to do 5 quick reboots. In order to get out of safe mode, you need to wait for the device to run without resets for more than 30 seconds.

    Good information to know.
    I do appreciate your help.

    Added after 3 [hours] 42 [minutes]:

    UPDATE
    I opened the new unflashed switch and soldered headers on it. Connected to the UART and used BK7231Flasher.exe to flash it with FullFW.bin.
    Flash completed without error, and in 192.168.4.1 I entered my WiFi credentials.
    And, after restarting the switch, the device did not show in my IP scan.
    The same with SFMax.bin or OpenBK7231N_QIO_1.15.391.bin
    The second switch does not connect to my WiFi regardless of which .bin was flashed.
  • #6 20407317
    p.kaczmarek2
    Moderator Smart Home
    CB2S is a name of WiFi module with BK7231N.

    You seem to be experiencing a rare issue where RF calibration partition (or something further in memory, after the firmware binary) is not compatible with our SDK.

    It is currently unknown why it happens exactly, do both of your switches come from the same batch?

    The FullFW has cleared RF config, that's why MAC is lost.

    To recreate MAC, go to Open Web Application, and then in Flash tab do "Restore RF config":
    I flashed my switch that has a BK7231N chip on it,. Now what?




    mannsteve wrote:

    I opened the new unflashed switch and soldered headers on it. Connected to the UART and used BK7231Flasher.exe to flash it with FullFW.bin.
    Flash completed without error, and in 192.168.4.1 I entered my WiFi credentials.
    And, after restarting the switch, the device did not show in my IP scan.
    The same with SFMax.bin or OpenBK7231N_QIO_1.15.391.bin
    The second switch does not connect to my WiFi regardless which .bin was flashed.

    IMPORTANT !!! The FullFW.bin hack will not work on two devices unless you use Restore RF config to change MAC!
    Otherwise you will get two devices with the SAME MAC on your network! And router will act crazy. That way people can lose a lot of time debugging strange issues!
    Please turn off the second FullFW.bin device, restart router, do Restore RF partition for first device, restart router, and then you can pair second one

    I am really sorry that you are unlucky enough to get that bug. Please tell us, are you able to determine what kind of BK7231N batch you have? Is it a new batch from factory or old batch? It would help us diagnose when issues like yours happen.

    My N bulbs are stable and online for 2 months already:
    I flashed my switch that has a BK7231N chip on it,. Now what?
    Helpful post? Buy me a coffee.
  • #7 20407334
    mannsteve
    Level 6  
    "IMPORTANT !!! The FullFW.bin hack will not work on two devices unless you use Restore RF config to change MAC!"

    I figured out that the MAC was being set in FullFW.bin, but when I was trying to bring the second unit online, the first unit was completely disconnected, so there were no conflicting MAC addresses.

    "It is currently unknown why it happens exactly, do both of your switches come from the same batch?"
    They came in one package from Amazon last November. My prior purchase was in 2018 and those switches have an ESP8266 chip.

    Is it safe to use the FullFW.bin in the switches as long as I give each a unique MAC address?
    Of the two switches, only one connects to the WiFi.

    The switch flashed with FullFW.bin seems to be working as expected. I reassembled the switch and wired it with a power cord and light load and everything, including MQTT commands are working.

    The binary is possibly an older one because it doesn't have MQTT discovery for Home Assistant. I put the Home Assistant yaml code into my mqtt.yaml file, but I am not seeing the switch in config/devices.
  • #8 20407560
    p.kaczmarek2
    Moderator Smart Home
    If switch is working, then you can easily do OTA to latest version by RBL file.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #9 20408226
    mannsteve
    Level 6  
    p.kaczmarek2 wrote:
    If switch is working, then you can easily do OTA to latest version by RBL file.


    I thought that the latest version was the problem? Or do I only need the FullFW.bin to get the device to connect to my network?

    What's an RBL file? (OpenBK7231N_QIO_1.15.391.bin ?). Is it safe to OTA this from BK7231Flasher.exe?

    And, a new (minor) problem has appeared that was working yesterday. When I toggle the switch from the button or from MQTT, the status on the main menu doesn't change. If I toggle from the menu page, the status tracks.

    This appeared after I changed the device name from "Utility Room Light" to "UtilityRoom-Light". I changed the name back to the original but the status still doesn't track.

    Your continued support is greatly appreciated.
  • #10 20408240
    p.kaczmarek2
    Moderator Smart Home
    mannsteve wrote:

    I thought that the latest version was the problem? Or do I only need the FullFW.bin to get the device to connect to my network?

    Full FW was only needed to clear the RF partition (which also cleared MAC), now device can be updated.

    This is the rare problem which we haven't fully figured out yet, but there have been around, idk, 4 cases (including yours) where a certain CB2S batch has something strange in RF partition which WiFi library used by us.


    mannsteve wrote:


    What's an RBL file? (OpenBK7231N_QIO_1.15.391.bin ?). Is it safe to OTA this from BK7231Flasher.exe?

    It's only for UART. RBL is here:
    I flashed my switch that has a BK7231N chip on it,. Now what?
    https://github.com/openshwprojects/OpenBK7231T_App/releases/


    mannsteve wrote:

    And, a new (minor) problem has appeared that was working yesterday. When I toggle the switch from the button or from MQTT, the status on the main menu doesn't change. If I toggle from the menu page, the status tracks.

    for me, it autorefreshes after few second. Does the status change if you hit "Refresh"?

    mannsteve wrote:

    This appeared after I changed the device name from "Utility Room Light" to "UtilityRoom-Light". I changed the name back to the original but the status still doesn't track.

    or wait, disregard my previous comment, now it sounds like you're modyfing something without restarting? By "device name" do you really mean "device name" or do you mean MQTT topic name?
    Helpful post? Buy me a coffee.
  • #11 20408420
    mannsteve
    Level 6  
    "now it sounds like you're modifying something without restarting? By "device name" do you really mean "device name" or do you mean MQTT topic name?"

    I changed the "Full Name" in "Configure Names".
    I generally do a restart almost every time I change a parameter.

    So, you are saying that it's safe for me to OTA the latest RBL file since I have the WiFi issue working on switch number one?

    I am currently trying to get switch number two to connect, but no success yet.
    I just had a thought- What if I do a backup of switch number 1, disconnect it, then flash that backup to switch number 2. Would I essentially have a clone?

    Ooh- update. Third or fourth time flashing with FullFW.bin is a charm. I got the second switch on my network....
    Now to configure it...
    Then I will try to upgrade using OpenBK7231N_1.15.392.rbl. From the menu? Is this correct?

    I flashed my switch that has a BK7231N chip on it,. Now what?

    It isn't clear what "App panel" is being referred to here.

    ------------------
    Later...
    Well, that didn't work.
    I flashed my switch that has a BK7231N chip on it,. Now what?

    So, how do you recommend an OTA update?
  • #12 20409384
    p.kaczmarek2
    Moderator Smart Home
    Hello, this field is for HTTP OTA. It works if you have a file on HTTP (not HTTPS server). So it won't work that way.
    I will show you how to do OTA better way.
    And, btw, you still haven't changed MAC.
    Please go to "Open Web Application" and then, first:
    I flashed my switch that has a BK7231N chip on it,. Now what?
    (Here is how web app looks like:
    I flashed my switch that has a BK7231N chip on it,. Now what?
    )
    In Flash do "restore RF config" to get valid MAC:
    I flashed my switch that has a BK7231N chip on it,. Now what?
    Then in OTA ,drag and drop RBL file for your platform and start:
    I flashed my switch that has a BK7231N chip on it,. Now what?

    Again, I apologize for that WiFi issues. It's rare case that affects a certain batch of N modules, it happens because Tuya RF partition seems to have changed its format and breaks OBK. That's why you had to write full 2MB flash with empty MAC (and RF data), that was to clear the bad RF data.

    If you have any more problematic devices, please do a 2MB flash read first (of broken device) and attach it here for me for analysis, if you want to help investigating it.

    Dodano po 5 [minuty]:

    p.kaczmarek2 wrote:
    Hello, this field is for HTTP OTA. It works if you have a file on HTTP (not HTTPS server). So it won't work that way.
    I will show you how to do OTA better way.
    And, btw, you still haven't changed MAC.
    Please go to "Open Web Application" and then, first:
    I flashed my switch that has a BK7231N chip on it,. Now what?
    (Here is how web app looks like:
    I flashed my switch that has a BK7231N chip on it,. Now what?
    )
    In Flash do "restore RF config" to get valid MAC:
    I flashed my switch that has a BK7231N chip on it,. Now what?
    Then in OTA ,drag and drop RBL file for your platform and start:
    I flashed my switch that has a BK7231N chip on it,. Now what?

    Again, I apologize for that WiFi issues. It's rare case that affects a certain batch of N modules, it happens because Tuya RF partition seems to have changed its format and breaks OBK. That's why you had to write full 2MB flash with empty MAC (and RF data), that was to clear the bad RF data.

    If you have any more problematic devices, please do a 2MB flash read first (of broken device) and attach it here for me for analysis, if you want to help investigating it.


    EDIT:
    Quote:

    I just had a thought- What if I do a backup of switch number 1, disconnect it, then flash that backup to switch number 2. Would I essentially have a clone?

    2MB flash contains everything, including MAC, so writing it twice to two devices without changing MAC as I shown above will make your devices and router go crazy.
    Helpful post? Buy me a coffee.
  • #13 20410322
    mannsteve
    Level 6  
    Thanks. That worked.
    But on the FullFW binary, there is no "Launch Web Application" button. But your sample image showed the URL so I just went to my IP /app?.

    I flashed my switch that has a BK7231N chip on it,. Now what?

    Is this the right RBL file?

    I flashed my switch that has a BK7231N chip on it,. Now what?

    At any rate this is from the "About" page after flashing the RBL file:

    I flashed my switch that has a BK7231N chip on it,. Now what?

    "And, btw, you still haven't changed MAC."
    Yes, look at the last digit. One is 001 and the other is 002. They coexist nicely.

    "Again, I apologize for that WiFi issue. It's a rare case that affects a certain batch of N modules, it happens because Tuya RF partition seems to have changed its format and breaks OBK. That's why you had to write full 2MB flash with empty MAC (and RF data), that was to clear the bad RF data."
    No apology needed. At least I know what to do the next time and your assistance is greatly appreciated.

    "If you have any more problematic devices, please do a 2MB flash read first (of broken device) and attach it here for me for analysis, if you want to help investigating it."
    I did a backup with the first flash attempt. (The device firmware as shipped). That file is attached- I would like to know if it is of any use to you.

    "2MB flash contains everything, including MAC, so writing it twice to two devices without changing MAC as I shown above will make your devices and router go crazy."
    I only have one device online at a time while setting up.

    Conclusion
    Everything appears to be working now.
    Does this mean that as far as OpenBK is concerned, my devices are now up to date and safe for future updates?

    I will be writing up the process for my notebook. Would you be interested in receiving a copy when I am done?
  • ADVERTISEMENT
  • #14 20410588
    p.kaczmarek2
    Moderator Smart Home
    mannsteve wrote:
    Thanks. That worked.
    But on the FullFW binary, there is no "Launch Web Application" button. But your sample image showed the URL so I just went to my IP +/app?.

    Sorry, but now it's not clear, did going to URL work?

    I think in older version the App link was in Config.

    I am starting to think that we need to add something like a hard reset mechanism that will automatically clear RF partition without doing "FullFW hack". Maybe 10 quick power on/off cycles should clear 100% of config and RF? But now I would worried that power outage or user playing around with light would trigger it by accident....


    mannsteve wrote:

    I did a backup with the first flash attempt. (The device firmware as shipped). That file is attached- I would like to know if it is of any use to you.

    I will look into it at time, there are many features being worked on right now, please track our Github history and Elektroda.com youtube channel to see what's happening. Every day is a progress.

    mannsteve wrote:

    Does this mean that as far as OpenBK is concerned, my devices are now up to date and safe for future updates?

    It seems so, but I would make sure that whole MAC is totally random (it can be changed in options?) and also set full and short device names to something unique, like "obkNkitchenLamp", etc and NOT to obkFFAABBCC.

    Now you can pair with HA, etc:




    mannsteve wrote:

    I will be writing up the process for my notebook. Would you be interested in receiving a copy when I am done?

    Of course, you can post it here in Tutorial section, and if you're interested, we could also send you a free gift:
    Submit the IoT device teardown/review/guide/article and get a free SD card
    If you have any devices not listed here, you can also consider adding them:
    OpenBeken IoT devices teardowns database
    Helpful post? Buy me a coffee.
  • #15 20410616
    mannsteve
    Level 6  
    Is this the kind of detail you want? I can repackage it as a post if you can't use the PDF.

    Whoops - I just watched the video you linked. I'll try discovery on the second switch and modify my text appropriately.

    Steve
  • #16 20410624
    p.kaczmarek2
    Moderator Smart Home
    This is a very good description but it requires one modification.

    FullFW.bin is needed in rare cases, I would add a point that first everyone should just try latest release, without doing any fullFW hacks. Then it could be named something like "OpenBeken initial configuration and optional RF partition fix". I would focus on initial configuration more as the RF fix may be added automatically in the future releases.

    Other than that, great job - you should take a credit for that and post it yourself as a topic in Guides section, here: https://www.elektroda.com/rtvforum/forum517.html

    No need for me posting that, you done good job so it should be under your username.
    Helpful post? Buy me a coffee.
  • #17 20411608
    mannsteve
    Level 6  
    p.kaczmarek2 wrote:
    No need for me posting that, you done a good job so it should be under your username.


    I just ran the keyboard- you did all the work.

    But thanks- you just saved these switches from the bin.

    BTW, my instructions are for flashing FullFW.bin, but how do I describe where to get the file?

    Is this the right place for my post?
    https://www.elektroda.com/rtvforum/topic3953307.html#20411743
  • #18 20411841
    p.kaczmarek2
    Moderator Smart Home
    You can just attach this file to your post. As an attachment on our forum, no problems here.

    Then we can move topic to the IoT section.
    Helpful post? Buy me a coffee.
  • #19 20412379
    mannsteve
    Level 6  
    p.kaczmarek2 wrote:
    You can just attach this file to your post. As an attachment on our forum, no problems here.
    Then we can move the topic to the IoT section.


    Done. I also did some grammatical changes, but I think it's ready for publishing.

Topic summary

The discussion revolves around flashing a switch with a BK7231N chip, specifically the KS602S model. After successfully entering WiFi credentials via the configuration menu at 192.168.4.1, the user faced issues with the device not obtaining an IP address on the local network. Various troubleshooting steps were suggested, including checking the WiFi frequency, using UART logs, and performing a full 2MB flash dump. The user discovered that the FullFW.bin binary cleared the RF configuration, resulting in a lost MAC address. To resolve this, it was advised to restore the RF configuration to generate a unique MAC address. The user successfully connected the first switch to WiFi and later managed to connect the second switch after multiple flashing attempts. The conversation also touched on OTA updates and the importance of ensuring unique MAC addresses for multiple devices to avoid network conflicts.
Summary generated by the language model.
ADVERTISEMENT