Morse Micro IoT SDK  2.9.7
Morse Micro CLI API

Copyright 2025 Morse Micro

The Morse Micro CLI allows control of various aspects of system functionality from a command line interface (e.g., via UART). An example application with CLI functionality is provided as part of this SDK, see cli.c.

The CLI is separated into modules, which are described below. Each module has a set of commands and configuration variables.

For a list of all commands type help. For example:

> help

Configuration variables

Configuration variables provide a means of configuring various aspects of the system. The commands get and set are provided to read and write the values of the variables. To list all the currently set configuration variables, invoke:

> get all

When a configuration variable is set the value is stored in volatile memory. The commit command can be used to commit these to non-volatile memory.

Note that changes to configuration variables may not have an immediate effect. For example, the IP configuration variables will not take effect until the ip-reload command is invoked.

Module wlan: Wireless LAN management.

Configuration variables

Name Type Description
wlan.country_code string Two character country code used to identify the regulatory domain.
wlan.ssid string SSID of the AP to connect to, can be 1-32 characters long.
wlan.password string Password used when associating, 1-100 characters long.
wlan.security Security type Security type to used when associating.
wlan.raw_priority int16_t Priority to request if raw is supported by the AP. Valid priorities are 0-7. -1 disables RAW.
wlan.bssid MAC address BSSID of the ap to associate to, all 0x00 for any.
wlan.pmf_mode Pmf mode Protected Management Frame mode to use (802.11w).
wlan.station_type Station type S1G non-AP STA type.
wlan.rts_threshold uint32_t The RTS threshold (in octets) to set, or 0 to disable.
wlan.sgi_enabled bool Boolean value indicating whether SGI support should be enabled.
wlan.subbands_enabled bool Boolean value indicating whether sub-band support should be enabled.
wlan.ampdu_enabled bool Boolean value indicating whether AMPDU support should be enabled.
wlan.power_save_mode Power save mode Sets the 802.11 power save mode.
wlan.fragment_threshold uint32_t Sets the 802.11 fragmentation threshold. The fragmentation threshold (in octets) to set, or 0 to disable.
wlan.cac_enabled bool Whether Centralized Authentication Controlled is enabled on the STA.
wlan.offload_arp_response bool If true, enables ARP response offload which allows the Morse chip to directly respond to ARP requests without waking up the host processor.
wlan.offload_arp_refresh_s uint32_t If non zero, enables ARP refresh offload with the specified interval in seconds. Note: ARP response offload needs to be enabled for this feature to work.
wlan.min_health_check_intvl_ms uint32_t The minimum interval to wait after the last health check before triggering another. If this parameter is 0 then health checks will always happen at the max_interval_ms value. min_interval_ms must always be less than or equal to max_interval_ms. If only min_health_check_intvl_ms is specified, then max_health_check_intvl_ms is assumed to be unbounded.
wlan.max_health_check_intvl_ms uint32_t The maximum interval to wait after the last health check before triggering another. If this parameter is 0 then periodic health checks will be disabled. min_interval_ms must always be less than or equal to max_interval_ms. Set this to UINT32_MAX to have the maximum unbounded. If only max_health_check_intvl_ms is specified, then min_health_check_intvl_ms is assumed to be 0.
wlan.ndp_probe_enabled bool Boolean value indicating whether NDP probe support should be enabled. Will only take effect after a connect or scan command is sent.
wlan.sta_scan_interval_base_s uint16_t The base scan interval (in seconds) to use when (re)connecting. See documentation of mmwlan_sta_args.scan_interval_base_s for further details. Note that changes will only take effect on invocation of wlan-connect.
wlan.sta_scan_interval_limit_s uint16_t The maximum interval between scan attempts when (re)connecting. See documentation of mmwlan_sta_args.scan_interval_limit_s for further details. Note that changes will only take effect on invocation of wlan-connect.
wlan.qos_0_params string The default QoS queue configuration for Access Category 0 (AC_BE) that is active while the station is connecting to an Access Point. This is a string containing the following comma separated integer values (in order): aifs,cw_min,cw_max,txop_max_us. For example: 3,15,1023,15008. More information about the individual parameters can be found in the API documentation for mmwlan_qos_queue_params.
wlan.qos_1_params string The default QoS queue configuration for Access Category 1 (AC_BK) that is active while the station is connecting to an Access Point. This is a string containing the following comma separated integer values (in order): aifs,cw_min,cw_max,txop_max_us. For example: 7,15,1023,15008. More information about the individual parameters can be found in the API documentation for mmwlan_qos_queue_params.
wlan.qos_2_params string The default QoS queue configuration for Access Category 2 (AC_VI) that is active while the station is connecting to an Access Point. This is a string containing the following comma separated integer values (in order): aifs,cw_min,cw_max,txop_max_us. For example: 2,7,15,15008. More information about the individual parameters can be found in the API documentation for mmwlan_qos_queue_params.
wlan.qos_3_params string The default QoS queue configuration for Access Category 3 (AC_VO) that is active while the station is connecting to an Access Point. This is a string containing the following comma separated integer values (in order): aifs,cw_min,cw_max,txop_max_us. For example: 2,3,7,15008. More information about the individual parameters can be found in the API documentation for mmwlan_qos_queue_params.
wlan.mcs10_mode Mcs10 mode The currently configured MCS10 behavior. This only takes effect after calling the WLAN connect command. This is an enum with 3 modes: disabled, which will never use MCS10, forced, which will always use MCS10 instead of MCS0 if the bandwidth is 1 MHz, and auto, which will use MCS10 on retries instead of MCS0 when the bandwidth is 1 MHz.
wlan.sta_evt_en bool When set to true, STA event notifications will be provided. Setting this to false will suppress these notifications. Defaults to false.
wlan.duty_cycle_mode Duty cycle mode The duty cycle air time distribution mode. The duty cycle mode can be set to spread, where the air time is spread evenly across the window; or burst, where air time is available to be consumed immediately.

