Boxer – Manifold Box Controller

Boxer code will run on two incarnations of the system board: Out of Form Factor (OFF) and In Form Factor (IFF). OFF hardware will use the Arduino Mega, while IFF hardware will be a custom PCB.

Table of Contents

Serial connection details

Command interface

The command interface is via USB, but the hardware will enumerate as a virtual serial port. The port will need to be configured with these settings:

Platform Baud Data bits Stop bits Parity checking
OFF 38400 8 1 None
IFF 230400 8 1 None

Debug interface

The debug interface is via USB, but the hardware will enumerate as a virtual serial port. The port will need to be configured with these settings:

Platform Baud Data bits Stop bits Parity checking
OFF 38400 8 1 None
IFF 230400 8 1 None

Uploading new firmware

Both the OFF and IFF hardware versions will use the Optiboot bootloader to burn new firmware into memory. Optiboot is supported by AVRDUDE, which can coordinate sending new hex files over a Virtual Comm Port (VCP). The relevant command is:

$(avrdude) -v -p m2560 -P $(VCP) -c arduino -b $(avrdude_baud) -F -u -U flash:w:$(hex_file)

where $(avrdude) is the AVRDUDE executable, $(VCP) is the Virtual Comm Port, $(avrdude_baud) is the baud rate used by the bootloader, and $(hex_file) is the new firmware in Intel HEX format.

For Windows, VCP examples are com5, com23, etc. For Linux, VCP examples are /dev/ttyUSB0, /dev/ttyUSB1, etc. Baud rates for our two platforms are shown below.

Platform Baud
OFF (Arduino Mega) 38400
IFF (Whitfield – 90071) 230400

Command reference

Commands are not case-sensitive – the command *IDN? is the same as *idn?.

Commands always return something. If the command doesn’t have an explicit return value or string, it will return 0 (ACK). Unrecognized commands or commands causing other problems will return one of the not-acknowledged (NACK) codes shown below.

NACK code Condition
-1 Command not recognized
-2 System is busy
-3 Command execution failed
-4 Buffer overflow
-5 Argument out of range

A command may fail with the “command execution failed” code if some hardware is missing. For example, CH5.BYP.DAC 100 will fail if one of the Topaz boards isn’t plugged in.

A naked carriage return is not considered a command, and as such may be used to clear the instrument’s receive queue. The first carriage return may send garbage to the command handler and return a NACK, so the host will need to clear it’s own receive queue before sending new commands.

The controller can only handle one command at a time, and commands take a variable length of time to execute. Waiting for 500ms after sending a command is enough for all commands to produce their returns.

IEEE-488 common commands

*IDN?

Returns the instrument’s identification string containing four comma-separated fields:

  1. Manufacturer name
  2. Model number
  3. Serial number
  4. Revision code
Parameter

None

Typical Return

Picarro,Boxer,SN0,1.0.0

LOGLEV?

Query the system’s log message severity threshold. Pressure readings only happen at full speed (100 Hz) when the threshold is set to “error.” This level is hard-coded. Return values are isr, debug, info, warning, and error.

Parameter

None

Typical Return

error

*RST

Initiates a system reset.

Parameter

None

Typical Return

None

System-level commands

SERNUM n

Set the instrument’s serial number to n. Query the serial number with *IDN?.

Parameter (n)

16-bit integer (0-65535) formatted as a decimal.

Typical Return

0

SLOTID n

Set the manifold box’s slot ID. There can be more than one manifold box in a rack, and this will help us keep track of which rack position it was installed into. This setting is non-volatile – it will persist across power cycles.

Parameter (n)

Integers 0-9

Typical Return

0

SLOTID?

Query the manifold box’s slot ID.

Typical Return

3

OPSTATE?

Query the system’s operational state.

Typical Return

standby

STANDBY

Put the system in standby mode. This will disable all channels and configure their bypass valves for the default flow. This command may fail if the standby state isn’t accessible from the current state.

Typical Return

0

CLEAN

Put the system in clean mode. As with standby, this will disable all channels and configure their bypass valves for the default flow. Unlike standby, this will open the clean solenoid to allow clean gas to go to the analyzers.

You can exit clean mode by enabling a sample channel or going back to standby mode.

Typical Return

0

TZA.SN n

Set the serial number for manifold (Topaz) board A.

Parameter (n)

Integers 0-65535

Typical Return
Return Condition
0 Serial number set
-1 Topaz A not connected

TZA.SN?

Query the serial number for manifold (Topaz) board A.

Typical Return
Return Condition
10 Successful return for Topaz board 10
-1 Topaz A not connected

