logo elektroda
logo elektroda
X
logo elektroda

How do I delete the GPIO settings on the CB3S module with Tuya configuration?

tomik67 204 10
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 21383006
    tomik67
    Level 12  
    How to get rid of Tuya GPIO Settings ?
    I have a purchased CB3S module, unused by the device manufacturer but with a ready-made GPIO configuration,...:

    Device configuration, as extracted from Tuya:
    - Button is on P9
    - WiFi LED on P24
    - IR Receiver is on P8
    - IR Transmitter is on P7
    No module information found.
    And the Tuya section starts, as usual, at 2023424

    {
       "reset_pin":"9",
       "wfst_pin":"24",
       "owm":"0",
       "reset_lv":"0",
       "rsthold":"3",
       "wfst_lv":"1",
       "netyc":"1",
       "infrr":"8",
       "netnc":"0",
       "infre":"7",
       "crc":"69"
    }


    The module has never been used because it has clean pads with no tin.
    I did what I could but I am not able to get rid of these GPIO settings, they are buried somewhere deeper.
    What to do, how to live ?.
  • ADVERTISEMENT
  • #2 21383130
    xury
    Automation specialist
    Want to get rid of the configuration change its soft to OpenBeken.
  • ADVERTISEMENT
  • #3 21383142
    tomik67
    Level 12  
    This doesn't do anything, I've tried ticking/un-ticking the Import Tuya GPIO, setting the GPIO to none and saving, various combinations, unfortunately the original GPIO settings keep coming back when I read the module.
  • ADVERTISEMENT
  • #4 21384345
    p.kaczmarek2
    Moderator Smart Home
    And what is the motivation for wanting to remove them? I ask because essentially they do not in any way disturb or spoil anything.

    We don't have an option in flash erase on top, because as a rule we want them to stay, otherwise users delete them unintentionally and then there is a configuration problem.... but if you want, I can prepare a command for flash erase with a given offset
    Helpful post? Buy me a coffee.
  • #5 21385539
    tomik67
    Level 12  
    The motivation is that I suddenly get an entry like this in the logs...:

    Info:TuyaMCU:Received: 55 AA 03 2B 00 00 2D 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 43 (NetworkStatus) len 7
    Info:TuyaMCU:ProcessIncoming: (test for S09 calendar/IR device) received TUYA_CMD_NETWORK_STATUS 0x2B
    .

    and I have an assumption that this is a reaction to a remnant of the previous GPIO settings because somehow I can't attribute it to the current config.
    I don't know if it does anything but I'm afraid of some unexpected reactions of the device which I won't be able to understand and prevent.
  • ADVERTISEMENT
  • #6 21385888
    p.kaczmarek2
    Moderator Smart Home
    So the principle of asking the questioner about his motivations rather than automatically giving him a 1:1 answer to the question asked does work.....

    What you say is not possible, because the OpenBeken firmware does not use the partition in question in any way. To be more precise, in the firmware code itself this partition is not read let alone decoded, and this is necessary to use it, as it is AES encoded.

    All OpenBeken (the firmware for the WiFi module) does is offer to read the flash memory of a given offset and size, which the Web App then uses to make a mechanism for downloading this partition, which then only is decoded in the BK7231GUIFlashTool on Windows, in C# :
    Code: text
    Log in, to see the code
    .
    Furthermore, the TuyaMCU OBK driver was made from 0 before we knew about this partition, so there is no way to interact with it either....

    TLDR: This partition is not used by the OBK firmware at all, only Flasher on Windows knows how to decode it.



    Now that we have that covered, attention can now be turned to the actual problem we want to solve:
    tomik67 wrote:
    The motivation is that I suddenly get an entry like this in the logs...:

    Info:TuyaMCU:Received: 55 AA 03 2B 00 00 2D 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 43 (NetworkStatus) len 7
    Info:TuyaMCU:ProcessIncoming: (test for S09 calendar/IR device) received TUYA_CMD_NETWORK_STATUS 0x2B
    .
    .
    This packet is defined as 0x2B (decimal 43):
    Code: C / C++
    Log in, to see the code
    .
    Its support has been added for the S09 device. This is the package where the device asks the WiFi module for the network status:
    Code: C / C++
    Log in, to see the code
    .
    This is not a problem by any means, but it is worth remembering that if OBK natively assumes that the status reported is "connected to the cloud" only how MQTT is connected. If there is no MQTT, it only reports connected to the router. You can change this behaviour by setting tuyaMcu_defWiFiState to 0x04.
    Let me remind you of the argument values:
    Code: C / C++
    Log in, to see the code
    .

    The same from Tuya's documentation:
    Quote:
    .
    Get the current network status .
    0x04
    Network status Description . Status value
    Status 1 Pairing in EZ mode. (For Wi-Fi and Bluetooth LE combo module: Bluetooth is also in pairing mode.) 0x00
    Status 2 Pairing in AP mode. (For Wi-Fi and Bluetooth LE combo module: Bluetooth is also in pairing mode.) 0x01
    Status 3 The Wi-Fi network is set up, but the device is not connected to the router. 0x02
    Status 4 The Wi-Fi network is set up, and the device is connected to the router. 0x03
    Status 5 The device is connected to the cloud. 0x04
    Status 6 Tuya's network module is in low power mode. 0x05
    Status 7 EZ mode and AP mode coexist. (For Wi-Fi and Bluetooth LE combo module: Bluetooth is also in pairing mode.) 0x06
    .
    The MCU sends the following command.
    .
    Field Bytes . Description
    Header 2 0x55aa
    Version 1 0x03
    Command 1 0x2B
    Date length 2 0x0000
    Date Date None None
    Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.
    .
    For example, 55 aa 03 2b 00 00 2d
    The module returns the following command. .
    .
    Field Bytes . Description
    Header 2 0x55aa
    Version 1 0x00
    Command 1 0x2B
    Date length 2 0x0001
    Date
    1
    0x00: Pairing in EZ mode.
    0x01: Pairing in AP mode.
    0x02: The Wi-Fi network is set up, but the device is not connected to the router.
    0x03: The Wi-Fi network is set up, and the device is connected to the router.
    0x04: The device is connected to the router and the cloud.
    0x05: The device is in low power mode.
    0x06: EZ mode and AP mode coexist.
    Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.
    .
    .

    Now, it would be rather pertinent to consider what specific device you have and what is the problem with it that you are looking for the culprit in the GetNetworkStatus (0x2B) query?
    Helpful post? Buy me a coffee.
  • #7 21387278
    tomik67
    Level 12  
    The device in which I installed this module is a WENZHI MTG236-WF-RL presence detector, as the previous config on the module came from an IR device I suspected some residue from it.
  • #8 21387349
    p.kaczmarek2
    Moderator Smart Home
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md
    clearAll will remove everything, the Tuya partition does not interfere. This message what you quoted is quite natural. And are there any problems with the device, that you ask?
    Helpful post? Buy me a coffee.
  • #9 21387354
    tomik67
    Level 12  
    I don't know quite yet because it's a fresh case under testing, so far it's OK.
    It works on it as I mentioned CB3S, originally there was a WBR3 which I removed and thanks to your work two days ago I sflashed on OBK.
    Now I'm thinking of re-installing the WBR3 on this detector, I've already uploaded the same config on it as on the CB3S, only will the MCU cooperation be correct ?.
    I guess I have to take the risk.

    Added after 9 [hours] 15 [minutes]: .

    I ran an OTA today for the WBR3 not yet soldered to the presence detector from 1.18.14 to 1.18.18 and again with the same firmware and the module did not reboot, a power cut was required.
    This would be a hassle for devices built into the wall or ceiling, requiring a power cut in the box or removal of the device.

    Added after 5 [minutes]:

    Same thing after running the Restart function from the interface, the module in the logs reports an impending reboot but no longer gets up.
  • #10 21387822
    p.kaczmarek2
    Moderator Smart Home
    Strange, it works for me. Do you have any other settings or configurations perhaps?

    Before:
    Device management panel of OpenRTL87X0C with sensor data and functions. .
    Up to 1.18.14:
    Screenshot of the OpenRTL87X0C_6622C1F4 device management panel. .
    To 1.18.18:
    Helpful post? Buy me a coffee.
  • #11 21387832
    tomik67
    Level 12  
    The settings and configuration are the same as on the CB3S which sits still in the detector.

Topic summary

The discussion addresses the challenge of removing pre-existing Tuya GPIO settings from a CB3S WiFi module, which retains a default GPIO configuration despite attempts to clear it via the OpenBeken firmware interface. The module's Tuya configuration includes pins assigned for button (P9), WiFi LED (P24), IR receiver (P8), and IR transmitter (P7). The user experiences recurring Tuya MCU network status messages in logs, suspected to be linked to residual GPIO settings from a previous IR device configuration. It is clarified that OpenBeken firmware does not utilize or decode the AES-encrypted Tuya partition, only reading flash memory for external decryption tools. A flash erase command targeting specific offsets can remove the Tuya partition, but it is generally preserved to avoid unintentional configuration loss. The user also reports OTA update and reboot issues on a WBR3 module used in a WENZHI MTG236-WF-RL presence detector, with the module failing to reboot without power cycling. The discussion includes references to OpenBK7231T_App commands and the BK7231GUIFlashTool for handling encrypted Tuya data.
Summary generated by the language model.
ADVERTISEMENT