System Functions
System functions cover the configuration, status and control of a number of miscellaneous and loosely coupled features. These are managed by the system variables and other commands and variables, as follows:
Configuring Command API Format
Gecko OS commands can be entered manually via a Gecko OS terminal or automatically by a host MCU system.
There are optimizations for human Command API format and machine Command API format .
Variables:
Variable | Human Format | Machine Format |
---|---|---|
system.cmd.format (sets format variables) | human | machine |
system.cmd.echo | on | off |
system.cmd.header_enabled | 0 | 1 |
system.cmd.prompt_enabled | 1 | 0 |
system.print_level | all | 0 |
system.cmd.timestamp | ||
system.msg | ||
system.cmd.buffered |
See also Serial Interface, Commands and Streaming .
Power management
Power consumption can be minimized, and battery life extended, by a number of strategies.
Powersave Mode
There are independent powersave modes for the system as a whole, for the WLAN, and for the UART.
The system.powersave.mode variable allows the module to power down when idle, and power up in response to activity. Powersave mode is on by default. There is a range of system.powersave.mode settings:
- Disabled
- Sleep
- Deep Sleep
- Stop
The uart.powersave.mode can be set to disabled or WAKE_EXTERNAL (e.g. wake on a pin transition).
The wlan.powersave.mode can be set to disabled, beacon skipping mode, or DTIM skipping mode.
The general procedure for configuring powersave is:
- set system.powersave.mode to minimize power usage, depending on your application requirements.
- set uart.powersave.mode if your application uses the UART.
- set wlan.powersave.mode if your application uses the WLAN.
- set further options for system powersave and WLAN powersave, if required:
Note : Low power modes do not work immediately after programming the device (including initial setup using GSS). The device must be power cycled after programming for low power modes to work. Power must be completely removed from the board. A reset is not sufficient.
Powersave Variable Notes
Idle timeout should be minimized to reduce overall power consumption. Timeout restarts every time a byte is transmitted or received on a UART. If you are continuously transmitting and/or receiving bytes on the UART, with a time between bytes shorter than the idle timeout, then the device does not sleep and no power is saved.
Other buses that restart the idle timer are SPI, I2C and Ethernet.
The device may take up to 20 microseconds to wake up.
When setting UART powersave mode to WAKE_EXTERNAL and using a pin interrupt on the RX pin, a delay may be required to allow the device to wake up before receiving bytes.
At
115200
baud the device starts quickly enough to receive the first byte.
At higher baudrates, you can insert space characters before commands. The command interpreter ignores a space character, but it still wakes the device.
Examples
The following examples cover typical powersave scenarios.
UART: Wakeup on UART RX
Command | Description |
---|---|
set uart.powersave.mode uart0:1,uart1:1 set system.powersave.wakeup_gpio_mask 0x1000000 set system.powersave.idle_timeout 250 set system.powersave.mode 2 uartu 0
|
Enable powersave for both UARTs. Set up a pin wakeup on the UART0 RX pin. Set idle timeout to 250ms. This gives time for the device to wakeup after the pin interrupt and receive the whole UART message. Note that the timeout only needs to be long enough to receive the first byte as the timeout restarts every time a byte is received. Set powersave mode to 2 to allow the device to go into deep sleep. Update the UART configuration to apply changes.
|
WLAN: Associated Idle with DTIM skipping
Note If using the UART command bus, wakeup on UART RX should be enabled so that deep sleep can be used. See above example.
Command | Description |
---|---|
set wlan.powersave.mode 2 set wlan.powersave.listen_interval 5 set system.powersave.mode 2 uartu 0 nup
|
Set Wi-Fi to DTIM skipping mode. Set DTIM skipping to 5. Set system powersave mode to 2 to allow the device to go into deep sleep. Update the UART configuration to apply changes. Start the WLAN network.
|
Combined UART and WLAN powersave
Command | Description |
---|---|
set wlan.powersave.mode 2 set wlan.powersave.listen_interval 5 set uart.powersave.mode uart0:1,uart1:1 set system.powersave.wakeup_gpio_mask 0x1000000 set system.powersave.idle_timeout 250 set system.powersave.mode 2 uartu 0 nup
|
Set Wi-Fi to DTIM skipping (for associated idle). Set DTIM skipping to 5. Set UART powersave mode to external wakeup. Setup a pin wakeup on the UART0 RX pin. Set idle timeout to 250ms. This gives time for the device to wakeup after the pin interrupt and receive the whole UART message. Set powersave mode to 2 to allow the device to go into deep sleep. Update the uart configuration to apply changes. Bring the network up.
|
System Shutdown
To provide the greatest power savings, shut the system down completely. Gecko OS does not retain RAM and the kernel is not running.
To wake the system after shutdown, either a timeout or a wakeup GPIO must be provided.
After providing at least one wakeup method, run the shutdown command.
A specific set of GPIOs can be allocated for wakeup. This is platform dependent. Multiple GPIOs can be allocated. The GPIO wakeup levels can be individually set.
For full details, see the documentation of the shutdown command and variables.
Command
Variables
- system.shutdown.wakeup_gpio_level_mask
- system.shutdown.wakeup_gpio_mask
- system.shutdown.wakeup_timeout
Monitoring System State
System state can be monitored via visual indication by LED, system messages and GPIO level indication.
State monitoring variables:
- system.indicator.gpio
- system.indicator.state
- system.msg
- system.activity.gpio
- system.activity.gpio_level
Sub-system states can also be associated with GPIOs. See Peripherals .
For a detailed snapshot of system state get the values of all the Gecko OS variables:
get all
Controlling the Boot Image
The boot image is by default
services.bin
, but may be changed for various reasons.
If exceptions occur due to misconfiguration, the module may switch to safe mode, changing the boot image to
kernel.bin
.
Boot image commands and variables:
See also:
System Identification and Version
Commands and variables:
-
version
command - this gives the same result as
get system.version
- system.uuid
- system.version