.. _shell:

EGSE Shell
==========

The system provides a serial Electrical Ground Support Equipment (EGSE) shell on the RX/TX pins in the P2 connector.
The serial configuration is 8N1 at 115200 baud, and the console requires an ``Enter`` key press
to be activated.

For Linux systems, Satlab recommends the ``tio`` serial terminal application (`<https://tio.github.io/>`_)
but other applications such as ``minicom`` should also work. When using the Satlab serial adapter,
the EGSE shell is typically available on ``/dev/serial/by-id/usb-FTDI_Dual_RS232-if01-port0``.

A number of timestamped log messages are printed during boot from various logging groups.
Additional logging can be enabled at runtime using the ``trace`` commands.
The ``help`` command can be used to list available commands and their usage.
The installed software version and build information is also printed in the EGSE
shell during boot.

.. code-block:: none

    satlab@satlab:~$ tio -b 115200 /dev/serial/by-id/usb-FTDI_Dual_RS232-if01-port0
    [tio 09:49:45] tio v3.2
    [tio 09:49:45] Press ctrl-t q to quit
    [tio 09:49:45] Connected

    Satlab SRX-8 bootloader v1.1.0
    boot slot 0 (2 remaining attempts)

    [    0.000000] system: Copyright (c) 2025 Satlab A/S <satlab@satlab.com>
    [    0.008000] system: boot slot: 0 count: 1
    [    0.024000] prop: using stored sys properties
    [    0.881000] buc: firmware version 1.0.1

    Satlab SRX-8 v1.1.0

    [srx-8] help
    Available commands:
    boot            Bootloader commands
    csp             CSP commands
    echo            Display a line of text
    help            Show available commands
    history         Show previous commands
    prop            System configuration properties
    reboot          Reboot system
    time            Time command execution
    tm              Telemetry commands
    trace           Trace subcommands
    uptime          Show system uptime
    watch           Run command periodically

To show current telemetry values, run the ``tm show`` command. The ``watch`` command
can be used to periodically run a command, with the ``-b`` switch enabling screen
blanking between updates. Press any key to stop the loop:

.. code-block:: none

    Running command 'tm show' every 1000 ms
    Power Rails
    VIN              14946 mV     315 mA    4707 mW   32.00 C
    3V8               3809 mV     923 mA    3513 mW   32.25 C
    MCU                847 mV
    FPGA               853 mV

    Temperature Sensors
    VIN              32.00 C
    MCU              34.60 C
    FPGA             32.79 C
    MEM              32.12 C
    DAC              26.03 C
    Top              31.75 C
    Bottom           32.06 C

    BUC Power Rails
    Buck converter   14946 mV      16 mA     235 mW   31.87 C
    Boost converter  14950 mV       0 mA       7 mW   31.75 C
    Driver PSU           0 mV       0 mA       0 mW   31.75 C
    PA PSU               0 mV       0 mA       0 mW   32.50 C

    BUC Temperature Sensors
    Board            31.93 C
    Driver           31.75 C
    PA               31.75 C
    PA die            0.00 C

    Transmitter
    BBFRAMEs             0 frames
    GSE PDUs             0 frames
    Forward power     0.00 dBm
    Reflected power   0.00 dBm
    BUC gain          0.00 %
    Interrupted

Dynamic debugging messages can be enabled through the ``trace`` command group.
This can for example be used to log all received and transmitted CSP messages.
To do so, run ``trace mask csp all``:

.. code-block:: none

    [srx-8] trace mask csp all
    [ 2480.670000] csp: INP: S 2, D 28, Dp 1, Sp 62, Pr 2, Fl 0x00, Sz 1 VIA: KISS
    [ 2480.679000] csp: SERVICE: Ping received
    [ 2480.686000] csp: OUT: S 28, D 2, Dp 62, Sp 1, Pr 2, Fl 0x00, Sz 1 VIA: KISS