Commands

wlan-connect

Brings up the WLAN interface and connects to the AP with configured parameters.

> wlan-connect <timeout>
  • timeout: Duration in milliseconds to wait for connection establish, if connection does not get established an explicit disconnect will be sent. 0 to return immediately without waiting.

wlan-disconnect

Disconnects and brings down the WLAN interface.

> wlan-disconnect

wlan-scan

Starts an undirected scan for available networks.

> wlan-scan <ssid> <timeout>
  • ssid: Optional SSID to include in probe requests.
  • timeout: Optional duration in milliseconds to wait for scan to complete, if scan does not complete by the timeout any available results will be returned and the scan aborted.

wlan-get_rssi

Retrieves the RSSI if the WLAN interface is up, else 0.

> wlan-get_rssi

wlan-get_mac_addr

Retrieves the MAC address if the WLAN interface is up.

> wlan-get_mac_addr

wlan-wnm_sleep

Requests entry or exit from extended sleep (wnm sleep) if the WLAN interface is up.

> wlan-wnm_sleep <wnm_sleep_enabled>
  • wnm_sleep_enabled: Boolean indicating whether WNM sleep is enabled.

wlan-beacon_monitor_enable

Enable beacon monitoring with the given filter settings. If beacon monitoring is already enabled it will be reconfigured with the given arguments.

> wlan-beacon_monitor_enable <oui_filter>
  • oui_filter: OUIs to monitor.

wlan-beacon_monitor_disable

Disable beacon monitoring. If beacon monitor is not enabled then this has no effect.

> wlan-beacon_monitor_disable

wlan-standby_enter

This puts the Morse chip into standby mode allowing the host processor to go to sleep while the Morse chip takes over certain functionality to keep the connection alive with the provision to wake up the host processor when certain conditions are met.

> wlan-standby_enter

wlan-standby_exit

Forces the Morse chip to exit standby mode. There may be certain instances such as a timer expiry, which cause the host chip to wake up independant of the Morse chip. In such situations, the host calls this function to instruct the Morse chip to exit standby mode and return to normal operating mode.

> wlan-standby_exit

wlan-standby_set_status_payload

Sets the user payload for the standby status packet. Once standby mode is enabled, the Morse chip will periodically emit a UDP standby status packet regardless of whether it is in standby or not. The UDP packet will also be sent immediately upon entering or exiting Standby mode. If this command is not executed then the standby status packet will contain no payload.

> wlan-standby_set_status_payload <payload>
  • payload: Payload to append to standby status packets.

wlan-standby_set_wake_filter

Configures the standby mode UDP wake packet filter. The system can be woken up from standby mode by sending it a UDP wake packet. If a wake filter is set using this function then the wake packet will only wake up the system if the specified filter pattern matches the payload at the specified offset within the payload. If this command is not executed then any wake packet will wake up the system.

> wlan-standby_set_wake_filter <filter> <offset>
  • filter: Filter to apply to wake packets to wake on match.
  • offset: Offset within wake packet payload to apply the filter.

wlan-standby_set_config

Sets the standby mode configuration parameters. If this command is not executed then the defaults are as specified.

> wlan-standby_set_config <notify_period_s> <src_ip> <dst_ip> <dst_port> <bss_inactivity_s> <snooze_period_s> <snooze_increment_s> <snooze_max_s>
  • notify_period_s: Interval in seconds for transmitting Standby status packets (Default 15s).
  • src_ip: Source IP address to use for the standby status packets (Default 0.0.0.0).
  • dst_ip: Destination IP address for the standby status packets (Default 0.0.0.0).
  • dst_port: Destination UDP Port for the standby status packets, also used the source port for outgoing UDP port for outgoing UDP packets (Default 22000).
  • bss_inactivity_s: Deprecated. This parameter is no longer used and will be removed in a future release.
  • snooze_period_s: The interval in seconds to wake periodically from snooze mode and check for beacons. If no beacons are found then the Morse chip will re-enter snooze mode. If beacons are found then the Morse chip will exit standby mode so the host can reassociate (Default 60s).
  • snooze_increment_s: The amount in seconds to increase successive snooze intervals. This saves power by snoozing for longer before checking for beacons again if no beacons are found. (Default 0s).
  • snooze_max_s: The maximum time in seconds to snooze for after increments (Default unlimited).

wlan-get_sta_status

Retrieves the STA status of the WLAN interface.

> wlan-get_sta_status

Module ip: IP Stack Management

Configuration variables

Name Type Description
ip.ip_addr IP address IP address to use for a static network connection. This will take effect when the reload command is successfully executed.
ip.netmask IP address Netmask to use for a static network connection. This will take effect when the reload command is successfully executed.
ip.gateway IP address Gateway to use for a static network connection. This will take effect when the reload command is successfully executed.
ip.dns_server0 IP address Primary DNS server IP address. If a value is specified this will override the primary DNS server provided by DHCP (if any). Changes will take effect when the reload command is successfully executed.
ip.dns_server1 IP address Secondary DNS server IP address. If a value is specified this will override the secondary DNS server provided by DHCP (if any). Changes will take effect when the reload command is successfully executed. Note that this option may be ignored by some IP stacks.
ip.dhcp_enabled bool True to enable DHCP for IP address configuration, or false to use the static configuration given by ip_addr, netmask, and gateway. This will take effect when the reload command is successfully executed.
ip.dhcp_offload bool If true, enables DHCP offload which allows the Morse chip to directly handle DHCP discovery and leases without waking up the host processor. Note: this comes into effect only if ip.dhcp_enabled is also true.
ip.link_status_evt_en bool When set to true, IP link status notifications will be provided. Setting this to false will suppress these notifications. Defaults to true.

Commands

ip-status

Gets the status of the IP stack.

> ip-status

ip-reload

Reloads the IP stack network configuration based on the current values in the subsystem config.

> ip-reload

ip-enable_tcp_keepalive_offload

Enables sending periodic TCP keep-alive packets by the morse chip allowing the TCP connection to be maintained without waking up the host processor. This needs to be enabled before opening a TCP connection. As of now, this feature will work only on the first TCP connection opened after this command.

> ip-enable_tcp_keepalive_offload <period_s> <retry_count> <retry_interval_s>
  • period_s: Interval in seconds to send the keep-alive packets in.
  • retry_count: The number of times to retry before giving up.
  • retry_interval_s: The interval in seconds to wait between retries.

