Skip to content

Command Line interface

Peace Kotamnives edited this page May 5, 2022 · 10 revisions

Command Line Interface (CLI)

The command line interface has a read-line support based on microrl from helios. This CLI uses control characters for up-arrow etc support, so care must be taken when reading from the CLI.

The CL is available via the UART (front panel or Zynq).

Connecting to the CLI

On the LNX machines, use screen.

screen  /dev/ttyUSB1 115200

screen is a somewhat obscure piece of code; read the man page to see how to disconnect (C-a k).

On the Zynq, use minicom.

minicom -D /dev/ttyUL1

To exit minicom, type C-x a.

CLI commands

Some useful commands are errorlog 25, ff to get information about the fireflies, and fpga to get information about the FPGAs. To get help on a command, type help <string>. A brief help string will be typed for any command that starts with the string.

How to ...

  1. Reset various error states.
    1. Temperature alarm. Type alm clear to clear the temperature alarm.
    2. Power supply alarm. Type pwr clearfail to put the power supply state machine from the error state to the OFF state.
  2. Get information about the state of the CM. Read the help contents for the commands for more information.
    1. id prints out basic information about the CM.
    2. adc prints out the measurements of voltages on the board from the microcontroller ADC.
    3. fpga prints out the temperature of the FPGAs.
    4. psmon # prints out information about the LGA80D supplies.
    5. ff prints out the temperature of the SamTec firefly devices
    6. snapshot prints out the contents of the snapshot register of the selected LGA80D power supply. The power supplies must be OFF to be able to reset the snapshot register.

List of all CLI commands

The output of the help command is listed below (v0.99.1-9-g36f7).

adc:
 Displays a table showing the state of ADC inputs.
alm:
 args: (clear|status|settemp #)
Get or clear status of alarm task.
bootloader:
 Call the boot loader
clock:
 args: (1|2)
Reset (1) or program the clock synthesizer to 156.25 MHz (2).
eeprom_info:
 Prints information about the EEPROM.
eeprom_read:
 args: <address>
Reads 4 bytes from EEPROM. Address should be a multiple of 4.
eeprom_write:
 args: <address> <data>
Writes <data> to <address> in EEPROM. <address> should be a multiple of 4.
errorlog_entry:
 args: <data>
Manual entry of 2-byte code into the eeprom error logger.
errorlog:
 args: <n>
Prints last n entries in the eeprom error logger.
errorlog_info:
 Prints information about the eeprom error logger.
errorlog_reset:
 Resets the eeprom error logger.
fpga_reset:
 Reset Kintex (k) or Virtex (V) FPGA
ff:
 args: <none> |(xmit|cdr on/off (0-23|all))| regw reg# val (0-23|all) | regr reg# (0-23)
 Firefly monitoring command
ff_status:
 Displays a table showing the status of the fireflies.
ff_los:
 Displays a table showing the loss of signal alarms of the fireflies.
ff_cdr_lol:
 Displays a table showing the CDR loss of lock alarms of the fireflies.
fpga:
 Displays a table showing the state of FPGAs.
gpio:
 Get or set any GPIO pin.
help:
 This help command
id:
 Prints board ID information.
i2cr:
 args: <dev> <address> <number of bytes>
Read I2C controller. Addr in hex.
i2crr:
 i2crr <dev> <address> <n reg addr bytes> <reg addr> <n data bytes> 
 Read I2C controller. Addr in hex
i2cw:
 i2cw <dev> <address> <number of bytes> <value>
 Write I2C controller.
i2cwr:
 args: <dev> <address> <number of reg bytes> <reg> <number of bytes>
Write I2C controller.
i2c_scan:
 Scan current I2C bus.
jtag_sm:
 (on|off) set the JTAG from SM or not
loadclock:
 args: the clock id options to program are r0a:0, r0b:1, r1a:2, r1b:3 and r1c:4.
log:
 args: (<fac> debug|toggle|info|warn|fatal|trace)(status|quiet)
Manipulate logger levels
led:
 Manipulate red LED.
mem:
 Size of heap.
pwr:
 args: (on|off|status|clearfail)
Turn on or off all power, get status or clear failures.
psmon:
 Displays a table showing the state of power supplies.
psreg:
 <which> <reg>. which: LGA80D (10*dev+page), reg: reg address in hex
restart_mcu:
 Restart the microcontroller
snapshot:
 args:# (0|1)
Dump snapshot register. #: which of 5 LGA80D (10*dev+page). 0|1 decide if to reset snapshot.
set_id:
 args: <passwd> <addr> <data>
Allows the user to set the board id information.
set_id_password:
 One-time use: sets password for ID block.
simple_sensor:
 Displays a table showing the state of temps.
stack_usage:
 Print out system stack high water mark.
taskinfo:
 Info about FreeRTOS tasks
taskstats:
 Displays a table showing the state of each FreeRTOS task
time:
 (set HH:MM:SS MM/DD/YYYY|<none)
RTC set and display
uptime:
 Display uptime in minutes
version:
 Display information about MCU firmware version
watchdog:
 Display status of the watchdog task
zmon:
 args:(on|off)
 Control ZynqMon task.

I2C controllers

The CLI also allows raw reads and writes to the I2C devices. The I2C controllers that can be currently addressed are

  1. I2C 1 (for power supplies)
  2. I2C 2 (for clock synthesizer and external EEPROM)
  3. I2C 3 (for FF devices on the VU7P)
  4. I2C 4 (for FF devices on the KU15P)
  5. I2C 6 (for the two FPGAs)

The CLI commands for I2C r/w are all prefaced by i2c_*. The commands will interfere with the FreeRTOS tasks that also talk to these buses, so you need to be careful when using these commands.

I2C 2

  1. Clock synthesizers
    1. There are five clock chips on the CM board that function as clock synthesizers. That includes R0A, R0B, R1A, R1B, and R1C. Please see section 4.03: I2C CLOCK CONTROL of rev2b schematic sheet for more information on how clock I2C channels are connected to the I2C MUX (0x70).
  2. external EEPROM
    1. The 24CS512 is internally organized as 512 pages of 128 bytes each
    2. We have organized the EEPROM by writing two-byte address and data in three sequential addresses in EEPROM and block out 32 pages per clock in which a preamble list occupies the first, a register list occupies the next 30 pages and a postamble list occupies the last page. Here are the page block for each clock:
    • R0A: 00-1f
    • R0B: 20-3f
    • R1A: 40-5f
    • R1B: 60-7f
    • R1C: 80-9f
      With this triplet version, the number of EEPROM addresses for writing registers from those three lists are limited to 126 per page (division by three), and we currently enable one configuration file per clock chip at a time. If a configuration file is subjected to change or to be added, the Zynq/SM can load a new configuration file to replace a previous one via e.g. python LoadClkConfig_tripletEEPROM.py R1A Si5395-RevA-R1Av0003-Registers.csv --tty ttyUSB0 --quiet in mcu_tools