Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suggestion -- provide minicom script for 700 series Controller Firmware Updates doc #14

Closed
mattdm opened this issue Feb 11, 2022 · 26 comments

Comments

@mattdm
Copy link

mattdm commented Feb 11, 2022

Rather than separate stty and printf commands, I think it's less error-prone to just do it all with minicom. Include the following script (note hex had to be converted to octal):

print "Soft-reset the controller"
send "\1\3\0\10\364"

print "Waiting for the controller to recover. You may see some junk"
print "characters printed to the screen. This is normal."
sleep 10

print "Dropping controller to bootloader."
send "\1\3\0\47\333"

print "This should be followed by 'Gecko Bootloader ...' and a menu."
print "Pick #3, then use xmodem to upload your firmware gbl when it "
print "starts printing CCCC.... (press Ctrl-a then s, then pick with "
print "<spacebar> and press <enter> to upload)."
print ""
print "When complete, pick #2 (run). You'll see the sequence of junk "
print "characters again -- that means it's working! Ctrl-A q to exit."
sleep 1

Save that as 700firmware.runscript and then start minicom with

minicom -o -S 700firmware.runscript zwave

Actually, I think -o can actually be omitted as your zwave config doesn't send an init string. So just:

minicom -S 700firmware.runscript zwave

This could be enhanced to use the expect runscript command to find the menu, and even call sx to upload the firmware automatically, but that's probably overkill (and at that point maybe minicom isn't the right tool anyway).

Also of note — if you're in the dialout group in most distros, no need to be root, and you can put the minicom zwave config at ~/.minirc.zwave instead of in /etc.

@kpine
Copy link
Owner

kpine commented Feb 12, 2022

Thanks! I assumed this could all be scripted with minicom, but didn't know the syntax. I'll try this out in the future and update.

This could be enhanced to use the expect runscript command to find the menu, and even call sx to upload the firmware automatically, but that's probably overkill (and at that point maybe minicom isn't the right tool anyway).

Probably overkill for the purpose here. zw_programmer is much better for this, but it's not accessible to most, and last time I wasn't able to update my Zooz (UZB7 was fine).

Also of note — if you're in the dialout group in most distros, no need to be root, and you can put the minicom zwave config at ~/.minirc.zwave instead of in /etc.

Yeah, I'm aware of that, but it's easier to just say "be root" then try to guide someone through the process of setting up/verifying group membership. I agree though, and will see if I can simplify to this.

@mattdm
Copy link
Author

mattdm commented Feb 12, 2022

I haven't scripted anything in minicom since, like, 1999, but I still remembered it was there. :) The main quirk is not having a syntax to specify characters in hexadecimal, just octal. But that's easy enough to change.

It wouldn't be too hard to write something in python, at least assuming that the Gecko menu doesn't change formatting. Hmmm. I guess I should take that thought somewhere other than your github issue. :) But anyway, thanks for the guide -- Zooz tech support was all like "you'll need Windows" and I felt like I was transported to 2003 or something.

@Sudo-Rob
Copy link

I'm having problems with the procedure and this script, but I should start off by stating this is my first experience with minicom. I've used other terminal packages such as Putty. FYI, I'm trying to update a Zooz ZST10-700.

When trying to figure out how to configure minicom (requires the -s CLI option), I struggled with the three lines of configurations under Preparation, step 4. Ultimately, I just copied your configuration into /etc/minicom, made sure it could be loaded into minicom, and verified the settings by stepping though the configuration menu.

I then exited and used the Installation shell commands, which all seemed to work until I got to step 4. Executing the command minicom -o zwave just returned to the shell.

At this point, I tried Matt's script, but minicom returned 'cannot open $USBPATH: No such file or directory', I went back to the shell command at Preparation, step 3 and tried again. Unfortunately, I get the same diagnostic.

I'm out of ideas. Any suggestions?

@kpine
Copy link
Owner

kpine commented Feb 16, 2022

You'll want to copy and paste the entire cat command as it's listed. The $USBPATH environment variable (set in step 3) is expanded and stored in the config file. The fact that the minicom error message includes that text tells me that you just copied the lines of config into the file, instead of using the cat command.

@Sudo-Rob
Copy link

Thanks for the timely info. The firmware was uploaded, moved to the HA host, and it seems like it's working.

@Sudo-Rob
Copy link

Perhaps I spoke too soon. It's still reporting Firmware: 7.15.

@Sudo-Rob
Copy link

Third time's a charm. Thanks for the help.

R

@kpine
Copy link
Owner

kpine commented Feb 26, 2022

A non-interactive upgrade, without any sanity checks, might be as simple as:

