The user-mcu shell is a fully-featured virtual UART shell exposed over the MCU’s first USB CDC-ACM interface. This shell supports both command history and line editing, and can optionally serve as an output target for driver log messages.

Command Reference

All shell commands and their help text may be enumerated with the help command:

Please press the <Tab> button to see all available commands.
You can also use the <Tab> button to prompt or auto-complete all commands or its subcommands.
You can try to call commands with <-h> or <--help> parameter for more information.

Shell supports following meta-keys:
  Ctrl + (a key from: abcdefklnpuw)
  Alt  + (a key from: bf)
Please refer to shell documentation for more details.

Available commands:
  clear    :Clear screen.
  device   :Device commands
  devmem   :Read/write physical memory: "devmem address [width [value]]"
  dio      :Digital Ouput Commands
  flash    :Flash shell commands
  help     :Prints the help message.
  history  :Command history.
  hwinfo   :HWINFO commands
  kernel   :Kernel commands
  log      :Commands for controlling logger
  lpmcu    :Command for configuring system automotive features
  mcuboot  :MCUboot commands
  pwm      :PWM shell commands
  reset    :Performs a cold reboot.
  resize   :Console gets terminal screen size or assumes default in case the
            readout fails. It must be executed after each terminal width change
            to ensure correct text display.
  set      :Set configurable perameters
  shell    :Useful, not Unix-like shell commands.

Command: Device

Provides information about the present system devices. A 'device' may be a lower level interface, like a GPIO controller, but also encompasses features supported by OnLogic drivers. For instance a DIO_0 device might control the input and output states of a block of isolated Digital IO.

In general, most devices can be safely ignored, but some devices may be passed as arguments to other commands.

Subcommand

Description

list

Print a list of all available MCU devices, and indicate the status of the device.

levels

Print a list of all available MCU devices, grouped by their initialization priority.

Command: Devmem

The devmem command supports reading and writing memory mapped IO directly; this command is only present for developer and debug use.

Command: Dio

This command supports controlling the system’s Isolated Digital IO. All digital inputs/outputs support reading the current logical state of the pin. Digital outputs additionally support setting the output state of the pin, and digital inputs support reporting the transition count of the pin (both edges).

On some platforms, the digital ouputs may be places into 'source' mode, instead of 'open-collector' mode, in order to provide current. This feature is not supported on the K800. However, the K800 does support configuring digital outputs as PWMs, and configuring the PWM output’s pulse and duty cycle.

Important
In most cases, the digital output state is NOT measured; any reported value reflects only the expected state according to a software-only tracking value.
Table 1. Dio Device Reference

Name

*Outputs

*Inputs

Description

DIO0

4

4

Karbon 800 front Isolated Digital IO

LED0

4

0

Karbon 800 front user-controllable LEDs

*All pin numbers are zero indexed

Subcommand

Example

Description

set

dio set DIO0 0 true

Set the logical state of a digital output to true or false

get

dio get DIO0 output 0

Get the current logical state of a digital input or ouput

num

dio num DIO0 ouputs

Report the number of input/output pins available to an IO bank

mode

dio mode DIO0 open-drain

Configure digital outputs to source or sink current, when supported

pwm

dio pwm DIO0 0 1000000 50

Set an output as PWM with period in microseconds, and duty in percent

edge

dio edge DIO0 0

Get the number of rising and falling edges detected by a digital input

Command: Flash

Allows reading, writing, and erasing flash memory. Some devices support a non-volatile storage partition that will be preserved across system reboots and firmware application updates.

Table 2. Storage Partition Reference

Device

Flash

Storage (offset, size)

Karbon 800

W25Q16JV

0x20000, 128K

Warning
This API can potentially overwrite application data; it is not recommended for general use.

Command: Hwinfo

Provides the hwinfo devid command, that supports reporting the unique identifier for the current MCU.

Command: Kernel

Supports reporting information about the currently running kernel.

Subcommand

Description

cycles

Report the number of hardware cycles of the system kernel since boot

reboot

Reboot the system kernel

stacks

Report the stack usage of all kernel threads

threads

Provide more verbose status information about system threads

uptime

Report the current system uptime in milliseconds

version

Get the running Zephyr RTOS kernel version

Command: Log

Configure runtime features of the system logging backend. This allows resuming or halting log-output on different backends, as well as modifying the reporting level across specific modules.

Subcommand

Description

disable

Disable logging for the specified module

enable

Enable logging at the chosen level for the specified module. Log level cannot exceed the compiled level.

backend

Run a gp or halt against a remote backend; log backend shell_dummy_backend halt

list_backends

Produce a list of the available log backends, and indicate if a backend is enabled or disabled.

go

Resume logging to the uart terminal

halt

Pause logging to the uart terminal

status

Provide a list of log modules and their current output level

mem

Get logger memory statistics

Command: LPMCU

Supports configuration of system automotive features, which allows enable automotive low power modes, ignition sensing, and other features.

Subcommand

Description

version

Report the firmware version running on the low-power microcontroller

sys-voltage

Report the current system input voltage in the format xx.xxx

ignition-state

Reports the current state of the system ignition input (>= 6V ⇒ true, < 6V ⇒ false)

power-state

Get or set the system power state. Possible values are on, off, and low-power. Power state transitions are performed via virtual power-button events, and can be overriden by host software in some cases.

config

Get or set non-volatile, configurable, automotive settings

Automotive configuration values can be set and reported by the same command:

  • Report a value lpmcu config shutdown-voltage

  • Set a value lpmcu config shutdown-voltage 6.25

Table 3. Automotive Configuration

Configuration

Description

Values

automotive-mode

Enable or disable system automotive features

true, false

low-power-enable

Enable entering a very low power state when the system powers off. The system can only wake from the power-button and the ignition switch when in this power state.

true, false

startup-timer

The number of seconds that the ignition input must be stable before the system will power on

1 - MAXINT32

soft-off-timer

The number of seconds that the ignition input can be low before the mcu will request the system powers down via a virtual power button event.

1 - MAXINT32

hard-off-timer

The number of seconds that the ignition input can be low before the mcu will force the system to power down.

1 - MAXINT32

low-voltage-timer

The number of seconds that the measured voltage can be lower than the shutdown threshold before a forced shutdown will occur.

1 - MAXINT32

shutdown-voltage

The threshold voltage for triggering low-voltage shutdown events.

1.000 - 48.000 (floating point, truncated to millivolts: 10.1112 → 10.111)

Command: Mcuboot

Running the mcuboot command will report information about the running and fallback firmware images:

swap type: none
confirmed: 0

primary area (2): <---------- Currently running image
  version: 1.0.6+5 <--------- Current firmware version
  image size: 103528
  magic: unset
  swap type: none
  copy done: unset
  image ok: unset

secondary area (3): <------- Swap/backup image version
  version: 1.0.6+3  <------- Swap/backup image version
  image size: 101408
  magic: unset
  swap type: none
  copy done: unset
  image ok: unset

Command: Pwm

Supports configuration of pwm devices that are not optionally configured Digital IO. The Karbon 800 does not support this kind of interface.

Subcommand

Description

cycles

Set the pwm period and pulse width in system cycles

usec

Set the pwm period and pulse width in microseconds

nsec

Set the pwm period and pulse width in nanoseconds

Command: Reset

Perform a cold reboot of the mcu processor. This will result in the MCU transition back through the second-stage bootloader, allowing the application boot sequence to be interrupted by a bootloader entry request.

For the first three seconds after a reset, the MCU user button qualifies as a bootloader entry request. After that period, the system will listen for smp-svr commands for up to five seconds.

Command: Set

Performs configuration on system VCAN devices. This includes setting the CAN baudrate, and programming the CAN message parser mode.

Table 4. Can Device Reference

Device

Description

VCAN1

Karbon 800 on-board CAN 2.0 A/B interface

Subcommand

Description

can-mode

Set the can parser mode to std or slcan. The SLCAN parser mode is compatible with linux slcand utilities.

can-baudrate

Set the can baudrate within the allowable range

Command: Shell

Provides some configuration options for the shell environment.

Subcommand

Description

backspace_mode

Capable of forcing the delete key to act like the backspace key

colors

Enables or disables sending color-codes with shell output text

echo

Enables or disables shell character echo

stats

Provides or clears shell stats about dropped log messages