ip-disable_tcp_keepalive_offload

Disables sending of TCP keepalive packets.

> ip-disable_tcp_keepalive_offload

ip-set_whitelist_filter

Sets the whitelist filter specifing which incoming packets can wake the system from standby mode.

> ip-set_whitelist_filter <src_ip> <dest_ip> <netmask> <src_port> <dest_port> <ip_protocol> <llc_protocol>
  • src_ip: The IPv4 source address to match, 0.0.0.0 for any.
  • dest_ip: The IPv4 destination address to match, 0.0.0.0 for any (Usually our IP address).
  • netmask: The netmask to apply to the source or destination IP, 0.0.0.0 for any.
  • src_port: The source port to match, 0 for any.
  • dest_port: The destination port to match, 0 for any.
  • ip_protocol: The IPv4 protocol number to match - 6 for TCP, 17 for UDP, 0 for any.
  • llc_protocol: The LLC protocol (or EtherType) to match - 0x0800 for IPv4 and 0x86DD for IPv6, 0 for any.

ip-clear_whitelist_filter

Clears any applied whitelist filters.

> ip-clear_whitelist_filter

Module ping: Ping application.

Configuration variables

Name Type Description
ping.target IP address The IP address of the ping target.
ping.interval uint32_t The time interval between ping requests (in milliseconds).
ping.count uint32_t This specifies the number of ping requests to send before terminating the session. If this is zero or exceeds UINT16_MAX (65535) then it it will be set to UINT16_MAX.

Commands

ping-run

Commences a ping session using the current values in the the subsystem config.

> ping-run

Module iperf: Iperf application.

Configuration variables

Name Type Description
iperf.mode Iperf mode The iperf mode to use. Valid values are udp_server, tcp_server, udp_client and tcp_client. If not set, defaults to udp_server.
iperf.server IP address IP address of server to connect to when in client mode.
iperf.port uint16_t Specifies the local port to listen on when in server mode or the server port to send data to when in client mode.
iperf.amount int32_t This specifies the duration for client transfers specified either in seconds or bytes. If this is negative, it specifies a time in seconds; if positive, it specifies the number of bytes to transmit.

Commands

iperf-run

Starts an iperf session using the current values in the the subsystem config.

> iperf-run

Module sys: System management.

Commands

sys-reset

Performs a soft reset.

> sys-reset

sys-deep_sleep

Enters deep sleep mode.

> sys-deep_sleep <mode>
  • mode: Deep sleep mode to enter.

sys-get_version

Gets the device firmware and hardware versions.

> sys-get_version

Enum definitions

Security type

Connection security type.

Label Value Description
sae 0 Simultaneous Authentication of Equals (password-based authentication).
owe 1 Opportunistic Wireless Encryption (encrypted, passwordless).
open 2 No security enabled at all.

Pmf mode

Protected management frame mode.

Label Value Description
required 0 Protected management frames must be used.
disabled 1 No protected management frames.

Power save mode

Enumeration of supported 802.11 power save modes.

Label Value Description
disabled 0 Power save disabled.
enabled 1 Power save enabled.

Mcs10 mode

Enumeration of MCS10 modes.

Label Value Description
disabled 0 MCS10 is not used.
forced 1 MCS10 is always used instead of MCS0 when the bandwidth is 1 MHz.
auto 2 MCS10 is used on retries instead of MCS0 when the bandwidth is 1 MHz.

Duty cycle mode

Enumeration of duty cycle modes.

Label Value Description
spread 0 Duty cycle air time is evenly spread.
burst 1 Duty cycle air time available in burst.

Station type

Enumeration of S1G non-AP STA types.

Label Value Description
sensor 0 Sensor type.
non_sensor 1 Non-Sensor type.

Status

Enumeration of return status codes.