TZB.SN n

Set the serial number for manifold (Topaz) board B.

Parameter (n)

Integers 0-65535

Typical Return
Return Condition
0 Serial number set
-1 Topaz B not connected

TZB.SN?

Query the serial number for manifold (Topaz) board B.

Typical Return
Return Condition
10 Successful return for Topaz board 10
-1 Topaz A not connected

TZA.RST

Execute a hardware reset of manifold (Topaz) board A. This does not seem to reset the MPR pressure sensors.

Typical Return

0

TZB.RST

Execute a hardware reset of manifold (Topaz) board B. This does not seem to reset the MPR pressure sensors.

Typical Return

0

Channel commands

Each manifold box (piglet) has 8 channels. Internally, there are 4 channels on two manifold (topaz) boards. Channels are arranged on boards as shown below.

Topaz channel names

CHANENA n

Enable channel n.

Parameter (n)

Integers 1-8

Typical Return

0

CHANENA? n

Returns 1 if channel n is enabled, or 0 if it’s disabled.

Parameter (n)

Integers 1-8

Typical Return

0

CHANOFF n

Disable channel n.

Parameter (n)

Integers 1-8

Typical Return

0

CHANSET n

Set the channel enable register. Each channel has a position in the enable register bitfield, starting with channel 1 and ending with channel 8. Enable a channel by setting the channel’s bit. Disable a channel by clearing the channel’s bit.

Parameter (n)

Integers 0-255

Typical Return

0

CHANSET?

Query the channel enable register.

Typical Return

8

Pressure commands

PRS.IN.RAW? n

Query the raw digital pressure reading from one of the inlet sensors. Each channel has one inlet sensor. The raw pressure reading is a 24-bit number.

Parameter (n)

Channel number 1-8.

Typical Return

14799059

PRS.OUT.RAW? n

Query the raw digital pressure reading from one of the outlet sensors. Each manifold (Topaz) board has one outlet sensor. Outlet sensor 1 is on the board with channels 1-4, and sensor 2 is on the board with channels 5-8.

Typical Return

14799059

PRS.IN.PAS? n

Query the pressure at inlet channel n calibrated in Pascals.

Parameter (n)

Channel number 1-8

Typical return

100449

PRS.OUT.PAS? n

Query the pressure at the outlet pressure sensor on Topaz A (n = 1) or Topaz B (n = 2). The return value will be calibrated Pascals.

Parameter (n)

1 or 2

Typical return

100449

PRS.ALPHA n

Set the exponential moving average factor for pressure readings. See this Wikipedia page for a description of this factor. In our case, alpha values of 0-1 are represented by settings of 0-65535, where 65535 gives the least averaging, and 0 gives the most.

Parameter (n)

Integers 0-65535

Typical Return

0

PRS.ALPHA?

Query the exponential averaging factor used for pressure readings.

Typical Return

65535

PRS.RATE? n

Query the successful read cycle rate for pressure sensors on either Topaz A (n = 1) or B (n = 2). The return value will be the number of times all sensors on the specified board were read in 1 second.

Parameter (n)

1 for Topaz A (channels 1-4) or 2 for Topaz B (channels 5-8).

CHx.PRS.SLP n

Set the slope calibration factor n for the channel x inlet pressure sensor. There are 8 of these commands: CH1.PRS.SLP, CH2.PRS.SLP, …, CH8.PRS.SLP. The calibration factor n has units of micro Pascals per count.

Parameter (n)

0-65535

Typical return

0

IN.PRS.SLP? n

Query the inlet pressure sensor slope calibration factor set with one of the CHx.PRS.SLP n commands. The return will have units of micro Pascals per count.

Parameter (n)

1-8

Typical return

12842

CHx.PRS.OFF n

Set the offset calibration factor n for the channel x inlet pressure sensor. There are 8 of these commands: CH1.PRS.OFF, CH2.PRS.OFF, …, CH8.PRS.OFF. The calibration factor n has units of Pascals.

Parameter (n)

0-65535

Typical return

0

IN.PRS.OFF? n

Query the inlet pressure sensor offset calibration factor set with one of the CHx.PRS.OFF n commands. The return will have units of Pascals.

Paramter (n)

1-8

Typical return

21546

TZA.PRS.SLP n

Set the slope calibration factor n for the outlet pressure sensor on Topaz board A. This board handles channels 1-4. The calibration factor n has units of micro Pascals per count.

Parameter (n)

0-65535

Typical return

0

TZB.PRS.SLP n

Set the slope calibration factor n for the outlet pressure sensor on Topaz board B. This board handles channels 5-8. The calibration factor n has units of micro Pascals per count.

