The UART is by default set up to 230400,8,N,1
The supported commands can be seen by writing help on the terminal
The Radio CLI tool can be used to test the radio functionality of a Z-Wave board
Default UART configuration uses UART0 (pin 16,17) set to 230400,N,8,1 The UART configuration can be changed but requires a recompilation of the project.
Here are some examples of setting up Z-Wave in the radio CLI
Setting up the radio for the US region and transmit a default frame at the 100kbps channel with Tx power 0dBm
This should transmit one frame on the US region 100kbps frequency
The Radio Test Tool can be setup to enable a continuous unmodulated carrier signal on a specific channel in a specific Z-Wave region. This example makes a continuous unmodulated carrier signal on Z-Wave region US_LR, channel 0 (100kbit GFSK channel).
This should enable a measurable unmodulated carrier signal at 916 MHz
To stop carrier signal do a power off/reset of device
Using Radio Test Tool for determining which state the RF radio is in by routing radio state to GPIO pins
To turn the radio debug feature off again use the command
When the CLI tool is flashed into the CZ20, it allows the CZ20 to be controlled from a serial connection to a terminal program such as PuTTY. The serial settings are 230400 baud, 8 data bits, no parity, 1 stop bit, and implicit CR after a LF should be enabled.
The help command will list all of the available commands in the CLI tool. In addition to using commands to control the CZ20 in real time, up to five scrips can be stored in the CZ20 (script 1 thru script 5). Any of these scripts can be executed from the command line interface without the need to retype each command in the script. In addition to executing a script from the command line, the CZ20 can also be configured to execute one of the scripts following a reset or at power up. This is very helpful if you need to have the device go into a specific mode of operation for testing when a battery is installed, without the need for a physical connection to a terminal.
This feature can especially be usefull when doing RF regulatory compliance testing (like FCC) where a console connection to the device under test is not possible during testing.
As an example, suppose you wanted the device to go into receive mode on the 916 MHz classic Z-Wave channel on power up by storing a configuration in Script 3.
First enter following line followed by a 'return'
The CLI tool will return
Next enter the commands/lines followed by a 'return' needed for the script
The .done command saves the script. The CLI will on the terminal return
To check the contents of Script 3, enter following on the terminal
This will print out Script 3 contents on the terminal.
To execute Script 3 while the terminal is connected enter
If you wish to have Script 3 execute on powerup, type
The CLI tool will return on the terminal
At this point, the device can be disconnected from the terminal and Script 3 will be executed whenever the device powers up or resets.
Script commands including start, stop, autoon, autooff, list and clear can be found by using the 'help' commmand when the device is connected.
The radio CLI supports editing existing scripts without retyping everything from scratch. Use the script edit command to load and modify an existing script:
This will:
For loading multiple lines from your clipboard, use script load which completely bypasses the CLI parser and writes raw input directly to the script:
This mode is ideal when you have a list of commands in a text file and want to load them all at once. The CLI will:
Load Mode Commands:
.done - Save script and exit load mode.cancel - Discard changes and exit load mode.list - Display current script lines.help - Show load mode helpNote: Load mode bypasses all embedded-cli parsing. Each line is stored as raw text. Advanced editing commands (.replace, .delete, .insert) are not available in load mode. Use script edit after saving if you need to modify specific lines.
While in script entry or edit mode, special dot commands are available to manipulate script lines:
.replace N command - Replace a line
Replace an existing line with a new command:
.delete N - Delete a line
Remove a line from the script (shorthand .del also works):
.insert N command - Insert a line
Insert a new line before the specified position (shorthand .ins also works):
.clear - Clear all lines
Delete all lines in the current script:
.list - Show current script
Display all lines with line numbers and capacity:
.done - Save and exit
Complete script entry and save to flash memory:
.cancel - Exit without saving
Cancel script entry and discard changes:
.help - Show command help
Display all available commands in script entry mode.
Complete example of creating and then modifying a script:
Step 1: Create initial script
Step 2: Edit the script to change region and add commands
Step 3: Verify the changes
| Command | Description |
|---|---|
script start N | Create a new script (clears existing) |
script edit N | Edit an existing script |
script load N | Load mode (no tab-complete) for bulk entry |
run N | Execute a script |
script list [N] | List script(s) - omit N to list all |
script autoon N | Enable autorun for script N on boot |
script autooff | Disable autorun |
script clear N | Delete script N |
script stop | Stop currently running script |
Below are scripts that may be helpful for making the device transmit or receive on various North American channels on power up.
The following commands can be used in the Radio CLI tool
| Command | Parameters | Description |
|---|---|---|
| zw-region-set | Region (0-103) - Region number | Set the desired Z-Wave region. Supported region numbers can be shown by running the zw-region-list command |
| zw-region-list | n/a | Lists current region and all supported regions |
| zw-init | n/a | Initialize the Z-Wave PHY layer to the region specified with the zw-region-set command |
| zw-homeid-set | HomeID (hexadecimal) - HomeID for receive filtering | Set the desired Z-Wave HomeID for use in receive filtering |
| zw-nodeid-set | NodeID (decimal, 0-239 for classic, 256-1024 for LR) - NodeID for receive filtering | Set the desired Z-Wave nodeID for use in receive filtering |
| zw-tx-payload-set | payload (hexadecimal) | Set the frame payload in hexadecimal bytes, If fewer than 9 bytes are provided, the default payload will be used |
| zw-tx-data-set | hex bytes (hexadecimal) | Set the frame data in hexadecimal bytes. Wraps data in Z-Wave frame: HomeID+Src+FC+Len+Dst+data (radio adds CRC). Src uses zw-nodeid-set value, Dst uses zw-tx-destid-set value. Example: zw-tx-data-set 20 01 FF (Basic Set ON) |
| zw-tx-channel-set | channel (0-3), actual channel range follows region setup - channel number | Set the transmit channel number |
| zw-tx-destid-set | destination node ID (0-239 and 255 for classic, 256-4095 for LR) | Set transmit destination node ID. Used by zw-tx-data-set and frame construction commands |
| zw-tx-srcid-set | source node ID (0-239 and 255 for classic, 256-4095 for LR) | Set transmit source node ID. Used by zw-tx-data-set and frame construction commands |
| zw-tx-homeid-set | home ID (32-bit hexadecimal, 0x00000000 - 0xFFFFFFFF) | Set transmit home ID. Used by zw-tx-data-set and frame construction commands (different from zw-homeid-set which sets receive filter) |
| zw-tx-power-set | Tx power (-20 to +20 dBm). Optional: powerindex to map Tx power to radio power index until next reset | Set the transmit power |
| zw-tx-power-index-list | n/a | List current active Tx power to radio powerindex conversion table - for current selected region and channel |
| zw-classic-tx-power-enable | Classic Z-Wave Tx power control on none lr channels (on/off) - if on then Tx power on none lr channels are set through classic Tx power settings | Enable/disable usage of classic Z-Wave Tx power settings on none lr channels |
| zw-classic-tx-power-set | Classic Z-Wave Tx power in dBm (-20-+20) - used on none lr channels if classic Z-Wave Tx power feature is enabled | Set classic Z-Wave Tx power 'normal' setting |
| zw-classic-tx-power-adjust-set | Classic Z-Wave Tx power adjust in dBm (-5-+5) - used on none lr channels if classic Z-Wave Tx power feature is enabled | Set classic Z-Wave channel power measured at a PA setting of 0dBm |
| zw-classic-tx-power-attenuation-set | Classic Z-Wave Tx power attenuation in dBm (0-20) - used on none lr channels if classic Z-Wave Tx power feature is enabled | Set classic Z-Wave Tx power setting attenuation |
| zw-tx-lbt-set | channel (0-3), actual channel range follows region setup - channel number. LBT threshold (-127-0) - Set LBT threshold in dBm, 0 equals LBT is turned off | Set transmit Listen Before Talk threshold on specified channel |
| zw-stats-get | n/a | Get network statistics from the PHY layer |
| zw-stats-clear | n/a | Clear the network statistics and set all counters to 0 |
| zw-tx-delay-set | delay (2-65535) - Interframe delay in ms | Set delay between transmitted frames when sending multiple frames |
| zw-tx-config-set | option (fail-crc) state (on/off) | Set transmit options. Currently supported: fail-crc (on/off) - intentionally send frames with bad CRC for testing |
| zw-rx-channel-set | Single channel (on/off) - Single channel mode Channel number (0-3) - Fixed channel | Switch between single channel and channel scanning mode. Single channel on → disables scanning, fixes receiver to specified channel Single channel off → enables channel scanning |
| zw-tx-max-power-set | max Tx power (14/20) - Max Tx power in dBm supported by the radio board | Set the max Tx power supported by the radio board. This command will only take effect after a reset command |
| zw-radio-tx-continues-set | state (on/off) - Set the transmit of continuous signal wave on/off Signal wave type (0/1/2) - 0 = unmodulated - 1 = modulated - 2 = modulated with whitening | Transmit an unmodulated, modulated or modulated with whitening signal wave. It is recommended to reset the module with the reset command after having sent a continuous signal wave |
| zw-radio-rf-debug-set | Debug mode (on/off) - Turn radio debug mode on or off | Set the radio debug mode on or off Pins used: RF Rx state on GPIO 21 RF Tx state on GPIO 28 RF MCU state on GPIO 0 |
| zw-radio-rf-debug-reg-setting-list | List radio register settings [0/1] - List selected radio register settings and optionally an extended number of radio register settings | List radio register settings, if parameter equals 1 list extended number of radio register settings |
| zw-radio-rssi-get | channel (0-3), actual channel range follows region setup - Get measured RSSI on channel count - optional count times delay ms - optional delay ms inbetween | Get last measured RSSI on channel, optional count times with optional delay ms inbetween (default 1000ms) |
| zw-radio-rssi-get-all | count - optional count times delay ms - optional delay ms inbetween | Get last RSSI measurement on all region channels, optional count times with optional delay ms inbetween (default 1000ms) |
| zw-radio-rssi-config-set | sample_freq - sample frequency in ms average_count - number of samples for doing RSSI average | Setup RSSI noise level to be sampled every sample_freq ms and generate an average out of average_count samples. Disable with 'zw-radio-rssi-config-set 0 0' |
| tx | repeat - number of times the frame should be transmitted | Send repeat frames |
| zw-tx-beam | <repeat> | Send Z-Wave beam followed by frame, repeat this <repeat> times with delay set by zw-tx-delay-set in between. Used for testing FLiRS/beam-wake devices. |
| zw-tx-beam-fragment | <repeats> <destid> | Transmit <repeats> Z-Wave beam fragments back-to-back to <destid>. Used for advanced FLiRS/beam timing tests. |
| rx | Rx mode (on/off) - Receive mode | Set the receiver on or off |
| stop | n/a | Stop any ongoing repeated or continuous operations. Affects: tx (repeated frames), rx (continuous receive), zw-tx-beam, zw-rx-beam, run (script execution), zw-radio-rssi-get, zw-radio-rssi-get-all. Does NOT affect one-time transmissions already in progress or configuration commands |
| zw-rx-beam | <repeat> [wakeup_ms] | Receive Z-Wave beam and frame, repeat <repeat> times with optional wakeup period [wakeup_ms] (default 1000ms). Used for testing beam reception and frame handling in power-managed or FLiRS devices. |
| timestamp | enable <on/off> - enable/disable timestamp in ms | Enable/Disable timestamp in ms on line output |
| reset | n/a | Perform a soft reset of the radio board |
| script | cmd - autoon [1-5] - enable active or specified script run on startup - autooff [1-5] - disable active or specified script run on startup - start [1-5] - start active or specified script entry - edit [1-5] - edit existing script with line editing commands - load [1-5] - bulk entry mode (bypassing CLI parser) for pasting multiple lines - stop - stop running script at next scriptline - list [1-5] - list all or specified script - clear [1-5] - clear active or specified script | Script handling makes it possible for running several commands autonomously. Note: 'script stop' stops script execution, while standalone 'stop' command stops all ongoing operations including scripts |
| run | number [1-5] - optional script number to run | Run active script or specified script number |
| wait | time - number of milliseconds before next scriptline should be executed | Wait some time before executing the next scriptline - only useful in a script |
| status | n/a | Get current status |
| gpio-pulse | Pin number (required) Pulse width in ms (required) | Create a pulse of the given milliseconds on the given pin. Example for 150 ms on pin 4: gpio-pulse 4 150 |
| gpio-output | Pin number (required) Output level high/low (optional) | Set to output the pin at the given level, default level value is low. Example to set pin 4 to high: gpio-output 4 high |
| gpio-input | Pin number (required) Pull-up option <pull-up=on/off> (optional) | Set pin as input with the given pull-up option, default is pull-up on (10K). Example to set pin 5 as input with pull-up on: gpio-input 5 pull-up=on |
| gpio-set | Pin number (required) Output level high/low (required) | Set an output pin at the given level. Example to set pin 1 to low: gpio-set 1 low |
| gpio-get | Pin number (required) | Get the current level of the given pin. Example to get level of pin 1: gpio-get 1 |
| version | n/a | Get the version of the Radio CLI tool and the radio firmware |