|
K-FSW ec10f94
Modular flight software on Zephyr, for small satellites
|
Type commands at the shell prompt:
Wait for @READY before using services. help lists the commands in the build and <command> -h shows the syntax. Tab completes command and subcommand names, but not arguments such as a node or a path. A command with the wrong number of arguments prints its usage:
The shell needs CONFIG_KFSW_DEBUG_SHELL. Each command group depends on its service:
| Command | Build option |
|---|---|
status, version, time, log | always |
csp | CONFIG_KFSW_CSP |
uart | CONFIG_KFSW_CSP_KISS_UART |
param | CONFIG_KFSW_PARAM; saving needs CONFIG_KFSW_PARAM_PERSISTENCE |
storage | CONFIG_KFSW_STORAGE |
ftp | CONFIG_KFSW_FTP |
cmd | CONFIG_KFSW_COMMAND |
event | CONFIG_KFSW_EVENT |
hk | CONFIG_KFSW_HK |
fbo | CONFIG_KFSW_FBO |
fwu | CONFIG_KFSW_FWU |
watchdog | CONFIG_KFSW_WATCHDOG |
health | CONFIG_KFSW_HEALTH |
gndwdt | CONFIG_KFSW_GNDWDT |
resmon | CONFIG_KFSW_RESMON |
uhf | CONFIG_KFSW_RADIO_UHF_SHELL |
temp | CONFIG_KFSW_TEMP_EXAMPLE_SHELL |
boton_test, test | CONFIG_KFSW_BOTON_TEST_SHELL |
| Command | Prints |
|---|---|
status | Role, name, CSP node, board, hardware ID and uptime |
version | K-FSW version, Zephyr version, board, SoC and hardware ID |
time | Milliseconds and microseconds since boot |
Role and name are labels set in the build. time is time since boot; wall time is in csp clock.
log test prints one message at each level compiled into the image. Change log_level, or log_levels for a single module, to filter them.
log history shows up to 32 recent retained messages when CONFIG_KFSW_LOG_HISTORY is enabled. It includes sequence, uptime, module, level and truncation status. To retrieve them over CSP, use the host csp-kiss logs command described in communications.
uhf status prints the radio implementation, the expected hardware and serial settings, and the link state. With CONFIG_KFSW_RADIO_UHF_CRYPTO, uhf connect starts new encrypted sessions with the configured peer.
uhf status doesn't talk to the modem. Traffic and errors are in uart info and csp interfaces.
| Command | Arguments | Meaning |
|---|---|---|
boton_test status | none | Press count, last press and LED states |
| test led | <green|blue|red> <on|off> | Switch one LED |
test led and the LED parameters use the same module function. Holding the button counts one press, and everything resets at boot.
temp status prints the cached die temperature of the temperature example and its read counters.
| Command | Arguments | Meaning |
|---|---|---|
csp info | none | Local address, identity, build date and free buffers |
csp ident | [node] | Hostname, model, revision, build date and clock |
csp interfaces | none | Interfaces with addresses and packet, error and drop counters |
csp ifstat | <node> <interface> | Remote interface packet/byte/error counters |
csp routes | none | Route table |
csp ping | [node] | Ping with CRC32 and a one-second timeout |
csp debug | [on\|off] | Print every packet in and out |
csp clock | [set <utc>] or <node> [sync] | Read or set wall time |
csp reboot | <node> <pin> | Restart a node |
csp debug on prints each packet's source and destination node and port, priority, flags, size and interface. It is off by default and only affects the node where it is turned on.
With several links, csp routes shows the interface and next hop of each route:
Routes are set at build time and can't be changed from the shell. A ping timeout can mean no peer, a wrong address or route, framing errors or no free buffers; check csp interfaces, csp routes and uart info.
csp reboot <node> <pin> restarts a node if the pin matches:
The pin is reboot_pin in the system table: 0000 by default, persistent, and settable from the ground. It is text, so 0007 doesn't match 7. The pin is sent in clear text and only protects against rebooting the wrong node by mistake.
After a restart the boot table shows why the previous run ended:
All three at zero means no valid reset note was found. Power loss is one possible cause; a reset before a note was written gives the same result. Check the hardware reset cause as well.
| Command | Arguments | Meaning |
|---|---|---|
uart info | none | Each CSP UART with baud, state, KISS name, address and counters |
uart test | [node] | Check that the route uses a UART/KISS link, then ping with a 128-byte payload |
Give the node to test one link out of several, for example uart test 10 and uart test 11. On the NUCLEO these commands run on the ST-LINK console and the packets leave on USART3; don't connect the shell terminal to the CSP UART.
| Command | Arguments | Meaning |
|---|---|---|
param tables | none | Local tables with ID, band, size and saved values |
param tablelist | [node] | Tables of a node |
param list | [node] | All parameters |
param table | [node] <table> | One table |
param get | [node] <name> | Read a value |
param set | [node] <name> <value> | Write a value |
Mode letters: r read-only, w writable, p saved in the snapshot, b applied at the next boot. Strings are printed quoted and arrays as lists. Input is parsed with the parameter's type; overflow, negative unsigned values and bad numbers are rejected.
echo_enabled makes the console repeat what it receives. It is off by default:
With CONFIG_KFSW_PARAM_CSP, put the node before the other arguments:
The node is a decimal number. Remote listings show the table number instead of its name, because table names are not sent over the link.
| Command | Effect |
|---|---|
param save | Write all persistent values to the snapshot |
param persist <table> | Write the snapshot and show that table's share |
param load | Apply the saved snapshot |
param defaults | Reset persistent values to their defaults, in RAM only |
param clear | Delete the snapshot; RAM is unchanged |
These act on the local node. With param_autosave on, a change to a persistent value is saved without param save. See Services and storage.
| Command | Arguments | Meaning |
|---|---|---|
storage info | none | Filesystem, backend, mount point, state, total and free bytes |
storage test | none | Create, write, read, overwrite and delete a test file |
storage test write | <value> | Write the persistence test value |
storage test read | <value> | Read and compare the persistence test value |
storage test writes to flash. storage info only reads.
Paths are virtual and rooted at /kfsw/ftp on the node.
| Command | Arguments | Meaning |
|---|---|---|
ftp <node> ls | [directory] | List a directory; list also works |
ftp <node> stat | <path> | Type, size and CRC |
ftp <node> mkdir | <directory> | Create a directory |
ftp <node> put | <local> <remote> | Upload a file |
ftp <node> get | <remote> <local> | Download a file |
ftp generate | <path> <bytes> | Create a test file of up to 32768 bytes |
ftp verify | <first> <second> | Compare two local files |
The verb can also go first, ftp put <node> ..., which is the form Tab completion shows. ls, stat and mkdir work on the node's own address without a connection; put and get need another node.
Paths must start with / and can't contain .. or empty components.
| Command | Arguments | Meaning |
|---|---|---|
cmd list | none | Registered commands with ID, arguments and description |
cmd <name> | [arguments] | Run a command on this node |
cmd <node> <name> | [arguments] | Run a command on another node over CSP |
cmd retry <node> <name> | [arguments] | Reserve a ticket and retry lost exchanges within this invocation |
cmd <node> ground_wtd | KFSWWSFK | Feed the ground watchdog and return countdown/timeout (ID 16) |
cmd [node] ground_wtd | get | Read countdown/timeout without feeding |
cmd journal_stats | none | Persistent journal status |
cmd journal_tail | <age> | Committed event fields and payload; newest is 0 |
cmd journal_time | <age> | Sequence, event uptime and writer UTC |
The order is registration order, not ID order.
An ID is part of the wire contract: two nodes must agree on it, so an ID is never reused for a different command. Composition commands are defined in app/src/commands/command_definitions.c; a command that belongs to a service is defined by that service and carries its ID in its own header.
| ID | Command | Defined in |
|---|---|---|
| 1 to 3 | noop, info, reboot | k-fsw composition |
| 4, 5 | event_stats, event_tail | k-fsw composition |
| 6 to 8 | hk_define, hk_period, hk_clear | k-fsw composition |
| 9 to 11 | journal_stats, journal_tail, journal_time | k-fsw composition |
| 12 to 15 | free | — |
| 16 | ground_wtd | kfsw-services, gndwdt.h |
The name is looked up in the local registry before the request is sent, so both nodes need the same command IDs. [mutating] commands change the node. Remote commands need CONFIG_KFSW_COMMAND_CSP (port 11). The command service does not authenticate callers. Radio encryption can protect that link; other interfaces need their own access policy.
| Command | Meaning |
|---|---|
event list | Held records, oldest first |
event stats | Held, capacity, recorded, overwritten and rejected counts |
event clear | Discard held records; counters are kept |
Payloads are printed as bytes; their layout is in the producer's header. A gap in SEQ means records were overwritten, and event stats shows how many. The record is lost at reset. For another node:
| Command | Arguments | Meaning |
|---|---|---|
hk define | <report> [node:]table:offset ... | Set what a report collects |
hk clear | <report> | Delete a report |
hk show | none | Reports and counters |
hk collect | <report> | Collect now |
hk get | <report> [count] | Print collected samples |
hk period | <report> <ms> | Collect periodically, 0 to stop |
hk store | <report> <ms> | Also write samples to a file, 0 to stop |
hk store_clear | <report> | Stop storing and delete the file |
hk beacon | <report> <node> <ms> | Send the latest sample periodically, 0 to stop |
hk save | none | Save the report settings |
See Ground station for Yamcs and the ground bridge.
| Command | Arguments | Meaning |
|---|---|---|
fbo run | <name> | Run a procedure file |
fbo stop | none | Stop the running procedure |
fbo status | none | Procedure, current line and counters |
send and flash need CONFIG_KFSW_FWU_LITE_CSP. fwu send reports how many blocks had to be resent. Check link counters if retries increase.
After a transfer, check swap_scheduled in fwu status. If it is not set, MCUboot has nothing to swap and boots the old image. See Firmware update.
The watchdog commands need CONFIG_KFSW_WATCHDOG and a kfsw,watchdog devicetree property. watchdog status shows the state (unconfigured, configured, running or starved), the timeout, the feed interval, the number of feeds and the time since the last one.
watchdog starve confirm can't be undone, since the STM32 independent watchdog can't be disarmed; the board resets within one timeout. health watch also ends in a reset once the deadline passes. The next boot marker shows the cause:
The raw mask is printed as well because several causes can be latched at once; 0x11 is the reset pin and the watchdog.
Ordinary commands are not retried. cmd retry uses a ticket to suppress duplicates within that invocation when CONFIG_KFSW_COMMAND_RETRY is enabled. A new invocation is a new operation. A timeout can mean the reply was lost after the command ran, so check the state before sending it again.
Wait for @READY, then send one command at a time and wait for the prompt. Use the C APIs or CSP services when a script needs a stable format.