Label Value Description
ok 0 Operation was successful.
error 1 The operation failed with an unspecified error.
invalid_arg 2 The operation failed due to an invalid argument.
unavailable 3 Functionality is temporarily unavailable.
timeout 4 The operation timed out.
invalid_stream 5 An invalid stream was specified.
not_found 6 Specified operation was not found.
not_supported 7 Specified operation is not supported.
tx_error 8 An error occured during transmission.
no_mem 9 Failed due to memory allocation failure.
closed 10 Failed due to stream being closed from the other side.
channel_list_not_set 11 WLAN operation failed because the channel list has not been set.
shutdown_blocked 12 WLAN shutdown failed.
channel_invalid 13 Attempted to tune to a channel that was not available.
not_running 14 Operation failed because the WLAN device was not booted.
no_link 15 Operation failed because the link was not up.
unknown_host 16 Failed to get an IP address for the given hostname.
socket_failed 17 Failed to open the socket.
socket_connect_failed 18 Socket connection failed.
socket_bind_failed 19 Socket bind failed.
socket_listen_failed 20 Socket listen failed.
ntp_kod_received 21 NTP server returned Kiss-o'-Death.
ntp_kod_backoff_received 22 NTP server returned Kiss-o'-Death with rate code. Client should backoff then retry.
socket_send_failed 23 Socket send failed.
invalid_credentials 24 Credentials provided were invalid. Possible cause: missing null terminator on a PEM key/certificate.
handshake_failed 25 Error during TLS handshake.
authentication_failed 26 Credentials provided by the server were not valid.
missing_credentials 27 Missing certificate or key to open TLS connection. Provided through the TLS module configuration.
time_not_synchronized 28 Internal time has not been synchronized. This is required for certificate verification for TLS. Use the NTP module to synchronize internal time.
mqtt_refused 29 The server refused a CONNECT or SUBSCRIBE.
mqtt_keepalive_timeout 30 Timed out while waiting for PINGRESP. Connection to the broker has been lost.
bad_version 31 Operation failed due to a version mismatch.

Iperf mode

Mode to use when running the iperf.

Label Value Description
udp_server 0 Iperf UDP server (RX).
tcp_server 1 Iperf TCP server (RX).
udp_client 2 Iperf UDP client (TX).
tcp_client 3 Iperf TCP client (TX).

Iperf state

Current state of iperf session.

Label Value Description
not_started 0 Iperf session not started.
running 1 Iperf session is in progress.
finished 2 Iperf session has completed.
aborted 3 Iperf session has been aborted.

Ip link state

Status of the IP link.

Label Value Description
down 0 Link is down because the interface is down or DHCP has not yet completed.
up 1 Link is up. This implies that the interface is up and DHCP has completed.

Deep sleep mode

Deep sleep modes for the agent MCU.

Label Value Description
disabled 0 Deep sleep is disabled.
one_shot 1 Deep sleep is enabled until activity occurs on the datalink.
hardware 2 The datalink layer is responsible for waking the agent.

Standby mode exit reason

Reasons for exiting standby mode.

Label Value Description
standby_exit_none 0 Standby mode was exited manually through a call to standby_exit.
standby_exit_wakeup_frame 1 We were woken up by a wakeup frame.
standby_exit_associate 2 We just reassociated with the AP.
standby_exit_ext_input 3 We were woken up by an external input trigger.
standby_exit_whitelist_pkt 4 We received a packet from a whitelist source.
standby_exit_tcp_connection_lost 5 An open TCP connection was lost.
standby_exit_hw_scan_not_enabled 6 Hardware scan was not enabled.
standby_exit_hw_scan_failed_to_start 7 Hardware scan failed to start.

Sta state

Station states

Label Value Description
disconnected 0 Disconnected from the AP.
connecting 1 Connecting to the AP.
connected 2 Connected to the AP.

Sta event

Station connection events.

Label Value Description
scan_request 0 The STA is starting a scan.
scan_complete 1 The STA has finished a scan.
scan_abort 2 The STA has aborted a scan early.
auth_request 3 The STA is sending an authentication request to the AP.
assoc_request 4 The STA is sending an association request to the AP.
deauth_tx 5 The STA is sending an de-authorization request to the AP.
ctrl_port_open 6 The Supplicant IEEE 802.1X Controlled Port is now open.
ctrl_port_closed 7 The Supplicant IEEE 802.1X Controlled Port is now closed.