sudo apt -y install lrzsz
export USBPATH=/dev/ttyUSB0
stty 115200 cs8 -cstopb -F $USBPATH
printf '\x01\x03\x00\x08\xf4' > $USBPATH && sleep 10
printf '\x01\x03\x00\x27\xDB' > $USBPATH && sleep 1
echo 1 > $USBPATH
sx GBLFILE < $USBPATH > $USBPATH
echo 2 > $USBPATH

The problem with trying new approaches is that you don't get much chance to test. Once the firmware is updated, it's impossible to upload another one until a new version is released. At best, you can check that an error is reported (happens when updating the same file) and deal with that.

@kpine
Copy link
Owner

kpine commented May 6, 2022

Due to the risk of making changes and the inability to test those changes, I'm going to keep the guide as-is.

If you're looking for a script, one was provided in this discussion: #18.

@kpine kpine closed this as completed May 6, 2022
@clarkminor
Copy link

For what it's worth, I wasn't able to it to get it working using the stty and printf hex approach. Launching minicom just displayed garbled characters. It either wasn't dropping into the bootloader correctly or my minicom display settings were just messed up somehow.

Regardless, @mattdm's minicom runscript approach worked like a charm. Here's my basic all-in-one script:

#!/bin/bash

USBPATH=/dev/ttyUSB0
FILEDIR=/tmp
BAUDRATE=115200
PROFILE=zwave

cat > "/etc/minicom/minirc.${PROFILE}" << EOF
# Machine-generated file - use "minicom -s" to change parameters.
pu pname1           YUNYY
pu pname2           YUNYY
pu pname4           NDNYY
pu pname5           NDNYY
pu pname6           YDNYN
pu pname7           YUYNN
pu pname8           NDYNN
pu pname9           YUNYN
pu updir            $FILEDIR
pu port             $USBPATH
pu baudrate         $BAUDRATE
pu bits             8
pu parity           N
pu stopbits         1
pu rtscts           No
EOF

read -r -d '' MINICOM_RUNSCRIPT << EOM
print "Soft-reset the controller"
send "\1\3\0\10\364"
sleep 10
print "Dropping controller to bootloader."
send "\1\3\0\47\333"
sleep 1
EOM

minicom -S <(cat <<< "$MINICOM_RUNSCRIPT") $PROFILE

@raman325
Copy link

raman325 commented Jun 2, 2022

This works for Macs (tested on an M1 Air) - Use this script, but look for the /dev/cu.usbserial-* device instead of the TTY device for the USBPATH. In addition, the minicom profile needs to be catted to {HOMEBREW_DIR}/Cellar/minicom/{MINICOM_VERSION}/etc instead of /etc/minicom

EDIT: of course the prerequisite is to install the dependencies via homebrew. Unclear on how this would be done via macports

@kpine
Copy link
Owner

kpine commented Jun 2, 2022

Nice! 🎉 I'll incorporate both of these into the guide.

@raman325
Copy link

raman325 commented Jun 2, 2022

also I did not need to drop into root to do this, I did this all in userland

@ryanpacker
Copy link

I've followed the modified instructions provided by @clarkminor and @raman325 (thank you both), but no luck.

  • I'm on an m1 mac so I created the minicom zwave profile at /opt/homebrew/Cellar/minicom/2.8/etc/minirc.zwave
  • I then create the MINICOM_RUNSCRIPT via the read -r -d ... command from above
  • I then run minicom -S <(cat <<< "$MINICOM_RUNSCRIPT") zwave and see the expected Welcome to minicom 2.8, the messages from the MINICOM_RUNSCRIPT, Gecko Bootloader v1.7.1 and the bootloader prompt.
  • I select xmodem and navigate to the gbl file for upload, but then I get a "Cannot create lockfile!" message.

I hope I'm missing something obvious. Not really sure where to go from here. Any help would be greatly appreciated.

@miguelarios
Copy link

I too am experiencing the issues @ryanpacker is facing. Seems it is a perms issue maybe?

@miguelarios
Copy link

miguelarios commented Jul 22, 2022

OK so was able to go through it all but I did not have any luck with updating the firmware. It still shows the old 7.15 instead of the 7.17... I just added sudo prior to running the script and this made it go all the way through the steps but at the end when I plug it back into my server and launch zwavejs i don't see it. I even ran a soft reset per the last step in the instructions and nothing. I am not sure if I am missing something.

@raman325 do you have any suggestions?

@jafoobari
Copy link

