Skip to content

About

TES Controller for CDI

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

TES Controller Serial Command Reference

This document describes every serial command exposed by the TES Controller firmware found in TES_Controller/TES_Controller.ino. Use it as the definitive reference when interacting with the board over a USB serial connection or when building higher-level host tooling.

Serial Session Basics

  • Port settings: 115200 baud, 8 data bits, no parity, 1 stop bit, no flow control (115200 8N1).
  • Line endings: Commands are terminated with a newline (\n) or carriage return + newline (\r\n). The command parser is case-insensitive for the top-level tokens (LNA, TES, DAC, HELP) but subcommand keywords should be supplied exactly as shown below.
  • Channel numbering: Firmware expects one-based channel indices.
    • TES channels: 1 – 12
    • LNA channels: 1 – 2
  • Targets: Whenever a command requires a LNA target path, use literal GATE or DRAIN.

Response Format

Every command returns a YAML packet terminated by a blank line. Successful operations use:

---
status: ok
result:
  command: <NAME>
  ... additional key/value data ...

Failures (invalid parameters, I²C errors, etc.) use:

---
status: error
result:
  error: "<SYMBOLIC_ERROR>"
  code: <numeric_status>
  message: "<human readable context>"

Keys and numeric ranges mentioned below mirror the firmware exactly.

Command Tree Overview

Top-Level Syntax Skeleton Purpose
HELP HELP List every available command and subcommand.
DAC DAC <SUBCOMMAND> [...] Control the base flux-ramp DAC.
LNA LNA <channel> <GATE|DRAIN> <SUBCOMMAND> [...] Inspect or tune LNA DACs and telemetry.
TES TES <channel> <SUBCOMMAND> [...] Inspect or tune TES drive outputs and telemetry.

The sections below expand each subcommand, including argument ranges and the keys returned in result.

HELP

HELP

Prints a tree of all commands and their brief descriptions. No YAML payload is returned; the output is plain text generated by the StaticSerialCommands library.

DAC Commands

Top-level syntax: DAC <SUBCOMMAND> [...]

Subcommand Syntax Description Response keys
SET DAC SET <value> Write channel A of the MCP4728 flux-ramp DAC. Valid value range is 0 – 1024; this value is offset to a valid range. command: "DAC_SET", value (echo), message
GET DAC GET Read the current value programmed into channel A. command: "DAC_GET", value, message

LNA Commands

Top-level syntax: LNA <channel> <GATE|DRAIN> <SUBCOMMAND> [...]

  • channel: integral, 1 – 2
  • target: literal GATE or DRAIN
Subcommand Syntax Description Response keys
GET LNA <ch> <target> GET Aggregate status dump of the selected path. command: "LNA_GET", channel, target, dac_value, enabled, shunt_mV, bus_V, current_mA, power_mW
ENABLE LNA <ch> <target> ENABLE Assert the enable line. command: "LNA_ENABLE", channel, target, enabled: "true"
DISABLE LNA <ch> <target> DISABLE De-assert the enable line. command: "LNA_DISABLE", channel, target, enabled (currently returns the string "true"; treat the command success as authoritative)
SETMA LNA <ch> <target> SETMA <current_mA> Closed-loop search to achieve the requested current. current_mA range: 0 – 64. command: "LNA_SET", channel, target, current_mA, dac_value
SETV LNA <ch> <target> SETV <voltage_V> Closed-loop search to achieve the requested voltage. Range: 0 – 5 volts. command: "LNA_SET", channel, target, voltage_V, dac_value
SETDAC LNA <ch> <target> SETDAC <raw> Write a raw 12-bit DAC code (0 – 4095). command: "LNA_SET", channel, target, value
SHUNT LNA <ch> <target> SHUNT Read the INA228 shunt voltage in millivolts. command: "LNA_SHUNT", channel, target, shunt_mV
BUS LNA <ch> <target> BUS Read the bus voltage in volts. command: "LNA_BUS", channel, target, bus_V
CURRENT LNA <ch> <target> CURRENT Read the calculated current in milliamps. command: "LNA_CURRENT", channel, target, current_mA
POWER LNA <ch> <target> POWER Read the calculated power in milliwatts. command: "LNA_POWER", channel, target, power_mW

Errors during any LNA operation return an error symbol such as "LNA_SET_ERROR", "LNA_BUS_READ_ERROR", etc., along with the low-level I²C status code (code).

TES Commands

Top-level syntax: TES <channel> <SUBCOMMAND> [...]

  • channel: integral, 1 – 12
Subcommand Syntax Description Response keys
GET TES <ch> GET Aggregate status dump of the TES channel. command: "TES_GET", channel, enabled, tca_bits, shunt_mV, bus_V, current_mA, power_mW
ENABLE TES <ch> ENABLE Enable the TES output stage. command: "TES_ENABLE", channel, enabled: "true"
DISABLE TES <ch> DISABLE Disable the TES output stage. command: "TES_DISABLE", channel, enabled: "false"
SET TES <ch> SET <current_mA> Closed-loop current search (0 – 20 mA). Returns the final DAC state used. command: "TES_SET", channel, current_mA (achieved), tca_bits
SETINT TES <ch> SETINT <bits> Write raw 20-bit TCA output as an integer (0 – 0xFFFFF). command: "TES_SETINT", channel, tca_bits
SETHEX TES <ch> SETHEX <hex_value> Write raw 20-bit TCA output in hexadecimal (00000 – FFFFF). command: "TES_SETHEX", channel, tca_bits
BIT TES <ch> BIT Read the current TCA output state. command: "TES_BITS", channel, tca_bits
INC TES <ch> INC <delta> Increase the TCA output by delta counts (0 – 0xFFFFF). command: "TES_INC", channel, delta, tca_bits
DEC TES <ch> DEC <delta> Decrease the TCA output by delta counts. command: "TES_DEC", channel, delta, tca_bits
SHUNT TES <ch> SHUNT Measure shunt voltage (mV). command: "TES_SHUNT", channel, shunt_mV
BUS TES <ch> BUS Measure bus voltage (V). command: "TES_BUS", channel, bus_V
CURRENT TES <ch> CURRENT Measure TES current (mA). command: "TES_CURRENT", channel, current_mA
POWER TES <ch> POWER Measure TES power (mW). command: "TES_POWER", channel, power_mW

All TES error responses follow the same structure with symbols like "TES_SET_CURRENT_ERROR", "TES_TCA_READ_ERROR", etc.

Notes & Tips

  • Search-based setters: LNA SETMA, LNA SETV, and TES SET perform iterative searches using the underlying driver convenience routines. The returned current_mA, voltage_V, or tca_bits represent the post-search state actually achieved.
  • Raw DAC writes: SETDAC, SETINT, and SETHEX bypass any search logic and immediately write the specified code. Take care not to exceed the valid ranges—values outside the ranges listed above are rejected with status: error.
  • Telemetry units:
    • Shunt voltages are reported in millivolts (mV).
    • Bus voltages are reported in volts (V).
    • Currents are reported in milliamps (mA).
    • Powers are reported in milliwatts (mW).
  • Error codes: The numeric code field in an error response comes directly from the driver status return (typically an I²C error byte). A non-zero code indicates the call did not reach the requested hardware state.

With this reference you can script direct interactions with the firmware, build custom tooling, or simply verify that higher-level software layers send the expected traffic.

About

TES Controller for CDI

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages