OTA capabilities are a mandatory feature for all Z-Wave 700 end-devices. The Z-Wave 700 Embedded Framework already implements the feature, but you need to make sure to flash the OTA bootloader and a set of encryption keys.
Example: Firmware update of Switch On Off Sample Application
It is worth knowing the following default locations:
Sample app location
C:\Users\almunkha\SimplicityStudio\v4_workspace\SwitchOnOff\GNU ARM v7.2.1 - Debug
The serial number / Device ID of the device must also be known (e.g. can be seen in Simplicity Studio). The board we are using in this example have ID 440147067.
--- Pre-work: KEYS Step A: Generate the needed keys
This generates 1 file in the same location as the commander
* vendor_encrypt.key
--- Pre-work: Create firmware for initial setup Step C: Using Simplicity Studio, open Switch On Off sample app and compile.
This generates a Hex file that we are flashing the device with for initial setup (will be covered in Step 6).
--- Setup device with bootloader and initial firmware
The Z-Wave chips ships without bootloader, so the first step is to prepare the chip with an OTA bootloader and the initial image we will firmware update.
Info: This step is not required. If you erase the Lock Bits page, a new set of S2 Private/Public key will be generated automatically by the application image. For more info on Lock Bits page, refer to Z-Wave 700: Where are the S2 keypair stored?.
In addition: If you do erase the Lock Bits page, then it is important to flash the bootloader (step 5) and the application image (step 6) before flashing the generated keys (step 7) just like instructed in this KB.
This generates 1 new file that we will be using for OTA update
* appname_mySwitch.gbl
--- And finally; the OTA update Step 12: OTA update
Use PC Controller to start OTA update using location for file appname_mySwitch.gbl.
When file is selected, click on 'Update' which starts the OTA update.
NB: If using the PC Controller for the OTA update, make sure to use version 5.38 or later.
--- RESULT
Firmware Update Md Status Report can be seen in both PC Controller GUI or in Zniffer trace.
Status 0xFF = success
Z-Wave
Knowledge Base Articles
in step 7
Step 7: Program the generated keys from the pre-work
should the vendor_encrypt.key be a token file, e.g (-tokens.txt)
Note that the number in RED - in this case 440147067 - is your specific 700 series Devkit serial number. You can see this number in the upper left corner of Simplicity Studio. It's number in () in the debug adapters.
For example my Devkit is : "J-Link Silicon Labs (440107359)" so I would use "440107359" instead of the number above.
1
I have a somewhat easier method. Below are two scripts you can use.
1) GenGblToken.bat is run ONCE when you first create the project. And then is NEVER run again!
2) Build the application with the new tokens and program into the DUT via JLink (hardwire)
3) run PgmToken.bat to program the tokens into the DUT. You run this with EVERY DUT you build/ship.
Then you can OTA the files with the fully encrypted and signed keys and you know your firmware is protected.
Note that it is VERY important to change the Post-Build step in Simplicity Studio as described in GenGblToken.bat
While these are Windows batch files the commands are basically the same for other platforms - just change REM to # or whatever comment character is needed.
I am upgrading gateway stack to 7.11, and test with the ZGM130S(flashed with ZW_SerialAPI_Controller_7.11.0_45_ZGM130S_REGION_US).
I use FUNC_ID_ZW_FIRMWARE_UPDATE_NVM(0x78) to try OTW, and I got the response:
"SerialAPI: Command: 0x78 is not supported by this SerialAPI"
2. What is the difference between .gbl file and the .otz file? How do I use .gbl file to do OTW? Can I?
In 6.81.x, I can use .otz file for the OTW function, and it works.
But in 7.11, I can't find the .otz file, I find the .gbl file and I don't know how to use it to do OTW.
1
Piz Wang, No, 700 series does not support OTW. Instead you use commander to program the ZGM130 or EFRZG14 using the normal ARM programming pins. This makes the chip cheaper because it does not have to have double the flash to hold the OTW image. Instead it is up to the host to store the image and then just reprogram the 700 series chip.
0
Having followed this, I was able to update OTA. Subsequent testing now throws 0x03 (Not Upgradable), irrespective of changes to APP_REVISION. DrZwave - I used your post-build step trick. Any ideas as to where I should look next?
Pete
0
I have one question about this :
One customer has many devices(example: 30 devices) , can I send one OTA file to him for update ?
0
@Yong
IFF all devices are of the exact same type, then yes you can.
What you SHOULD do is to create different vendor_sign.key & vendor_encrypt.key for each device TYPE. That way only the correct file is load to the correct device TYPE.
0
@Peter Milligan,
I do not know why they didn't answer.
When you build the project, the post-build step uses those same keys to generate the *.gbl file which is the OTA file.
If you do not build the *.gbl file with the same keys that you program into the device, it will not work.
0
Wondering what does the AES key do? Encryption for what? Thanks.
Z-Wave 700: OTA of End-Device
Question
How do I OTA update an end-device?
Answer
OTA capabilities are a mandatory feature for all Z-Wave 700 end-devices. The Z-Wave 700 Embedded Framework already implements the feature, but you need to make sure to flash the OTA bootloader and a set of encryption keys.
Example: Firmware update of Switch On Off Sample Application
It is worth knowing the following default locations:
C:\SiliconLabs\SimplicityStudio\v4\developer\adapter_packs\commander*
C:\SiliconLabs\SimplicityStudio\v4\developer\sdks\zwave\v7.11.0\Apps\bin
C:\Users\almunkha\SimplicityStudio\v4_workspace\SwitchOnOff\GNU ARM v7.2.1 - Debug
The serial number / Device ID of the device must also be known (e.g. can be seen in Simplicity Studio). The board we are using in this example have ID 440147067.
--- Pre-work: KEYS
Step A: Generate the needed keys
This generates 3 files in the same location as the commander.
* vendor_sign.key
* vendor_sign.key.pub
* vendor_sign.key-tokens.txt
Step B: Generate encryption key
This generates 1 file in the same location as the commander
* vendor_encrypt.key
--- Pre-work: Create firmware for initial setup
Step C: Using Simplicity Studio, open Switch On Off sample app and compile.
This generates a Hex file that we are flashing the device with for initial setup (will be covered in Step 6).
--- Setup device with bootloader and initial firmware
The Z-Wave chips ships without bootloader, so the first step is to prepare the chip with an OTA bootloader and the initial image we will firmware update.
Step 1: Erase Flash
Step 2: Reset
Step 3: Erase bootloader
Step 4: Erase Lock Bits page
Info: This step is not required. If you erase the Lock Bits page, a new set of S2 Private/Public key will be generated automatically by the application image. For more info on Lock Bits page, refer to Z-Wave 700: Where are the S2 keypair stored?.
In addition: If you do erase the Lock Bits page, then it is important to flash the bootloader (step 5) and the application image (step 6) before flashing the generated keys (step 7) just like instructed in this KB.
Step 5: Flash the OTA bootloader image
The Device is now ready to be flashed with firmware image.
--- Flash initial device firmware.
We will be using the Commander for this as well, but it can also be done using Simplicity Studio.
Step 6: Write sample app to flash
NB: You must have completed Step C.
--- Flash keys
Step 7: Program the generated keys from the pre-work
Step 8: Reset device
--- Include device into Z-Wave network
The chip is now setup with OTA bootloader and an initial image.
Step 9: Readout DSK
Readout the DSK by either using Commander or Simplicity Studio.
Step 10: Include DUT into network
Using PC Controller.
Step 11: Get version to prepare for OTA
Using 'OTA Firmware Update' tab in PC Controller.
The firmware version should be (for Z-Wave SDK 7.11): 10.11
--- Pre-work: Create OTA firmware image
Before proceeding with the firmware update, we need to build a new version of the sample app.
Step D: In Simplicity Studio, make sure to increment the version of the firmware.
Eg change version to:
This will increment the firmware version to (for Z-Wave SDK 7.11): 10.12
Build to generate a new hex file.
Step E: Create gbl file to be used for OTA.
This generates 1 new file that we will be using for OTA update
* appname_mySwitch.gbl
--- And finally; the OTA update
Step 12: OTA update
Use PC Controller to start OTA update using location for file appname_mySwitch.gbl.
When file is selected, click on 'Update' which starts the OTA update.
NB: If using the PC Controller for the OTA update, make sure to use version 5.38 or later.
--- RESULT
Firmware Update Md Status Report can be seen in both PC Controller GUI or in Zniffer trace.
Status 0xFF = success
in step 7
Step 7: Program the generated keys from the pre-work
should the vendor_encrypt.key be a token file, e.g (-tokens.txt)
Note that the number in RED - in this case 440147067 - is your specific 700 series Devkit serial number. You can see this number in the upper left corner of Simplicity Studio. It's number in () in the debug adapters.
For example my Devkit is : "J-Link Silicon Labs (440107359)" so I would use "440107359" instead of the number above.
I have a somewhat easier method. Below are two scripts you can use.
1) GenGblToken.bat is run ONCE when you first create the project. And then is NEVER run again!
2) Build the application with the new tokens and program into the DUT via JLink (hardwire)
3) run PgmToken.bat to program the tokens into the DUT. You run this with EVERY DUT you build/ship.
Then you can OTA the files with the fully encrypted and signed keys and you know your firmware is protected.
Note that it is VERY important to change the Post-Build step in Simplicity Studio as described in GenGblToken.bat
While these are Windows batch files the commands are basically the same for other platforms - just change REM to # or whatever comment character is needed.
1. Does Z-Wave 700 support OTW?
I am upgrading gateway stack to 7.11, and test with the ZGM130S(flashed with ZW_SerialAPI_Controller_7.11.0_45_ZGM130S_REGION_US).
I use FUNC_ID_ZW_FIRMWARE_UPDATE_NVM(0x78) to try OTW, and I got the response:
"SerialAPI: Command: 0x78 is not supported by this SerialAPI"
2. What is the difference between .gbl file and the .otz file? How do I use .gbl file to do OTW? Can I?
In 6.81.x, I can use .otz file for the OTW function, and it works.
But in 7.11, I can't find the .otz file, I find the .gbl file and I don't know how to use it to do OTW.
Having followed this, I was able to update OTA. Subsequent testing now throws 0x03 (Not Upgradable), irrespective of changes to APP_REVISION. DrZwave - I used your post-build step trick. Any ideas as to where I should look next?
Pete
I have one question about this :
One customer has many devices(example: 30 devices) , can I send one OTA file to him for update ?
@Yong
IFF all devices are of the exact same type, then yes you can.
What you SHOULD do is to create different vendor_sign.key & vendor_encrypt.key for each device TYPE. That way only the correct file is load to the correct device TYPE.
@Peter Milligan,
I do not know why they didn't answer.
When you build the project, the post-build step uses those same keys to generate the *.gbl file which is the OTA file.
If you do not build the *.gbl file with the same keys that you program into the device, it will not work.