ZWP500
™
Z-Wave Production Programmer & Tester
www.ExpressControls.com
February 2018
Bringing
the Internet of Things (IoT) to Life
16
FlashDownload
The FlashXXX commands are not normally needed by most users who can rely on the Python code included with the
ZWP500. The FlashXXX commands are documented here for users who want to fully customize the platform for their own
needs. Typically the sample Python code is used to provide higher level functions for programming.
Download the intel hex format file to be programmed into the DUT. The PSoC will send an ACK ($) character when it is
ready for each line of the hex file. The program sending the hex file MUST wait for the ACK before sending each line of
the file. If the checksum fails or there was a data corruption, a NAK (~) character is returned. The program should resend
the line if a NAK is received. The PSoC will pause every few lines while it writes the data to FLASH. Note that only Intel
Hex record type 04 is supported to set the upper address bits of the 128K byte image. The tools used to develop Z-Wave
code only use this record type.
Example:
#
Host
PSOC
Comment
1
FlashDownload<cr>
Initiate the command
2
FlashDownload<cr>
PSOC echoes the command
3
*<cr>
PSOC ACKs the command
4
WAIT up to 5s for the PSOC to setup the flash area
5
$<cr>
PSOC is ready for a line from the HEX file
A ~<cr> will be sent if the previous line checksum failed
6
send one line of HEX file
Host sends a line from the HEX file
7
WAIT up to 2s for the PSOC to process the line
8
Repeat steps 5 thru 7 for each line of the hex file
9
:00000001FF<cr>
Last line of HEX file
10
Wait up to 10s final check sum calculation
11
*<cr>
ACK download is complete and CRC is good.
!<cr> indicates a failure
12
Typically send a FlashCRC at this point to read the
calculated CRC value of the HEX file.
FlashErase
Erase the DUT FLASH. The NVR settings are retained but the rest of the DUT FLASH is reset to all ones. This command
is not normally needed as the FLASH is automatically erased during programming but is provided for completeness.
FlashWrite
Writes the downloaded Intel Hex file into the DUT. The DUT NVR must be read PRIOR to executing this command using
the NVRGet command. The DUT FLASH is erased, the NVR values are written, then the hex file is programmed into the
DUT. The CRC within the DUT is computed to ensure the hex file was programmed without error. If the CRC fails to
match then a NAK (!) is returned. This process takes several seconds to complete.
NOTE! It is REQUIRED to execute an NVRGet BEFORE issuing a FlashWrite! Each DUT typically has data in the NVR
pre-programmed by Sigma in the NVR and these values must be read before being erased and then restored. The NVR
values for TXCAL1 and TXCAL2 must be checked and if they are 0xFF then a calibration cycle must be run prior to
programming FLASH. Note that the TXCAL1/2 values must be written using NVRSet before programming FLASH.
Example:
NVRGet<cr>
fetch the contents of the DUT NVR
Check the TXCAL1/2 NVR values, if 0xFF, then run Calibrate and update the TXCAL1/2 values
NVRSet …<cr>
Adjust any NVR values required (this may require multiple NVRSet commands)
FlashWrite<cr>
Erase FLASH, Write NVR, write the hex file to FLASH, check the CRC
Returns:
*<cr> If the hex file was programmed into the DUT without error
!<cr>
if the programming failed. An error code may also be included in the message.