logo elektroda
logo elektroda
X
logo elektroda

Smart Gateway RSH-GW006 to OBK Conversion: Tools, Files, Setup, and Integration Guide

DeDaMrAz 2928 43
ADVERTISEMENT
  • ADVERTISEMENT
  • #32 21656030
    diepeterpan
    Level 8  
    I will attempt to flash the bootloader once I have a proper J-Link device (I am struggling to get one at the moment).

    Maybe secure boot is enabled by the Tuya bootloader. I suppose it's worth a try since all other avenues are exhausted.

    https://www.silabs.com/documents/public/user-guides/ug266-gecko-bootloader-user-guide.pdf

    Code: Text
    Log in, to see the code

    Maybe the custom firmware GBLs don't pass signature verification.
  • #33 21658955
    diepeterpan
    Level 8  
    Good news: >>21655761
    I was able to use a Chinese converted ST-LINK V2 to JLINK Link and a custom version of OpenOCD Link to backup and restore the firmware on the ZS3L, and then proceeded with installing the new bootloader.

    Code: Bash
    Log in, to see the code


    Code: Bash
    Log in, to see the code

    Good news and bad news.

    Good news: flashing the new bootloader did NOT brick the device and still booted the stock firmware. This is where I started to get suspicious. If the new bootloader also boots the stock firmware, then it's unlikely to be the cause of other firmware not booting.

    Anyways, I proceeded to flash again 8.2.0.0

    Code: Bash
    Log in, to see the code

    Bad news: After flashing, the firmware still did not work :-(

    Code: Bash
    Log in, to see the code

    Nothing, nada ....

    I then flashed a couple more like zs3l_ncp-uart-hw_EmberZNet8.0.1.0.gbl, zs3l_zigbee_ncp_8.1.1.0_115200.gbl, G01-pro-ncp-uart-hw_4.gbl .... but they all did the same, nothing..... tested with bellows and Z2M and ZHA :-(

    I then reverted to my backup and am back on stock :-(

    Code: Bash
    Log in, to see the code

    There must be something stored in the flash or some other spot on the ZS3L preventing non-stock firmware from booting or making them crash, but I am too scared to go and erase the entire flash; maybe it's not in the flash, and then I'll brick it completely.

    Hopefully, these experiments and write-up help someone else, and maybe they come up with a solution.

    Maybe the secure boot hash/key is stored somewhere else, see if I can read more about it]Link
  • ADVERTISEMENT
  • #34 21676976
    insmod
    Level 29  
    Sadly, st-link to j-link is not allowed to operate with anything but stm32 in standard segger applications, and any other that uses jlinkarm.dll
    Unfortunately, simplicity commander uses it too. Meaning you would have to either buy a j-link probe, or search for some patched jlinkarm.dll that works with non-stm32 chips. I initially tried that too, but it didn't work for me.
    You can ask for help in https://github.com/darkxst/silabs-firmware-builder as my firmware is built as a fork of this repository.
  • #35 21680501
    diepeterpan
    Level 8  
    >>21676976

    I managed to work with it using the custom OpenOCD as a workaround.
  • ADVERTISEMENT
  • #37 21686371
    diepeterpan
    Level 8  
    >>21686233 Thanks, I have just tried the init file, and there are a couple of specific .gbl files for the CPU that the ZS3L uses, but I had no luck after erasing the flash.

    Link

    I flashed the new bootloader 3.1.0
    Code: Bash
    Log in, to see the code

    Then, with the new bootloader, I erased the storage
    Code: Bash
    Log in, to see the code

    The flashed e.g. 8.0.2, tried various, but it did not work after flashing
    Code: Bash
    Log in, to see the code

    Then, with the new bootloader flashed, the stock firmware worked again
    Code: Bash
    Log in, to see the code

    It just does not make sense, somewhere something is wrong.....

    Anyway, let's see if somebody else has experienced similar and maybe come up with a new way to fix it.
  • #38 21686394
    insmod
    Level 29  
    Try first app_clear, then nvm3_clear, power cycle, then 8.2.0
    Anyway, what exactly was the problem with flash erase with openocd?
  • ADVERTISEMENT
  • #39 21693229
    diepeterpan
    Level 8  
    I eventually got to JLINK the chip, making an interesting discovery, but I had no joy running a newer version.

    1) I first tried the command-line Simplicity Commander to unlock the chip, just in case it was the problem. Chip unlocked, but newer firmware did not work :-(
    Smart Gateway RSH-GW006 to OBK Conversion: Tools, Files, Setup, and Integration Guide

    2) This was very interesting as the chip is marked ZS3L, but the identification gave MGM210L022JNF2 with 1024kB flash instead of an EFR32 with 768kB. Does Tuya have a newer version of the ZS3L, and that's why the firmware doesn't run?
    Smart Gateway RSH-GW006 to OBK Conversion: Tools, Files, Setup, and Integration Guide

    3) I was able to wipe the chip, just in case. I then flashed a new bootloader and firmware, but no go to running it :-(
    Smart Gateway RSH-GW006 to OBK Conversion: Tools, Files, Setup, and Integration Guide
    Smart Gateway RSH-GW006 to OBK Conversion: Tools, Files, Setup, and Integration Guide
    Smart Gateway RSH-GW006 to OBK Conversion: Tools, Files, Setup, and Integration Guide Smart Gateway RSH-GW006 to OBK Conversion: Tools, Files, Setup, and Integration Guide



    4) I then flashed back the stock firmware backup, and it works. So I trust the JLINK is working correctly.
    Smart Gateway RSH-GW006 to OBK Conversion: Tools, Files, Setup, and Integration Guide



    I wonder if someone can create a custom .gbl file for this chip, if it indeed is the problem.
  • #41 21693329
    diepeterpan
    Level 8  
    >>21693266
    Tested both, but only one worked.

    You are a genius, so apparently, there are different ZS3L's out there!

    "And MGM210L022JNF (without 2)" <= worked!!!!

    I will add some devices to it in Zigbee2MQTT and let it run for a day or so, and provide feedback again.  A BIG thanks again!!!!!

    Code: Bash
    Log in, to see the code
  • #42 21694269
    diepeterpan
    Level 8  
    >>21693329
    "Everything is working fine with the MGM210L022JNF firmware '8.2.0.0 build 191' for the ZS3L on the Tuya MOES gateway - NH-THP01-ZB using Z2M."

    Tuya MOES gateway - NH-THP01-ZB

    Teardown pictures of the device:
    The device has 4 small screws hidden under the rubber feet

    Device top view:
    Smart Gateway RSH-GW006 to OBK Conversion: Tools, Files, Setup, and Integration Guide

    Device back view:
    Smart Gateway RSH-GW006 to OBK Conversion: Tools, Files, Setup, and Integration Guide

    Device PCB view:
    Interior of an electronic device with visible PCB and communication modules.

    Board pinout to flash WRBG1, need to solder lines as there are no headers on the board:
    Follow the bootloader procedure with the resistor to put WRBG1 into bootloader mode and load OpenBeken for RTL8720D UART file using the Imagetool.
    Smart Gateway RSH-GW006 to OBK Conversion: Tools, Files, Setup, and Integration Guide

    To load firmware for the ZS3L:
    Use the following firmware and universal-silabes-flasher that can be found here - https://github.com/NabuCasa/universal-silabs-flasher
    Code: Bash
    Log in, to see the code

    My version of the device has a ZS3L using the MGM210L022JNF chip and needs the firmware at https://github.com/NonPIayerCharacter/silabs-firmware-builder/actions/runs/17817962778 ; if you are unsure of what type of ZS3L your device has, you have to use JLINK and Simplicity Commander to identify it. 

    firmware-b...115200.zip Download(1.26 MB)

    Smart Gateway RSH-GW006 to OBK Conversion: Tools, Files, Setup, and Integration Guide

    OpenBeken pin configuration:
    Code: Text
    Log in, to see the code

    autoexec.bat
    Code: Text
    Log in, to see the code

    The Zigbee chip can be reset by toggling "Zigbee reset"; handy when the Zigbee chip stops working and you need to remotely reset it.

    Force the bootloader to load new firmware by toggling "Zigbee bootloader" followed by a "Zigbee reset" loader; this is helpful when the firmware becomes unresponsive e.g., when you load the incorrect chip firmware.

    Zigbee2MQTT config:
    Code: Text
    Log in, to see the code
  • #43 21702763
    DeDaMrAz
    Level 21  
    insmod wrote:
    I will later try to add support for BTHome in OBK


    @insmod

    Any luck with this? Asking because I am about to go full in on changing everything in my apartment to "smart house" it and this would be somewhat more elegant than the separate BT proxy device.
  • Helpful post
    #44 21702818
    insmod
    Level 29  
    >>21702763
    Nothing yet, though my idea evolved a little.
    Just get advertisements packets, publish them to mqtt and via HA automation pass them to "Passive BLE monitor" addon

