Firmware for the LoFASM ACU Control Unit (ACU). Depends on CmdMessenger and Streaming libraries.
Communications is accomplished over serial via the CmdMessenger Library.
A read command is sent to the ACU over serial in the following format:
XX[,Y];
Where XX
is the specific task to exectute (See the COMMANDS section), and Y
is only required for tasks that pertain to multiple devices, such as FEEs and
Attenuators. The separating comma is only required when the device requires the
Y
specifier.
A write command is sent to the ACU over serial in the following format:
XX,AA; or XX,Z|AA;
Where, again, XX
is the specific task to execute, and AA
is the value to
assign to the device. As above, when a task pertaions to multiple devices, such
as the FEEs and Attenuators, the device specifier Z
is used, and a vertical
pipe ( |
) is used to separate the device specifier from the value argument
(AA
).
Note: All device specifiers are zero-indexed.
All commands will generate responses similar to the following format:
R,STRING;
Where R
is the response code and STRING
is a response message.
There are four response codes:
+------+--------------+ | Code | Meaning | +======+==============+ | 0 | Comm Error | +------+--------------+ | 1 | Acknowledged | +------+--------------+ | 2 | Ready | +------+--------------+ | 3 | Error | +------+--------------+
The Comm Error (or CER
) code means that something has gone wrong with the
serial communications between the ACU and the PC, most likely at the hardware
level. The Acknowledged (or ACK
) code means the command was executed
properly. The Ready (or RDY
) code means that the ACU is ready to recieve
commands, and is a special response to the ACU READY
command. The Error (or
ERR
) code meand that the command was not able to execute.
For Read commands the response message will be the information requested (i.e.
the FEE state queried by the FEE Read command) and will carry an ACK
response
code. For Write messages, this is usually a confirmation that the state was
changed and will also carry an ACK
response code.
Error response can be generated by an improperly formatted command, by serial
communication glitches causing mistransmissions, or by a hardware failure
preventing the ACU from setting its state properly. The response message for
Error responses are generally indicative of the failure, and of course carry an
ERR
response code.
+------+--------------+ | Code | Task | +======+==============+ | 4 | ACU READY | +------+--------------+ | 5 | FEE Read | +------+--------------+ | 6 | FEE Write | +------+--------------+ | 7 | Filter Read | +------+--------------+ | 8 | Filter Write | +------+--------------+ | 9 | Atten Read | +------+--------------+ | 10 | Atten Write | +------+--------------+ | 11 | EEPROM Read | +------+--------------+ | 12 | EEPROM Write | +------+--------------+ | 13 | Flash Write | +------+--------------+
ARGUMENTS: None
EXAMPLE: 4;
The ACU Ready (4
) command queries the ACU for a RDY
response. This serves
as a basic check of the communication system and verifies that the ACU is in a
working state and available to take commands.
ARGUMENTS: Channel (0-3)
EXAMPLE: 5,1;
The FEE Read (5
) command queries the ACU for the state of the specified FEE.
It returns a 1
for on and a 0
for off.
ARGUMENTS: Channel (0-3), State (0,1)
EXAMPLE: 6,0|1;
The FEE Write (6
) command sets the state of the specified FEE. It takes an
argument of 1
or 0
for on and off respectively, separated from the channel
specifier by a vertical pipe (|
).
ARGUMENTS: None
EXAMPLE: 7;
The Filter Read (7
) command queries the ACU for the filter state. It returns
0
,1
, or 2
depending on which filter is selected. For information on which
state corresponds to which filter, please consult the [ARX Hardware Memo][ARX
Memo].
ARGUMENTS: Filter State (0-2)
EXAMPLE: 8,2;
The Filter Write (8
) command sets the filter state. It takes an argument of
0
, 1
, or 2
depending on which filter you choose. For information on which
state corresponds to which filter, please consult the [ARX Hardware Memo][ARX
Memo].
ARGUMENTS: Attenuator (0,1)
EXAMPLE: 9,1;
The Atten Read (9
) command queries the ACU for the state of the specified
Attenuator. This command takes a device specifier which corresponds to one of
the two attenuators on board. It returns the attenuation level (0-15). Please
note that this is not the attenuation in dB, which can be calculated by
multiplying the attenuation level by 2 (i.e. an attenuation level of 7
corresponds to a 14dB attenuation).
ARGUMENTS: Attenuator (0,1), Attenuation Level (0-15)
EXAMPLE: 10,1|7;
The Atten Write (10
) command sets the state of the specified Attenuator. This
command takes a device specifier argument, which corresponds to one of the two
attenuators on board, and an attenuation level argument (0-15). Please note
that this is not the attenuation in dB, which can be calculated by multiplying
the attenuation level by 2 (i.e. an attenuation level of 7 corresponds to a 14dB
attenuation).
ARGUMENTS: None
EXAMPLE: 13;
The Flash Write (13
) command writes the current ACU state to EEPROM. It writes
the state to the area of EEPROM as specified by the EPROM Read command. For
information on the size of the written package and the number of positions
available, please consult the [ARX Control Interface Memo][ARX_C_I]
These commands will be implemented in the future, and are not currently functional.
ARGUMENTS: None
EXAMPLE: 11;
The EEPROM Read (11
) command queries the ACU for the current EEPROM offset at
which the configuration state is stored.
ARGUMENTS: Position Offset
EXAMPLE: 12,4;
The EEPROM Write (12
) command sets the current EEPROM offset at which the
configuration state is stored. This is used to shift the location at which
configuration is stored to prevent failure of the underlying EEPROM.