Parameter (n)

0-65535

Typical return

0

OUT.PRS.SLP? n

Query the outlet pressure sensor offset calibration factor set with the TZA.PRS.SLP n or TZB.PRS.SLP n commands. The return will have units of micro Pascals per count. Use n = 1 for Topaz A and n = 2 for Topaz B.

Parameter (n)

1 or 2

Typical return

12842

TZA.PRS.OFF n

Set the offset calibration factor n for the outlet pressure sensor on Topaz board A. This board handles channels 1-4. The calibration factor n has units of Pascals.

Parameter (n)

0-65535

Typical return

0

TZB.PRS.OFF n

Set the offset calibration factor n for the outlet pressure sensor on Topaz board B. This board handles channels 5-8. The calibration factor n has units of Pascals.

Parameter (n)

0-65535

Typical return

0

OUT.PRS.OFF? n

Query the outlet pressure sensor offset calibration factor set with one of the TZA.PRS.OFF n or TZB.PRS.OFFn commands. The return will have units of Pascals. Use n = 1 for Topaz A and n = 2 for Topaz B.

Parameter (n)

1 or 2

Typical return

21546

Temperature commands

VER.TMP?

Query the temperature at the surface of the Vernon (power distribution) board in Celsius. Temperatures are always positive integers.

Typical Return

28

TZA.TMP?

Query the temperature at the surface of the Topaz A (manifold) board in Celsius. Temperatures are always positive integers.

Typical Return

25

TZB.TMP?

Query the temperature at the surface of the Topaz B (manifold) board in Celsius. Temperatures are always positive integers.

Typical Return

25

Proportional bypass valve commands

CHx.BYP.DAC n

Set the voltage DAC output controlling the proportional valve current source. There are 8 of these commands: CH1.BYP.DAC, CH2.BYP.DAC, …, CH8.BYP.DAC. The table below relates DAC codes to output current. For example, the revision A Topaz boards will produce 65535 * 3.4492 uA/count = 226 mA maximum.

Hardware version uA / count
A 3.4492
Parameter (n)

0-65535

Typical return

0

BYP.DAC? n

Query the bypass DAC setting for channel n. Returns a value in counts.

Parameter (n)

1-8

Typical return

17134

Channel identification commands

MFCVAL?

Query this piglet’s required Mass Flow Controller (MFC) setting contribution. The sample lines coming from each piglet will flow through a single MFC, and the piglet firmware has no idea if other piglets are present. This number thus represents the number that needs to be added to all the other MFCVAL? outputs to form the ultimate MFC setting.

The output will be a floating-point number.

Typical Return

40.0

IDENTIFY

Start the channel identification process. This can only be invoked in standby mode.

Typical Return

0

IDSTATE?

Query the channel identification substate.

Substate Returned string
Ambient ambient
Calculate calculate
Not in identify mode none
Typical Return

none

ACTIVECH?

Return a number corresponding to the active channels discovered during channel identification. Each bit in the 8-bit number corresponds to a channel, and bits are set when the channel is active.

Active channels ACTIVECH?
none 0
all 255
3 4
Typical Return

255

Release history

Version 1.0.0

This version is only for testing the bootloader, USB enumeration, and the basic command interface. The *IDN? command works to identify the device.

The SERNUM command will likely go away! You can use this command to test writing the serial number, but the command will likely change in the next version.

Version 1.0.1

This version is for testing the channel enable commands with the bargraph LEDs.

Version 1.0.2

Added SLOTID command and its query. This will help us keep track of where the manifold box is in the rack, and thus to number its channels.

Version 1.0.3

Added default log level setting to makefile. This allows producing hex release files tagged with the log level.

The command interface will now emit a NACK (-1) when the received character buffer overflows. This may allow the rack PC to simply send characters and look for a NACK when waiting for the remote interface to be ready.

Version 1.0.4

Added watchdog timer. The system will reset after 1 second if it hangs anywhere.

Added the *RST command to initiate a reset over the command interface.

Version 1.0.5

Added the OPSTATE command to query the current operating state.

Version 1.0.6

Added the TZA.SN and TZA.SN? commands to set and get the serial number for Topaz A. These commands, for now, simply return -1 if the board isn’t connected.

Version 1.0.7

Started to add NACK codes. See the command reference for the current list. Commands without an explicit return will still simply return 0 for successful completion.

Version 1.0.8