I'm having same issue as @miguelarios. I'm using the script from @clarkminor and am getting all the output I would expect (I think). But firmware still ultimately shows as 7.15. (I'm on a MBP running macOS 11.6.5).

Script I have saved as fwupdate.sh:

#!/bin/bash

USBPATH=/dev/cu.usbserial-141410
FILEDIR=/tmp
BAUDRATE=115200
PROFILE=zwave

cat > "/usr/local/Cellar/minicom/2.8/etc/minirc.${PROFILE}" << EOF
# Machine-generated file - use "minicom -s" to change parameters.
pu pname1           YUNYY
pu pname2           YUNYY
pu pname4           NDNYY
pu pname5           NDNYY
pu pname6           YDNYN
pu pname7           YUYNN
pu pname8           NDYNN
pu pname9           YUNYN
pu updir            $FILEDIR
pu port             $USBPATH
pu baudrate         $BAUDRATE
pu bits             8
pu parity           N
pu stopbits         1
pu rtscts           No
EOF

read -r -d '' MINICOM_RUNSCRIPT << EOM
print "Soft-reset the controller"
send "\1\3\0\10\364"
sleep 10
print "Dropping controller to bootloader."
send "\1\3\0\47\333"
sleep 1
EOM

minicom -S <(cat <<< "$MINICOM_RUNSCRIPT") $PROFILE

Then I run: sudo bash fwupdate.sh. And get this output:

Welcome to minicom 2.8                                                                                           
                                                                                                                 
OPTIONS:                                                                                                         
Compiled on Jan  4 2021, 00:04:46.                                                                               
Port /dev/cu.usbserial-141410, 12:39:05                                                                          
                                                                                                                 
Press CTRL-A Z for help on special keys                                                                          
                                                                                                                 
Soft-reset the controller                                                                                        
Dropping controller to bootloader.                                                                               
?                                                                                                                
Gecko Bootloader v1.12.01                                                                                        
1. upload gbl                                                                                                    
2. run                                                                                                           
3. ebl info                                                                                                      
BL >                                                                                                             
begin upload                                                                                                     
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC                                                           
Gecko Bootloader v1.12.01                                                                                        
1. upload gbl                                                                                                    
2. run                                                                                                           
3. ebl info                                                                                                      
BL >                                                                                                             
                                                                                                                 
      ?                                                                                                          
                                                                                                                 
           ?                                                                                                     
                                                                                                                 
                ?                                                                                                
                                                                                                                 
                     ?      

The only thing that seemed suspect to me was after I went through the steps to upload the firmware there wasn't an explicit confirmation of the successful upload. The bootloader just seemed to restart on its own after awhile. So I assumed that meant the upload was successful but maybe not?

@raman325
Copy link

mea culpa, I thought the operation was successful on my M1 Mac but didn't look closely enough at the firmware version. The installation silently failed but appeared to work. I was unable to get this to work using my M1 Mac... Sorry for sending anyone on a wild goose chase.

@jspizziri
Copy link

@kpine can you remove the documentation for macOS (see above). It appears macOS working was a false positive.

@jspizziri
Copy link

jspizziri commented Sep 10, 2022

For all the macOS users. (@raman325, @jallen92, @miguelarios ) I eventually gave up and simply created a bootable USB with Ubuntu 22.04 on it, booted from the usb on my Mac (a little annoying because you first have to boot into recovery mode to configure a setting to allow booting from external media). note: I did not install ubuntu on a partition, that's not necessary, I just ran it from the usb. You'll probably need an Ethernet connection for your Mac if you go this route as Ubuntu 22.04 doesn't seem to ship with the correct Wi-Fi driver (at least for my model, so you can't install minicom etc). I also needed an external mouse and keyboard for similar driver issues.

Once I booted from the USB I just followed the standard update instructions and it all worked fine.

This may seem like a lot of trouble (which it was), but I didn't have another machine available to do this on, so this got me over the hump. But all you need is a 4Gb usb, mouse, keyboard, and Ethernet dongle.

@kpine as a side note, I successfully ran the update from Ubuntu 22.04.

@pleblancq
Copy link

I'm a macOS user and I successfully updated twice using the bash script & minicom from brew. see this

@kpine
Copy link
Owner

kpine commented Jan 23, 2023

Z-Wave JS now supports OTW updates natively, and Z-Wave JS UI 8.8.0 has now added support for that in its UI. I would suggest giving that a try now instead.

@miguelarios
Copy link

Z-Wave JS now supports OTW updates natively, and Z-Wave JS UI 8.8.0 has now added support for that in its UI. I would suggest giving that a try now instead.

This can be used with firmware meant for the controller then?

@kpine
Copy link
Owner

kpine commented Jan 30, 2023

Yes, controller firmware updates are the topic of discussion here.

@miguelarios
Copy link

Yes, controller firmware updates are the topic of discussion here.

Just being explicit at the expense of stating the obvious 😀

@kpine
Copy link
Owner

kpine commented Jan 30, 2023

I recently updated the wiki with respect to this, take another look. https://github.com/kpine/zwave-js-server-docker/wiki/700-series-Controller-Firmware-Updates-(Linux)#firmware-update-instructions

I've removed minicom instructions entirely at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants