Skip to main content
Firmware Stable

How do I execute a command in the device?

Every siliXcon device (controller, BMS, display) runs its own operating system, YOS, with its own command line: the YOS/Shell. Commands such as help, pr, save or reboot run inside the device. You send them from your PC in one of two ways:

  • term: you type the commands, as in a console. Best for several commands in a row and for scripts.
  • emGUI: you open the command's dialog, fill in its arguments and click Execute!.
Your PC has a command line too

Windows CMD, PowerShell and bash are the command line of your PC, not of the device. A device command typed there ends with 'save' is not recognized ..., and a PC command typed in term ends with command '...' not found. See PC command line vs. device command line.

In term​

  1. Connect the device and set up the connection in LaunchPad (Options...). If you are not sure about the address, see Addressing.

  2. Start term in one of these ways:

    • the term button in LaunchPad,
    • External tools → term in the device's context menu in emGUI,
    • type term on the PC command line. With SWTools 4, open the command line with LaunchPad's Command prompt button, which sets up the connection for you.
  3. Press Enter. The device prints its header and asks Login as:. If nothing comes back, the device is not responding: check the connection.

  4. Log in. Press Ctrl+A to log in automatically with the credentials from the connection options, or type guest as the user name and guest as the password for the default access level.

  5. The device prompt appears, for example AX-serpent#>. Type the command with its options and arguments, and press Enter:

    AX-serpent#>help version
    -> version: print meta/version
    AX-serpent#>
  6. When the prompt comes back, the command has finished. Press Esc to close term.

term started from the PC command line: press Enter, then the device asks to log in

A few commands to start with:

CommandWhat it does
helpLists the device's commands. help save prints the help line of one command.
ls -l /driverLists a folder of the device's tree.
stLists the state variables in the current folder.
pr -dLists the parameters changed from their defaults.
set <path> <value>Writes a variable.
saveSaves the parameters to the device's memory. It asks (y/n); save -y does not ask.
tip
  • Options always come before arguments: ls -l /driver, not ls /driver -l.
  • A negative return value means the command failed. The last return value is in /vars/retval.
  • Tab completes names, Up recalls the previous command and Ctrl+C stops a running script.
  • The device's help text is only a short hint. The full syntax is in YOS commands and in your application's documentation.
warning

Some commands act on the hardware: run turns the motor and reboot restarts the device. Do not run them on a device that is driving a vehicle or a machine.

The term guides go further: term basics I, term basics II and term basics III: scripting.

In emGUI​

  1. Open emGUI and search for nodes. The device appears in the tree.
  2. Expand the device and open its commands folder.
  3. Double-click the command. Its dialog opens.
  4. Put each argument in its own box, Arg1 to Arg4, options first. For ls -l /driver, write -l in Arg1 and /driver in Arg2.
  5. Click Execute!. State shows FINISHED when the command ends, Result shows its return value (negative means it failed) and Output shows the text it printed.
  6. If the command asks a question, the Input box is highlighted. Type the answer there, for example y for save.

emGUI command dialog: echo with two arguments

tip
  • The device's context menu has ready-made dialogs for the common jobs: Save / load parameters, Restore parameters, Show logs, Change address and Reboot. They run the commands for you.
  • The dialog takes four arguments at most. For a longer command, or several commands in a row, use term.

More in emGUI basics II: Tweaking and on the emGUI page.

PC command line vs. device command line​

Two different command lines are involved, and both can be open on the same screen. The term window itself shows both: in the screenshot above, the first line, C:\>term, is the PC command line, where term is a program the PC starts. Everything below it comes from the device, and after the login the prompt is the device's:

term after login: the device prompt of an AX-serpent controller

PC command lineDevice command line
What it isCMD, PowerShell or bash on Windows, Terminal on macOS and LinuxThe YOS/Shell, running inside the device
Where commands runOn your PCIn the device
How you get thereThe Start menu, or LaunchPad's Command prompt buttonterm, or the emGUI command dialog for a single command
PromptC:\silixcon>, PS C:\silixcon>, user@pc:~$AX-serpent#/driver>: the device's basename, #, the folder in the device, >
CommandsPrograms on the PC: term, emgui, yosctl, bl_srm, launchpad, dirThe device's commands: help, ls, st, pr, set, save and those of your application
PathsFiles on the PC disk: C:\silixcon\setup.ysEntries in the device's tree: /driver/temp
Scripts.bat, .cmd, .ps1, .sh.ys YOS scripts, which term sends to the device
Helpterm -?, yosctl -?help, and the YOS commands pages
Leavingexit closes the windowEsc closes term and you are back at the PC prompt; logout ends the device session

Same name, different command​

Some commands exist on both sides and do different things. Look at the prompt before you type.

You typeOn the PC command lineIn the device (term)
helpCMD lists its own commands.Lists the device's commands.
setCMD sets an environment variable of the PC session, for example set addr=0 with SWTools 3.Writes a device variable: set <path> <value>.
cdChanges the folder on the PC disk.Changes the folder in the device's tree, for example cd /driver.
lsPowerShell and bash list the PC's files. CMD has no ls of its own.Lists the device's tree.
echoPrints text on the PC.Prints text from the device. echo \27 closes term.
termStarts the SWTools term program.The device's own term command: sends a line to another device over CAN or UART, or opens a nested terminal to it.

Which side am I on? Read the error message​

MessageWhat happenedWhat to do
'save' is not recognized as an internal or external command, operable program or batch file.A device command was typed in CMD.Start term, log in and type it at the device prompt.
The term 'save' is not recognized as the name of a cmdlet, function, script file, or operable program.The same in PowerShell.The same.
bash: save: command not foundThe same in bash.The same.
command 'yosctl' not found, try 'help' to list commandsA PC command was typed in term, so the device was asked to run it. Or the device has no command of that name.Press Esc to leave term and type it at the PC prompt. For a device command, check the name with help.
execute restrictedYour login does not allow this command.Log in with the credentials for your application.

Run a device command from the PC command line​

A script on the PC can still execute device commands, through a tool that carries them into the device. The PC command line runs the tool, and only the part after it reaches the device:

  • yosctl cmd exec <command> [arguments] runs one device command and returns. For example, yosctl cmd exec save -y typed in CMD saves the parameters in the device. See yosctl.
  • term --script=setup.ys (SWTools 4) sends the YOS commands in setup.ys to the device and exits; term setup.ys stays open afterwards. See term scripts.

Other ways in​

  • Serial terminal. Over UART, any serial terminal program (PuTTY, CoolTerm) reaches the device command line directly. See UART.
  • AI agent. An AI agent connected to emGUI runs device commands through emGUI. See AI agents (MCP).