Added the PRS.IN.RAW? query for the 8 inlet pressure sensors. This is the first sensor data command. The command takes an argument (1-8) to select the inlet channel. The return is raw counts from the sensor. Revision A boards have 15 PSI sensors, while newer revisions will probably have 25 PSI sensors.

Pressures are currently sampled at a very slow rate – about once every 2 seconds. This is to make room for debug messages. I’ll increase the speed when I’m more confident.

Version 1.0.9

Added the CHx.BYP.DAC n commands to set the sample bypass proportional valve positions. Note that the proportional valve current control circuit has some offset issues with revision A Topaz. The current through the proportional valves will change when solenoid valve selections change.

Pressures are now sampled at 100Hz when the log level is set to “error.”

Version 1.0.10

Increased pressure sensor read frequency to 100Hz. The delay between pressure sensor triggers and reads is now 6ms. The minimum value here is 5ms, but I worry about timing variations at that level violating this 5ms limit. 100Hz is a safe reading frequency.

Hex file releases now have an extra attribute: _mega or _whitfield. Use _mega releases for the Arduino Mega, and _whitfield for Picarro’s 90071 PCBs.

Version 1.1.0

This release supports two Topaz boards with the new system board – Whitfield. You’ll need to use the new 230.4k baud rate instead of the old 38.4k. The Topaz boards need to be modified to have an I2C multiplexer address of 0x71 instead of the default 0x70.

Added the TZB.SN command. Note that you can’t communicate with new Topaz boards until they have serial numbers. Getting the serial number is the system board’s way of discovering the hardware.

This firmware reads the 10 pressure sensors at about 35 Hz.

Version 1.1.1

Added the clean command and support for the clean solenoid. Sending the clean command will disable all sample channels and open the clean solenoid.

Version 1.1.2

Added support for the front panel PCB “Aloha.” There are no new remote commands to go with this.

Version 1.1.3

This version does not read the pressure sensors. All prs.* commands will return 0. This will be an interim release while we fix the pressure sensors.

Added the MFCVAL? query to get the Mass Flow Controller (MFC) setting contribution required for a piglet.

Bypass valves for enabled channels now get set to zero.

Added the IDENTIFY command to kick off the channel identification process.

Added the IDSTATE? query to get the channel identification substate. The OPSTATE? query will return the identify parent state ID during channel identification.

Added the ACTIVECH? query to return the active channels discovered during channel identification.

Version 1.1.4

Version 1.1.6

Version 1.1.7

This version adds the LOGLEV? query for the logger severity threshold. Log messages aren’t available over the command interface, but they still slow the system down. Deployed firmware applications should have this level set to error.

Version 1.1.8

This version adds the VER.TMP?, TZA.TMP?, and TZB.TMP? queries for temperatures on the Vernon (power distribution) board, Topaz A (manifold A) board, and Topaz B (manifold B) board. These commands query hardware sensors on the I2C bus, and thus can be used to detect problems with I2C communication over ribbon cables.

Version 1.1.9

This version adds the TZA.RST and TZB.RST commands. We tried and failed to use these commands to reset locked-up MPR pressure sensors.

This version also adds support for LEDs on the system board. The red LED will flash when the system experiences an error.

Version 1.1.10

This version adds the PRS.RATE? query for successful pressure sensor cycle read rate. This can be used for health monitoring.

Version 1.2.1

This version outputs an unsolicited identity string (output from *IDN?) after it boots. This lets me profile the boot time and make sure it stays below a 3s limit.

This version also adds automatic Topaz board resets after multiple pressure sensor read failures. This fixes some MPR pressure sensors that fail to reset at power-on.

Version 1.2.2

This version removes the automatic Topaz board resets caused by pressure sensor read failures. The system board’s multicolor LED will still flash red on read failures, but no attempt will be made to fix the bad sensor with a reset pulse. The PRS.RATE? command is available to monitor the successful read rate.

Added the PRS.IN.PAS? n and PRS.OUT.PAS? n commands for querying input and output pressure readings calibrated in Pascals.

Added the CHx.PRS.SLP n and CHx.PRS.OFF n commands (8 of them each) for setting input pressure sensor calibration coefficients.

Added the TZA.PRS.SLP n and TZB.PRS.SLP n commands for setting output pressure sensor slope calibration coefficients. Added the TZA.PRS.OFF n and TZB.PRS.OFF n commands for setting output pressure sensor offset calibration coefficients.

Added the IN.PRS.SLP? n and IN.PRS.OFF? n queries to get input channel pressure calibration coefficients saved in non-volatile memory.

Added the OUT.PRS.SLP? n and OUT.PRS.OFF? n queries to get output sensor pressure calibration coefficients saved in non-volatile memory.