darkxst / silabs-firmware-builder

Silicon Labs firmware builder
https://darkxst.github.io/silabs-firmware-builder/
349 stars 27 forks source link

Don't find SONOFF dongle E #96

Open Amonix87 opened 4 months ago

Amonix87 commented 4 months ago

Web flasher can't find usb sonoff dongle E device. Driver was installed.

Win11 image

Souks commented 3 months ago

same for me and with the python package i got an error like "could not open port 'COM3' PermissionError" i can't figure out why Tried multiples things, same problem in linux and with admin or root same problem

GauthierCrp commented 3 months ago

Hello,

Using Google Chrome on Fedora 40, I'm facing the error following : The dongle seems to be detected, but impossible to check the firmware installed on it. The firmware is the factory one, installed by Sonoff.

image

But :

image

image

image

Someone can help me ? I try to upload the firmware because with the new version of Zigbee2Mqtt (Current version: 1.38.0-1) the Dongle is not working, detected but not functional. But, it was working just fine with the passed version.

Thank you very much for yout help.

Best Regards. Gauthier.

darkxst commented 3 months ago

If you can't connect to Dongle its usually one of these: On Linux you need to add your user to the dialout group. On Windows you probably need to install drivers for CH9102 chip.

andy858585 commented 3 months ago

I recently ordered another ZBDongle-E. The web flasher cannot detect it. Web flasher can detect the first ZBDongle-E.

I opened the casing of both dongles, noticed different USB-to-UART Bridge chip. First dongle uses CH9102. Web flasher can detect it and flash firmware. ZBDongle-E_CH9102F_01 ZBDongle-E_CH9102F_02

Second dongle uses CP2102N. Web flasher cannot detect it. ZBDongle-E_CP2102N_01 ZBDongle-E_CP2102N_02

darkxst commented 3 months ago

Interesting, I have not seen a ZBdongle-E with cp2102 before, however this should have no impact on web flasher.

@andy858585 Are you on Windows or Linux? If Windows could be a driver issue?

andy858585 commented 3 months ago

Interesting, I have not seen a ZBdongle-E with cp2102 before, however this should have no impact on web flasher.

@andy858585 Are you on Windows or Linux? If Windows could be a driver issue?

Windows. I installed CP2102 driver linked from web flasher.

If I click connect button at "SMLIGHT SLZB-07", web flasher can detect ZBDongle-E_CP2102.

darkxst commented 3 months ago

Oh right, I have updated usb filters for zbdongle-e, it should work now.

Amonix87 commented 3 months ago

Thankx, Now it found (it's a CP2102N) but flash not working silabs_flasher.log

darkxst commented 3 months ago

@Amonix87 Its failing to connect, but I not too sure what else could effect it on Windows. Can you try directly with the pythonuniversal-silabs-flasher -v` this might give a bit more useful logs.

Souks commented 3 months ago

i managed to get a new firmware with the following method seen here

Install SecureCRT (trial version is fine), or another similar software
Use it to flash Sonoff [factory NCP firmware](https://github.com/itead/Sonoff_Zigbee_Dongle_Firmware/tree/master/Dongle-E/NCP) (procedure described in [Sonoff PDF](https://sonoff.tech/wp-content/uploads/2022/07/SONOFF-Zigbee-3.0-USB-dongle-plus-firmware-flashing-.pdf))
Come back to darkxst flasher and flash the new firmware you want

Just the last step "Come back to darkxst flasher and flash the new firmware you want" didn't worked for me And flashing a rcp firmware didn't worked too (in fact the flash worked but in home assistant i got errors due to "bad firmware"), i end up flashing the stock firmware again to use it in home assistant (the key is working with stock firmware)

I will try with the last update when i came home

andy858585 commented 3 months ago

Managed to flash firmware ncp-uart-hw-v7.4.3.0-zbdonglee-115200.gbl by using this method.

Logs:

c:\>universal-silabs-flasher --help
Usage: universal-silabs-flasher [OPTIONS] COMMAND [ARGS]...

Options:
  -v, --verbose
  --device PATH_OR_URL
  --bootloader-baudrate NUMBERS   [default: 115200]
  --cpc-baudrate NUMBERS          [default: 460800, 115200, 230400]
  --ezsp-baudrate NUMBERS         [default: 115200]
  --spinel-baudrate NUMBERS       [default: 460800]
  --probe-method TEXT             [default: bootloader, cpc, ezsp, spinel]
  --bootloader-reset [yellow|ihost|slzb07|sonoff]
  --help                          Show this message and exit.

Commands:
  dump-gbl-metadata
  flash
  probe
  write-ieee

c:\>universal-silabs-flasher --device COM4 --bootloader-reset sonoff flash --firmware "C:\temp\ncp-uart-hw-v7.4.3.0-zbdonglee-115200.gbl"
2024-06-05 21:11:02.902 SYS22 universal_silabs_flasher.flash INFO Extracted GBL metadata: NabuCasaMetadata(metadata_version=1, sdk_version='4.4.3', ezsp_version='7.4.3.0', ot_rcp_version=None, cpc_version=None, fw_type=<FirmwareImageType.NCP_UART_HW: 'ncp-uart-hw'>, baudrate=115200)
2024-06-05 21:11:02.902 SYS22 universal_silabs_flasher.flasher INFO Triggering sonoff bootloader
2024-06-05 21:11:03.575 SYS22 universal_silabs_flasher.flasher INFO Probing ApplicationType.GECKO_BOOTLOADER at 115200 baud
2024-06-05 21:11:03.638 SYS22 universal_silabs_flasher.flasher WARNING No application can be launched
2024-06-05 21:11:03.638 SYS22 universal_silabs_flasher.flasher INFO Detected bootloader version '1.12.0'
2024-06-05 21:11:03.639 SYS22 universal_silabs_flasher.flasher INFO Detected ApplicationType.GECKO_BOOTLOADER, version '1.12.0' at 115200 baudrate (bootloader baudrate 115200)
ncp-uart-hw-v7.4.3.0-zbdonglee-115200.gbl  [####################################]  100%
Souks commented 3 months ago

For me its working now !

Amonix87 commented 3 months ago

@Amonix87 Its failing to connect, but I not too sure what else could effect it on Windows. Can you try directly with the pythonuniversal-silabs-flasher -v` this might give a bit more useful logs.

I don't know how make this. never used Python....

Amonix87 commented 3 months ago

I tried with Python:

Log:

2024-06-06 18:07:53.759 DESKTOP-I7B50NR universal_silabs_flasher.flash INFO Extracted GBL metadata: NabuCasaMetadata(metadata_version=1, sdk_version='4.4.3', ezsp_version='7.4.3.0', ot_rcp_version=None, cpc_version=None, fw_type=<FirmwareImageType.NCP_UART_HW: 'ncp-uart-hw'>, baudrate=115200)
2024-06-06 18:07:53.760 DESKTOP-I7B50NR universal_silabs_flasher.flasher INFO Triggering sonoff bootloader
2024-06-06 18:07:54.377 DESKTOP-I7B50NR universal_silabs_flasher.flasher INFO Probing ApplicationType.GECKO_BOOTLOADER at 115200 baud
2024-06-06 18:07:54.487 DESKTOP-I7B50NR universal_silabs_flasher.flasher INFO Launched application from bootloader
2024-06-06 18:07:55.528 DESKTOP-I7B50NR universal_silabs_flasher.flasher INFO Detected bootloader version '1.12.0'
2024-06-06 18:07:55.528 DESKTOP-I7B50NR universal_silabs_flasher.flasher INFO Probing ApplicationType.EZSP at 115200 baud
2024-06-06 18:07:56.836 DESKTOP-I7B50NR universal_silabs_flasher.flasher INFO Detected ApplicationType.EZSP, version '6.10.3.0 build 297' (6.10.3.0.297) at 115200 baudrate (bootloader baudrate 115200)
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\j_bp_\AppData\Local\Programs\Python\Python312\Scripts\universal-silabs-flasher.exe\__main__.py", line 7, in <module>
  File "C:\Users\j_bp_\AppData\Local\Programs\Python\Python312\Lib\site-packages\click\core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\j_bp_\AppData\Local\Programs\Python\Python312\Lib\site-packages\click\core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "C:\Users\j_bp_\AppData\Local\Programs\Python\Python312\Lib\site-packages\click\core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\j_bp_\AppData\Local\Programs\Python\Python312\Lib\site-packages\click\core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\j_bp_\AppData\Local\Programs\Python\Python312\Lib\site-packages\click\core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\j_bp_\AppData\Local\Programs\Python\Python312\Lib\site-packages\click\decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\j_bp_\AppData\Local\Programs\Python\Python312\Lib\site-packages\universal_silabs_flasher\flash.py", line 40, in inner
    return asyncio.run(f(*args, **kwargs))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\j_bp_\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "C:\Users\j_bp_\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\j_bp_\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\Users\j_bp_\AppData\Local\Programs\Python\Python312\Lib\site-packages\universal_silabs_flasher\flash.py", line 408, in flash
    await flasher.enter_bootloader()
  File "C:\Users\j_bp_\AppData\Local\Programs\Python\Python312\Lib\site-packages\universal_silabs_flasher\flasher.py", line 261, in enter_bootloader
    async with self._connect_ezsp(self.app_baudrate) as ezsp:
  File "C:\Users\j_bp_\AppData\Local\Programs\Python\Python312\Lib\contextlib.py", line 210, in __aenter__
    return await anext(self.gen)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\j_bp_\AppData\Local\Programs\Python\Python312\Lib\site-packages\universal_silabs_flasher\emberznet.py", line 41, in connect_ezsp
    ezsp = await bellows.ezsp.EZSP.initialize(app_config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\j_bp_\AppData\Local\Programs\Python\Python312\Lib\site-packages\bellows\ezsp\__init__.py", line 133, in initialize
    await ezsp.connect(use_thread=zigpy_config[conf.CONF_USE_THREAD])
  File "C:\Users\j_bp_\AppData\Local\Programs\Python\Python312\Lib\site-packages\bellows\ezsp\__init__.py", line 145, in connect
    self._gw = await bellows.uart.connect(self._config, self, use_thread=use_thread)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\j_bp_\AppData\Local\Programs\Python\Python312\Lib\site-packages\bellows\uart.py", line 187, in connect
    protocol, _ = await _connect(config, application)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\j_bp_\AppData\Local\Programs\Python\Python312\Lib\site-packages\bellows\uart.py", line 158, in _connect
    transport, _ = await zigpy.serial.create_serial_connection(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\j_bp_\AppData\Local\Programs\Python\Python312\Lib\site-packages\zigpy\serial.py", line 48, in create_serial_connection
    transport, protocol = await pyserial_asyncio.create_serial_connection(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\j_bp_\AppData\Local\Programs\Python\Python312\Lib\site-packages\serial_asyncio\__init__.py", line 448, in create_serial_connection
    serial_instance = serial.serial_for_url(*args, **kwargs)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\j_bp_\AppData\Local\Programs\Python\Python312\Lib\site-packages\serial\__init__.py", line 90, in serial_for_url
    instance.open()
  File "C:\Users\j_bp_\AppData\Local\Programs\Python\Python312\Lib\site-packages\serial\serialwin32.py", line 64, in open
    raise SerialException("could not open port {!r}: {!r}".format(self.portstr, ctypes.WinError()))
serial.serialutil.SerialException: could not open port 'COM7': PermissionError(13, 'Accès refusé.', None, 5)
darkxst commented 3 months ago

@Amonix87 You user doesnt have permission to access serial port (or maybe its already in use by another program). Try run the script as Administrator and see if that helps

Amonix87 commented 3 months ago

I was already in admin and I reboot pc. I don’t know how to find if There is a program who use the port…

Hedda commented 3 months ago

FYI, while probably not your issue from the sounds of it, be aware that the USB-plug on these Sonoff dongles dongles and well as some others (as well as aother USB-devices/peripherals) are known to be too short so do not make proper physical contact when plugged into a computer with sunken USB-ports.

image

For example, the The chassi/enclosure walls of the Home Assistant Blue are very thick due to poor design that makes the USB-ports sunken, therefore these USB-dongles will not make proper contact when plugged into the Home Assistant Blue.

The workaround is to use a USB extension cable (which you should use regardless) that has a longer USB-plug to make sure it makes proper physical contact (i.e. that it can be plugged in all the way despite the thick chassi/enclosure walls of the Home Assistant Blue ). I mention this under tips here -> https://community.home-assistant.io/t/itead-s-sonoff-zigbee-3-0-usb-dongle-plus-v2-model-zbdongle-e-based-on-silicon-labs-efr32mg21-20dbm-radio-soc-mcu/442695

To avoid EMF interference strongly recommended buy and use → Long USB extension cable

PS: I seen posts from some people than have taken a Dremel, power-drill or other power-tool to physically modify the Home Assistant Blue chassi/enclosure to fix the issue of sunken USB-ports. See picture from issue with ConBee and Aeotec dongles -> https://community.home-assistant.io/t/solved-conbee-ii-not-recognized-on-ha-blue-odroid-n2/265883

image

Hedda commented 3 months ago

First dongle uses CH9102. Web flasher can detect it and flash firmware.

...

Second dongle uses CP2102N. Web flasher cannot detect it.

hmm, never seen that before either but I see they updated specification on webpage for ZBDongle-P to mention both those chips:

https://itead.cc/product/zigbee-3-0-usb-dongle/

image

Update: Funnily enough see now that they not updated the webpage for ZBDongle-E to mention it uses both those chips:

https://itead.cc/product/sonoff-zigbee-3-0-usb-dongle-plus/

image