Topic summary

The discussion focuses on converting the Smart Gateway model RSH-GW006 to run OpenBeken (OBK) firmware, aiming to centralize tools, files, setup instructions, and integration guidance. The device teardown reveals four hidden screws and detailed board pinouts and schematics. Firmware for the WBRG1 module is based on OpenRTL8720D, with stable operation reported. The ZS3L module firmware is built with hardware flow offload and can be updated via TCP, though flashing can be sporadic and sometimes requires bootloader mode activation by pulling specific pins high. Universal-silabs-flasher is the primary tool used for flashing ZS3L firmware, supporting both UART and socket connections. Various firmware versions (8.0.2.0, 8.1.1.0, 8.2.0.0, and stock Tuya 6.5.5.0) were tested, with 8.2.0.0 and a specific build for MGM210L022JNF silicon identified as stable and fully functional for the ZS3L on the Tuya MOES NH-THP01-ZB gateway. Challenges include bootloader detection issues, secure boot possibly blocking custom firmware, and hardware differences in ZS3L variants. J-Link and ST-LINK V2 probes with custom OpenOCD were used for chip unlocking, backup, and flashing, as standard Segger tools are limited to STM32 devices. ESP32-S3 and C3 modules were tested for Bluetooth proxy functionality, with temperature and frequency tuning discussed. Bluetooth support in OBK is limited, with ongoing efforts to add BTHome support. The thread includes detailed logs, flashing commands, and troubleshooting steps to aid in successful firmware conversion and integration with Zigbee2MQTT (Z2M) and Home Assistant (HA).
Summary generated by the language model.
ADVERTISEMENT