Text commands (SCPI)
Both firmwares are driven by lines of text in the form of SCPI, the command language of lab instruments:
*IDN?, MEAS?, TEMP 300. The TS1C station and iron and the MHP50 plate take them
over a USB serial port, the iron and the plate over Bluetooth as well. The phone apps and the computer tools
(tools/ts1c.py, tools/mhp50.py) send the same lines, and so can anyone with a serial
terminal: what the buttons do, a line does, and so do things the buttons cannot, such as reading the log or flashing
the firmware.
The two firmwares use the same verbs, but each has a parser of its own, and they differ in a few rules, listed below. The tables in the firmware repositories are the contract: docs/development.md for the TS1C, fw/app/scpi.h for the MHP50.
Connecting
| Device | USB serial port | Bluetooth |
|---|---|---|
| TS1C station | 1209:0001 | none: the station is a Bluetooth central to its own iron only |
| TS1C iron | 1209:0002 | Nordic UART Service, name TS1C-XXXXXXXX, no pairing, one link at a time |
| MHP50 plate | 1209:0003 | Nordic UART Service, name MHP50-XXXXXXXX, from the first four bytes of the chip's UID |
- The USB port is a CDC ACM serial port:
/dev/ttyACM*on Linux,/dev/cu.usbmodem*on macOS, a COM port on Windows. The baud rate and the other port settings mean nothing, so any terminal settings do. The loaders answer on the same port, the applications' commands aside. - Over Bluetooth the commands are written to the characteristic
6e400002-…(write, with or without response) of the service6e400001-b5a3-f393-e0a9-e50e24dcca9e, and the replies come as notifications of6e400003-…, in chunks of the ATT MTU less 3 bytes. The loaders have no Bluetooth. - A new session starts empty, with no half-read line and no errors: on the TS1C when DTR rises or a Bluetooth link opens, on the MHP50 when the port is reconnected, the bus is reset or a link is lost.
- The station is no bridge to its iron. Over its USB port it answers its own commands, and it gives the iron's
readings it last polled itself:
:IRON:MEAS?,:IRON:PD?,:IRON:IDN?.
Lines and replies
- A line ends at LF; a CR before it is dropped. A line is at most 256 bytes (on the MHP50 not counting a block); a longer one is dropped whole with error −363.
- A line holds one command or several separated by
;, run left to right. Every command has its full header, and the leading:may be left out. An error does not stop the line: the next command runs. - Headers are case-insensitive. A query ends with
?. - Parameters follow one space and are separated by commas: a number; a boolean
ON,OFF,1or0; a word from the command's own list; or an IEEE 488.2 definite block#<digits><length><bytes>, whose bytes may hold anything,;and LF too. - The replies of a line's queries come back as one line, joined by
;and ended by LF. A command without?replies nothing; what went wrong goes to the error queue. - A reply of several values is a list of
NAME=valuepairs, so either side can add fields without breaking the other. Booleans come back asONorOFF, raw words as0xand 8 hex digits, bytes as a definite block. - Replies come in the order of the commands: a command runs only once the reply before it has gone. On the MHP50 a screen a command has changed is drawn before the next command reads it.
- Nothing comes unasked: no events and no service requests. The log, too, is read by a query.
Where the two firmwares differ
| TS1C | MHP50 | |
|---|---|---|
| Headers | The short forms only: SYST:ERR? works, SYSTem:ERRor? is −113 | Short and long forms, SYST:ERR? or SYSTem:ERRor? |
| Numbers | Integers, decimal or 0x hex; no fractions | Decimal, signed, with a fraction; addresses decimal only (0x08012000 is 134291456); text in double quotes |
| A failed query | A line in which no query ran gets no reply at all, so hosts end their lines with ;:SYST:ERR? | Its place in the reply stays empty; the ; around it still come |
| A missing number | — | 9.91E37, as in SCPI |
| A full error queue | The new error is dropped | The newest entry becomes −350 |
SYST:RES | Resets once the line's replies are out | Resets at once; a reply not sent yet is lost |
Errors
SYST:ERR? reads the error queue, oldest first, one error per answer, and gives 0,"No error"
when it is empty. The queue holds 8 errors; the MHP50 keeps one for USB and one for Bluetooth. Errors also go to the
device's log.
| Code | Text | When | TS1C | MHP50 |
|---|---|---|---|---|
| −100 | Command error | A command not understood | — | yes |
| −102 | Syntax error | Garbage in the line | — | yes |
| −108 | Parameter not allowed | A parameter too many | — | yes |
| −109 | Missing parameter | A required parameter is absent | yes | yes |
| −113 | Undefined header | No such command; on the TS1C also a long form, or an application's command sent to the loader | yes | yes |
| −160 | Block data error | A broken block | — | yes |
| −200 | A run is going, USB disk mode is on | A start, a disk write or a setting during a run; any work on the disk while it is given to the computer | — | yes |
| −221 | TS1C: Settings conflict; MHP50: the words on the screen | A valid command the device cannot do now: HEAT ON on a station with no iron linked; a start the plate refuses, such as Put a plate on to start or No plate contact | yes | yes |
| −222 | Data out of range | A value out of range; on the TS1C also not a number, boolean or listed word where one is wanted | yes | yes |
| −224 | Illegal parameter value | A word not in the list | — | yes |
| −250 | Mass storage error | The disk did not mount, or the file system failed | — | yes |
| −256, −257 | File name not found, File name error | No such file, a bad name | — | yes |
| −311 | Memory error | The flash did not take an erase or a write, or read back otherwise | yes | yes |
| −350 | Queue overflow | The error queue was full | — | yes |
| −363 | Input buffer overrun | A line longer than 256 bytes | yes | yes |
Of the IEEE 488.2 common commands there is only *IDN?: no *RST, *CLS,
*OPC?, status registers or service request.
Examples
Lines as the bench devices answered them; > is the computer, < the device. The
plate's reply is one line, wrapped here.
> *IDN?;:TEMP?;:SETT? TS1C iron
< OpenWare,TS1C-IRON,84C2E444E8E1,v0.7.0-2-g9281be2-dirty;0;PREHEAT=250,OFF=2400,BOOST=400
> :FOO?
(no reply: the line's only query failed)
> :TEMP?;:FOO?;:SETT:BOOST 500;:SYST:ERR?;:SYST:ERR?;:SYST:ERR?
< 0;-113,"Undefined header";-222,"Data out of range";0,"No error"
> MEAS? MHP50 plate
< RUN=HEAT,MODULE=BS50_1,TEMP=100.1,SETPOINT=100.0,POWER=23,POWER_MAX=90,INPUT=DC,VIN=24066,FILE="",
STEP=0,STEPS=0,ELAPSED=83,TITLE="Manual heating",MSG="At temperature",MSG_RIGHT="for 1 min",BLOCK=""
Commands both firmwares have
Written here in the TS1C's short form; the MHP50 takes the long form too (SYSTem:ERRor?). The last
column says whether the loader answers it as well.
| Command | Reply or effect | Loader |
|---|---|---|
*IDN? | OpenWare,<device>,<serial>,<version>: TS1C-STATION or TS1C-IRON with the Bluetooth MAC and the version; MHP50 with the chip's UID (24 hex digits) and the build id (8). A loader adds -LOADER to the device | yes |
SYST:ERR? | The oldest error, <code>,"<text>" | yes |
SYST:INFO? | MODE=APP|LOADER,IMAGE_ID=…,RESET=…: which image runs, the id of the application in flash, what reset the chip (power, pin, software, watchdog…) | yes |
SYST:RES [LOAD] | Reset; with LOAD, stay in the loader | yes |
SYST:FAUL? | The record of the application's last crash, kept over the reset: IMAGE_ID, IPSR, SP, R0–R3, R12, LR, PC, XPSR; empty if there is none | yes |
SYST:FAUL:CLE | Forget the crash record | yes |
LOG? | A block of the log's whole lines since the last LOG? | yes |
LOG:ALL? | A block of the whole log ring | yes |
MEM:READ? <addr>,<len> | A block of bytes from the chip's memory map: flash, RAM, the UID; on the TS1C at most 1024 bytes | yes |
FLAS:ERAS <addr> | Erase a flash page of the other image: the loader erases the application's, the application the loader's. Pages are 512 bytes on the TS1C, 256 on the MHP50. The Miniware bootloader is never in reach | yes |
FLAS:WRIT <addr>,<block> | Write erased flash in the same window and compare it by reading back | yes |
SYST:KEY | A button press, held for a time if given: A|B[,<ms>] on the station and the plate, BTN[,<ms>|DOWN|UP] on the iron. On the plate 30–10000 ms, 100 by default; over 700 ms is a long press | — |
SYST:CRAS | Crash the application on purpose with an undefined instruction: the crash is recorded and the chip resets into the loader. No reply: the port goes with the chip | — |
SYST:HANG | Hang it: interrupts off, then the watchdog resets the chip into the loader (on the TS1C, if a computer is on the port within 5 s, else the application starts again). The plate turns its heater off first | — |
The flash windows: the TS1C loader writes 0x6000–0x3EFFF, its application 0x4000–0x5FFF; the MHP50 loader writes
0x08012000–0x08052FFF, its application 0x08010000–0x08011FFF. On the TS1C, SYST:CRAS and
SYST:HANG come with the release after v0.7.0.
TS1C station
Over USB, besides the commands above. Units are in the field names: _MV mV, _MA mA,
_DC 0.1 °C, _DS 0.1 s, _DW 0.1 W, _US µs,
_C °C; commands take whole degrees and seconds.
| Command | Reply or effect |
|---|---|
:HEAT ON|OFF, :HEAT? | Heat on at Work Temp or off, as a short press of A at home. ON with no iron linked, or against the No-PD Heat rule, is −221 |
:SETT? | Every setting: WORK=300,BOOST=400,PREHEAT=250,IDLETIME=600,IDLETEMP=150,SLEEPTIME=1800,UNIT=C,STEP=1,LIGHT=5,SCREEN=2,NOPD=OFF,BEEPSTART=ON,BEEPREADY=ON,BEEPLOW=ON (the defaults) |
:SETT:<NAME> <value>, :SETT:<NAME>? | One setting, as an edit in the menu: saved 3 s later, sent to the iron, the screen redrawn. It does not wake the station |
:SETT:RES | The Reset item: the defaults, the paired iron forgotten |
:DISP:DATA? | The frame last drawn, as a block: a 1-bit BMP of 128×64, 1086 bytes, lit pixels white; also while the station sleeps |
:PD? | The station's own USB PD: the fields of the iron's :PD?, plus BUDGET_MA (the dock's budget), HV_BLOCK (5 V only allowed), TRANSITION (a voltage change under way) |
:IRON? | ADDR=<12 hex>,LINKED=ON|OFF,LINK=ON|OFF: the paired iron (zeros without one), whether it is linked, whether the station holds the link |
:IRON:LINK ON|OFF | Release the paired iron for a phone, or take it back, as three presses of B; OFF without a paired iron is −221 |
:IRON:MEAS?, :IRON:PD?, :IRON:IDN? | The iron's last :MEAS?, :PD? and *IDN? replies, in the iron's form; −221 while not linked or before the first reading |
:SYST:ENC <n> | n encoder steps, −32768 to 32767, positive clockwise |
:SYST:DOCK OUT|IN|AUTO | Force the dock sensor out or in, or give it back |
:MEM:WRIT <addr>,<block> | Write RAM or the peripheral registers, not the flash controller; the application only. The iron has it too |
| Setting | Values |
|---|---|
WORK, BOOST, PREHEAT, IDLETEMP | 100–400 °C, whatever the unit shown. PREHEAT above WORK is −222; WORK below PREHEAT pulls PREHEAT down with it |
IDLETIME, SLEEPTIME | 30–2400 s, a multiple of 30: the time in the dock to Idle Temp and to sleep |
UNIT | C or F |
STEP | 1–25, the encoder step |
LIGHT | 1–10, the contrast |
SCREEN | 0–6: Classic, Budget, Power flow, Dial, Graph, Sources, Trend |
NOPD, BEEPSTART, BEEPREADY, BEEPLOW | ON or OFF |
TS1C iron
One table for USB and Bluetooth, besides the commands both firmwares have. Heat started over Bluetooth stops when
the link is lost, heat started over USB does not; boost and a button held by :SYST:KEY over Bluetooth are
let go at the link's loss too.
| Command | Reply or effect |
|---|---|
:MEAS? | The telemetry, 29 fields: UPTIME_DS, VIN_MV, DOCK_MV, VBUS_MV, VBAT_MV, IBUS_MA, IBAT_MA, SC_OK, TIP_DC, TIP_UV, HANDLE_DC, SUPERCAP_DC, CHIP_DC, BC_LVL, CHARGE_STATE, VINREG_MV, IBUS_LIM_MA, HEAT_MODE, REG_SRC, SETPOINT_C, REG_SP_C, PULSE_US, DUTY_PERMILLE, POWER_DW, TIP_MOHM, IMAGE_ID, SWITCHES, PD_HV, VERSION |
:PD? | USB PD: STATE, CC, BC_LVL, REV, PDO_COUNT, PDO1…PDO7 (hex), REQ_MV, REQ_MA, CONTRACT_MV, CONTRACT_MA, LONGEST_US |
:TEMP <°C>, :TEMP? | Heat at that setpoint, 0–400 °C, starting or changing in place; 0 is off. The query gives the setpoint held now, 0 unless heating |
:HEAT ON|OFF, :HEAT? | ON: as one short press of the handle's button with the heat off, at the last setpoint (−221 without one since the reset). OFF: any heat off |
:HEAT:REST ON|OFF | Rest or work, as the short press toggles them; −221 unless heating out of the dock with no USB-C source above 5 V |
:HEAT:BOOST ON|OFF | As if the button were held: the boost setpoint while ON |
:SETT? | PREHEAT=…,OFF=…,BOOST=…; there are no queries of single settings |
:SETT:PREHEAT, :SETT:BOOST | 10–400 °C: the setpoint in the dock, the boost setpoint; kept in RAM |
:SETT:OFF | 0–65535 s, the shutdown time; 0 is never |
:DOCK <in>,<mV>,<mA>,<sleep>, :DOCK? | The station's word to its iron: in the dock, the station's PD contract, the dock's budget, the station asleep |
:HEAT:MODE OFF|RTIP|OTG|PULSE|REG,<1..400> | The heating steps one by one, for debugging; PULSE outside OTG is −221 |
MHP50 plate
Over USB and Bluetooth, besides the commands both firmwares have.
| Command | Reply or effect |
|---|---|
MEASure? | What the plate is doing now, the words on the glass among it: RUN, MODULE, TEMP, SETPOINT, POWER, POWER_MAX, INPUT, VIN, FILE, STEP, STEPS, ELAPSED, TITLE, MSG, MSG_RIGHT, BLOCK |
TEMPerature <°C>, TEMPerature? | The setpoint of manual heating, whole degrees from 50 to the head's limit |
HEAT ON|OFF, HEAT? | Start manual heating, or stop any run, as a long press on the right |
PROGram:RUN "<file>" | Run a profile from the plate's disk |
SETTings? | Every setting: BACKLIGHT, BEEP, DC_POWER, PD_POWER, TIP_OFFSET, TILT, PRESET_1…PRESET_4 |
SETTings:<NAME> <value>, SETTings:<NAME>? | One setting, in the same units; applied at once and saved |
PD? | The USB PD contract and the source's offers: CONTRACT_MV, CONTRACT_MA, PDO_COUNT, PDO1… (raw, 0x and 8 hex digits) |
MMEMory:CATalog? | <used>,<free> and a "<name>,,<size>" per file on the plate's disk |
MMEMory:DATA? "<file>" | The whole file as a block, even RUNLOG.TXT of 512 KiB: it goes out in pieces |
MMEMory:DATA "<file>",<block> | Write a file of up to 4096 bytes, its name 1–64 bytes, over one of the same name |
MMEMory:DELete "<file>" | Delete a file |
MMEMory:INITialize | Make the disk an empty stock one again; every file is lost |
SPI:READ? <addr>,<len> | Raw bytes of the external 8 MiB flash |
Where it departs from SCPI-1999
- Of IEEE 488.2 there is only
*IDN?: no status registers,*CLS,*RST,*OPC?or service requests. - A reply of several values is a list of
NAME=valuepairs, not a bare list of values, so fields can be added and moved without breaking a client. - Only definite blocks; no indefinite ones.
- On the TS1C: short headers only, no optional nodes and no numeric suffixes; integers only, decimal or
0xhex, with no units,MIN,MAXorDEF; a full error queue drops the new error instead of reporting −350. - On the MHP50: the text of error −221 is the words on the plate's screen, so a client shows a refused start as the glass does; each transport has an error queue of its own.
- Commands of their own: the button, encoder and dock sensor driven from a line (
SYST:KEY,SYST:ENC,SYST:DOCK), the station's dock word to its iron (:DOCK), and the crash and hang on purpose (SYST:CRAS,SYST:HANG) to check the crash record and the watchdog on a live device.