walthowd / husbzb-firmware

Nortek GoControl HUSBZB-1 / EM3581 Firmware update image
GNU General Public License v3.0
246 stars 40 forks source link

Hang after reboot to bootloader with default HUSBZB-1 firmware #33

Open henryptung opened 2 years ago

henryptung commented 2 years ago

When using ncp.py flash script with an unupdated/original HUSBZB-1 firmware/bootloader, I get a hang at:

# ./ncp.py flash -p /dev/ttyUSB1 -f ncp-uart-sw-6.7.8.ebl
Restarting NCP into Bootloader mode...
CEL stick
EM3581 Serial Bootloader v5.4.1.0 b962

and it hangs forever in that state until Ctrl-C'd. After much debugging and tweaking of the script, figured out the patch to make it work in my case:

    # Open new connection
    ser = serial.Serial(
        port=port,
        baudrate=115200,
        parity=serial.PARITY_NONE,
        stopbits=serial.STOPBITS_ONE
    )

My stick needed no flow control at all (either hardware or software), and the xonxoff=True flag in the bootloader connection was causing it to hang when waiting for 1 to be echoed back. Testing with minicom indicated disabling software flow control would make it work.

Not sure if that's an ideal fix or if setting rtscts=True might have also worked/been preferable, but my stick is now updated and I'm not planning to reflash.

Putting this here in case this helps other people or this could help improve the flasher script.

MattWestb commented 2 years ago

Great findings !!

Wot i knowing is all "standard" Silabs bootloaders (EM35X and EFR32) if not cooking one self with other settings is using no flow control and baudrate 115200.

travisghansen commented 2 years ago

Yes, thank you for sharing..I hit this exact issue!

mloffer commented 2 years ago

I also ran into this going from 6.6.5 -> 6.7.8. Removing xonxoff from the script did the trick.

CTOJoe commented 2 years ago

Was experiencing the same issue. Removing xonxoff from the # Open new connection block fixed the issue for me.

dkmcgowan commented 2 years ago

this happened to me as well, I changed the same line to disable xonxoff just for the one connection where it was not using the CEL variable for xonxoff, seems to have worked fine for me

thechickenmoo commented 2 years ago

Same. Had to unplug/replug the adapter after my initial hang/fail, restart the docker container, install nano (apt-get install nano) and modify the file (nano ./ncp.py). I also mistakenly edited the wrong section the first time. (#Init Serial Port Section instead of #Open New Connection)

This did indeed fix the problem.

lefebp commented 2 years ago

Had the same issue, commenting xonxoff=True also worked for me.

Thank you!

techguydave commented 2 years ago

Just chiming in to say this fix also worked for me!

brandon-dacrib commented 2 years ago

+1 same fix today, can I submit a PR so that the next person doesn't have this problem?

btyeung commented 2 years ago

+1 also worked for me, linux (kubuntu) with nortek

GroupeFMY commented 2 years ago

WOW thanks waisted so much time before finding this little info. Thanks works a1

mwpastore commented 1 year ago

Oh man, I thought I had a bad flash and I've been trying to short those two frustratingly tiny pads for the past hour to get into the bootloader via minicom. I got it to flash after this patch... thank you!

instantdreams commented 1 year ago

This fixed the issue for me. Here's the commands I used:

$ docker run --rm --device=/dev/ttyUSB1:/dev/ttyUSB1 -it walthowd/husbzb-firmware bash
# apt install nano
# nano ./ncp.py

Locate function flash and find comment # Open new connection Commend out line xonxoff=True Exit and write buffer

# ./ncp.py scan
Connecting to.. /dev/ttyUSB1 57600 True False
{"ports": [{"port": "/dev/ttyUSB1", "vid": "10C4", "pid": "8A2A", "deviceType": "zigbee", "stackVersion": "5.4.1-194"}]}

# ./ncp.py flash -p /dev/ttyUSB1 -f ncp-uart-sw-6.7.8.ebl
Restarting NCP into Bootloader mode...
CEL stick
EM3581 Serial Bootloader v5.4.1.0 b962

Successfully restarted into bootloader mode! Starting upload of NCP image...
Finished!
Rebooting NCP...

# ./ncp.py scan
Connecting to.. /dev/ttyUSB1 57600 True False
{"ports": [{"port": "/dev/ttyUSB1", "vid": "10C4", "pid": "8A2A", "deviceType": "zigbee", "stackVersion": "6.7.8-373"}]}

Success!

quincarter commented 1 year ago

i can confirm this works. Just follow what these people have said. :) Thanks a bunch. I was hung up here. Glad i dove into the issues section.

root@d74e4d43563d:/tmp/silabs# ./ncp.py flash -p /dev/ttyUSB1 -f ncp-uart-sw-6.7.8.ebl
Restarting NCP into Bootloader mode...
CEL stick
EM3581 Serial Bootloader v5.4.1.0 b962

Successfully restarted into bootloader mode! Starting upload of NCP image...
Finished!
Rebooting NCP...
root@d74e4d43563d:/tmp/silabs# ./ncp.py scan
Connecting to.. /dev/ttyUSB1 57600 True False
{"ports": [{"port": "/dev/ttyUSB1", "vid": "10C4", "pid": "8A2A", "deviceType": "zigbee", "stackVersion": "6.7.8-373"}]}
derekgorcz commented 1 year ago

Also worked for me. Rather than installing nano or vim, you can also use the already installed sed to delete the line(for me 322).

  1. You can verify line number with this command:
    root@cc611c1f6039:/tmp/silabs# sed -n 322p ncp.py 
        xonxoff=True
  2. If you see the "xonxoff=True" response, delete it with:
    root@cc611c1f6039:/tmp/silabs# sed -i 322d ncp.py 
  3. Verify the delete worked:
    root@cc611c1f6039:/tmp/silabs# sed -n 322p ncp.py 
    )
  4. Run the script as documented.
quietsnow commented 1 year ago

I have the Home Assistant Blue, so I had to add a number of packages (in working memory, since it runs on Alpine Linux). Here are the series of commands that got this working (and of course, I had to comment out line 322 from 'ncp.py' that used to say 'xonxoff=True' along w/ the ',' in the line above - thank you, this was key)...

git clone https://github.com/walthowd/husbzb-firmware.git && cd husbzb-firmware
apk update
apk add python3
apk add python3 py3-pip
apk add py3-pyserial
pip3 install xmodem
ln -s /usr/bin/python3 /usr/bin/python
./ncp.py scan
./ncp.py flash -p /dev/ttyUSB1 -f ncp-uart-sw-6.7.8.ebl

And then a simple reboot and all those things disappear and after a while it all comes back up and works beautifully. Thanks again!

samuelmcconnell commented 11 months ago

Another note that ncp.py was hanging when attempting to restart the stick into bootloader mode, and commenting out xonxoff allowed me to flash the firmware successfully.

fireheadman commented 10 months ago

+1 worked for me also....

xanderphillips commented 9 months ago

I have had issues with the USB port not apparently providing enough power causing it to not work. Using a powered hub seems to address the issue quite well.

jeremyforest commented 7 months ago

+1 worked for me also