![]() |
CROSS Technical Documentation User Manual and Technical Doc.
INFN Milano Bicocca
|
SUMMARY:
The protocol of communication is the CAN bus that consists of groups of 8 transmission/reception bytes, a number of other bits are for diagnostic. The instruction code and data to send/receive are organized to exploit the 8 bytes, as explained in the next subsection.
Every board is identified by its own 29-bits adrress, or filter in CAN slang. Part of the adrress is from a 8-bits switches present on the board, while other bits are for experiment identification. The board on whcih the CAN bus arrives and has the µ-controller is the postfrontend board, that connects to 2 frontend boards.
The instructions are defined through the enum instructions. The bullet list and the bullet numbers at the Instruction Option
are the instruction identification codes. These codes are the MSB of the CAN messages. As an instance, if you wish to send the instruction instr_Vbias_to_be_set you should use for it the code 4.
Some instructions need some parameters for the esecution, other instructions do not need further details. As an instance, the first instruction, instr_NO_operation, does not need additional information, but instr_ADC_LETTURA needs the indication of which node to measure. For every instruction there is a short explanation about the input and output data bytes in a dedicated sub-section linked to the list itself.
The shape of the CAN bus input/output message is according to the Table a and Table b below.
Table a is the prototype for the CAN bus instruction message sent to the board. There are several options that could be embedded in the 8 bytes that are not exploited by all the functions. Byte7 is the only byte always needed: it represents the code that identifies the instrucion. Then, sometimes, Byte6 says to which channel, among the 6 on the mainboard, the instruction has to be applied, in case the function itself is not generic. The MSB bit of Byte6 identifies which of the 2 boards is managed at the moment, while bit_6 of Byte6 is often exploited for other purposes. The options from Byte2 to Byte5 are other possible paramaters for the instruction. As an instance when a node voltage has to be measured Byte6 is the node to be measured.
Finally, from Byte0 to Byte3 are the data to be transmitted, if needed. As an instance, for offset adjustement these 2 bytes indicate the target offset voltage in mV.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 |
---|---|---|---|---|---|---|---|
Input data Byte_0 | Input data Byte_1 | Instruction option Byte_0 | Instruction option Byte_1 | Instruction option Byte_2 | Instruction option Byte_3 | selected channels or nodes | Instruction code |
Table b is the CAN message received from the board, after that the instruction has been executed. In several respects it is a replica of the transmitted command. It differs in the first 4 data bytes. As an instance, when an ADC node is asked to be read these 4 bytes are the measured node voltage in µV.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 |
---|---|---|---|---|---|---|---|
Output data Byte_0 | Output data Byte_1 | Output data Byte_2 or Instruction option Byte_0 | Output data Byte_3 or Instruction option Byte_1 | Instruction option Byte_2 | Instruction option Byte_3 | selected channels or nodes | Instruction code |
Several instructions can be applied to several channels of the same board. This is indicated in Byte6 . The first 6 bits of Byte_6 identify the 6 channels, while bit_7 identifies the board, up or down. An easy way to set the channles is using the OR-ing of the following definitions:
An example of setting of Byte_6, ie channel3 and channel5 of upper board, is as follows:
In the following, very often, tables Table a and Table b are merged toghether and first row is the input iinstruction command while the second row is the µ-controller answer.
There are several instructions that spread over several bytes of the CAN message. Below it is explained the way the CAN messages are interpreted.
List of Instructions. Click on the links:
This is the simpler instruction: no operation. The answer is the fw revision in the first 4 bytes of the CAN bus answered message. The FW is simply the date of the FW expressed in YYYYMMDD (see also FW release construction). Table_instr_NO_operation is the I/O prototype.
The main purpose of this instruction is to test the communication with the board and to verify its address. When invoked it first try to use the CAN bus address that should be that of the board. If it does not work, then it reads the address from the EPROM on the post-mainboard using the generic CAN bus address, indirizzo_generico_CAN.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | |
---|---|---|---|---|---|---|---|---|
input instr | x | x | x | x | x | x | x | see the bullet at instr_NO_operation |
output ans | FW0 | FW1 | FW2 | FW3 | 0 | 0 | 0 | 0 |
Power down for μ-controller is set ON or OFF or chcked according to Byte6 of Table_Shut_Down_ON_OFF below.
The same is applied for ADCs on board, see Table_Shut_Down_ON_OFF again.
Note that this setting is stored in the post-frontend EPROM and applied at the startup.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | |
---|---|---|---|---|---|---|---|---|
input instr | Shut down waiting time, see note below | x | x | x | x | if 1=ADCs power down is set ON, dummy resistors are also ON, power unchanged; if 0=ADCs power down is set OFF; if 2=ADCs power down is set ON, dummy resistors are OFF, power is reduced; if >2 = the state of the ADCs power down OFF/ON is returned. | if 1=μ-controller power down is set ON; if 0=μ-controller power down is set OFF; if >1 = the state of the μ-controller power down OFF/ON is returned. | see the bullet at In..Shut.. |
output ans | The actual wait time in sec | 0 | 0 | 0 | 0 | 1 if ADCs power down was set ON, 0 if ADCs power down was set off | 1 if μ-controller power down was set ON, 0 if μ-controller power down was set off | see the bullet at In..Shut.. |
Byte0: This number is the time, expressed in seconds, from the last command executed and the start of the shut down of the μ-controller. If this number is 0 or greater than 60 the default of 5 seconds is adopted. This time is stored in memory and applied at board startup.
With this instruction the board can be re-initialized. This is useful in case a failure of the supply voltage, or the supply voltages have been slow in their settings.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | |
---|---|---|---|---|---|---|---|---|
input instr | 0 | 0 | 0 | 0 | 0 | 0 | 0: the reset regards only the fw; 1: the reset is hw, i.e. from the scratch, and fw. See note below. | see the bullet at ins...inizia... |
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | see the bullet at ins...inizia... |
Byte6: In case a hw + sw reset is done there is no response to the command on CAN bus. Send a new CAN bus command after a while to get a replay.
The amount of the detector bias we would like to set is given here. The value can be applied to more than one channel or to a single channel depending of the setting of Byte6 of the Table below.
The voltage is in mV according to: Byte0 + (Byte1 <<8), or Byte0 + 28⋅Byte1. The voltages are stored in the vector Detector_bias_target[], this time in µV, which can be readout at instr_readback_variables.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | |
---|---|---|---|---|---|---|---|---|
input instr | Byte0: LSB of the bias to set in mV | Byte1: MSB of the bias to set in mV | x | x | x | x | The channels this bias is to be applied, and the bit for board selection, see ex. below | see the bullet at ins..det..bias |
output ans | 0 | 0 | 0 | 0 | 0 | 0 | Byte6 above | see the bullet at ins..det..bias |
Byte6 of Table_instr_detector_Vbias_we_want_to_set above.
Setting Ch0=1, Ch1=2, Ch2=4, Ch3=8, Ch4=16 Ch5=32, then the channels to which the voltage is applied are the sum, or ORed, of the settings just considered.
Bit7: 1 » : the upper board is considered, set it board_up=1<<7; 0 » : the lower board is considered.
Example: if we want the same voltage at channel 2, 3 and 5, of the upper board, Byte6 must be: Ch2+Ch3+Ch5+board_up.
For this instruction to work, the detector target bias must have been previously set with the instruction
instr_detector_Vbias_we_want_to_set, for the channels for which you want to set the new detector bias values. Operation is done according to
Table_instr_detector_Vbias_we_want_to_set_option, below.
Meanings of Byte3 to Byte6 are given after the Table.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | |
---|---|---|---|---|---|---|---|---|
input instr | x | x | Average # (≤200) of ADC node readings, a default of 1 is set if 0 is passed. | See list below | waiting time between settings in units of 100 ms (the minimum reccomended value is 10, as 200 ms is the low pass filtering time constant of the circuit) | Tolerance for the target in mV, see note below | The channels for which the bias must be set and the board selection bit, see below | see the bullet at ins..Vbias.. |
output ans | 0 | 0 | 0 | 0 | same as Byte4 above | The actual tolerance used, except in case of errors, see below. | a 1 for the channles found out of tolerance | see the bullet at ins..Vbias.. |
Byte5 on answer : In case of errors it is set to the value of 255, or 0xff if the corresponding instruction byte is different from 0xff, otherwise it is set to 250 or 0xfa.
Byte2: a node voltage is read this number of imes and averaged. This increase accuracy, but slow down the adjustmente proces. Each reading takes about 20 ms for single ended measurement, 50 ms for differential measurement.
Byte3 options:
Byte4: waiting time between test voltage settings. It is in units of 100 ms, that means that a value of 10 means 1000 ms, or 1 s. The limit of the bye is 255, or 25.5 s. If this byte is passed 0, then 1 s is set as default.
Byte5: In the input instruction: the wanted tolerance. In answer: the actual tolerance is repeated, that is the maximum between the user set and the default at minimum_error_detector_voltage.
Byte6 of Table_instr_detector_Vbias_we_want_to_set_option above:
Setting Ch0=1, Ch1=2, Ch2=4, Ch3=8, Ch4=16 Ch5=32, then the channels to whic the voltage is applied are the sum, or OR, of the settings just considered.
Bit7: 1 » : the upper board is considered, set it board_up=1<<7; 0 » : the lower board is considered.
Example: if we want the same voltage at channel 2, 3 and 5, the Byte6 must be: Ch2+Ch3+Ch5.
The connection and managing of the detector is made trhough 4 relais that can be set with this function. The relais are bistabile and 2 switches are needed to set either state. The Table below and the following highlight the syntax to use.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | |
---|---|---|---|---|---|---|---|---|
input instr | x | x | x | x | x | Relais to set, see below | channel whose relais are managed, and Board bit UP/Down. See example below | see the bullet at ins..Rel..SR.. |
output ans | 0 | 0 | 0 | 0 | 0 | Same as Byte5 above, except in case of errors, see below. | Byte6 above | see the bullet at ins..Rel..SR.. |
Byte5 on answer : In case of errors this byte is set to the value of 255, or 0xff, if the corresponding instruction byte is different from 0xff, otherwise it is set to 250 or 0xfa.
Byte5 of instruction:
Every bit of this Byte set an action if it is set to "1", while does nothing if "0". In the following, the meaninig of every bit is given.
ATTENTION: To set any bit to "1" Byte5 must be ORed with 2Bullet number below and only one bit can be set at a time:
Byte6 of Table_instr_Relays_driver_set_reset_channel :
Setting Ch0=1, Ch1=2, Ch2=4, Ch3=8, Ch4=16 and Ch5=32, then the channel from which the trimmer is read or written is the one settled;
Bit6: 1 » the trimmer is written, let's call it write_trimmer=1<<6, 0 » : the trimmer is read;
Bit7: 1 » : the upper board is considered, set it board_up=1<<7; 0 » : the lower board is considered.
Example: if we want the write in trimmer of channel 3, upper board, then Byte6 must be Ch3 | write_trimmer | board_up.
This function is a so called atomic function: it allows to read from or write to any of the trimmers of the detector bias. This is possible through Table_instr_detector_scrittura_lettura_trimmer_bias and the following list.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | |
---|---|---|---|---|---|---|---|---|
input instr | Value to write, range (0, 255) | x | x | x | x | Trimmer to write in or read from (0, 3) | channel whose trimmer is managed, R/W and Board UP/Down. See example below | see the bullet at Ins..Vb..we |
output ans | trimmer contents | 0 | 0 | 0 | 0 | Same as Byte5 above, except in case of errors, see below. | Byte6 above | see the bullet at Ins..Vb..we |
Byte5 on answer : In case of errors it is set to the value of 255, or 0xff if the corresponding instruction byte is different from 0xff, otherwise it is set to 250 or 0xfa.
Byte6 of Table_instr_detector_scrittura_lettura_trimmer_bias above:
Setting Ch0=1, Ch1=2, Ch2=4, Ch3=8, Ch4=16 and Ch5=32, then the channel from which the trimmer is read or written is the one settled. If more than one channel is selected, then the lower one is considered;
Bit6: 1 » the trimmer is written, let's call it write_trimmer=1<<6, 0 » : the trimmer is read;
Bit7: 1 » : the upper board is considered, set it board_up=1<<7; 0 » : the lower board is considered.
Example: if we want the write in trimmer of channel 3, upper board, then Byte6 must be Ch3 | write_trimmer | board_up.
The preamplifier gain can be set large, 210 V/V, or small, 22 V/V, according to the syntax below.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | |
---|---|---|---|---|---|---|---|---|
input instr | x | x | x | x | x | If 1 the gain is set large, if 0 the gain is set small | channel whose gain is to be set and the board bit according to the list below | see the bullet at Ins..gai..low.. |
output ans | 0 | 0 | 0 | 0 | 0 | Same as Byte5 above, except in case of errors, see below. | Byte6 above | see the bullet at Ins..gai..low.. |
Byte5 on answer : In case of errors it is set to the value of 255, or 0xff if the corresponding instruction byte is different from 0xff, otherwise it is set to 250 or 0xfa.
Byte6 of Table_instr_preamplifier_temperature_meas_option above:
Setting Ch0=1, Ch1=2, Ch2=4, Ch3=8, Ch4=16 and Ch5=32, then the channels to which the gain is set are those ORed, see example below;
Bit7: 1 » : the upper board is considered, set it board_up=1<<7; 0 » : the lower board is considered.
Example: If we want to set the gain of channel 1, channle 3 and channel 5 of the upper board, then Byte6 must be Ch1 | Ch3 | Ch5 | board_up.
The preamplifier temeperature, in μ°C, can be read by this function according to the syntax below.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | |
---|---|---|---|---|---|---|---|---|
input instr | x | x | x | x | x | x | channel whose temperature is read and the board according to the list below | see the bullet at Ins..temp... |
output ans | Byte0 read | Byte1 read | Byte2 read | Byte3 read | 0 | Same as Byte5 above, except in case of errors, see below. | Byte6 above | see the bullet at Ins..temp... |
Byte5 on answer : In case of errors it is set to the value of 255, or 0xff if the corresponding instruction byte is different from 0xff, otherwise it is set to 250 or 0xfa.
Byte6 of Table_instr_preamplifier_temperature_meas_option above:
Setting Ch0=1, Ch1=2, Ch2=4, Ch3=8, Ch4=16 and Ch5=32, then the channel from which the temperature is read is the one settled;
Bit7: 1 » : the upper board is considered, set it board_up=1<<7; 0 » : the lower board is considered.
Example: If we want to read the temperature of channel 3, upper board, then Byte6 must be Ch3 | board_up.
The temperature is given by: T= (Byte0+ Byte1*28+Byte2*216+Byte3*224)×10-6 °C.
The memory of any preamplifier can be R/W according to the Table below. Byte4 and Byte5 are the starting address of the memory where data must be read or written. The memory is organized as unsigned int and the first 2 bit of address must be 0. The first 4 bytes of the instruction and replay are the content of the 4 memory locations. The first 4 bytes of the command do not care in case of reading. The channel for which the memory is selected, the R/W bit and the selected board bit are at Byte6 according to the syntax below the Table.
Every used memory cell of the preamplifier EPROM is listed here preamplifier_memory_location_list. Memroy locations beyond the last address are free.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | |
---|---|---|---|---|---|---|---|---|
input instr | Byte0 to store | Byte1 to store | Byte2 to store | Byte3 to store | LSB Memory start address | MSB Memory start address | channel to select, R/W bit and selected board bit according to the list below | see the bullet at Ins..mem.. |
output ans | Read Byte0 | Read Byte1 | Read Byte2 | Read Byte3 | Byte4 above | Same as Byte5 above, except in case of errors, see below. | Byte6 above | see the bullet at Ins..mem.. |
Byte5 on answer : In case of errors it is set to the value of 255, or 0xff if the corresponding instruction byte is different from 0xff, otherwise it is set to 250 or 0xfa.
Byte6 of Table_instr_preamplifier_memory_option above:
Setting Ch0=1, Ch1=2, Ch2=4, Ch3=8, Ch4=16 and Ch5=32, then the channel from which the memory is managed is the one settled;
Bit6: 1 » : the memory is written with the 4 bytes at Byte0 to Byte3; 0 » : the memory is only read;
Bit7: 1 » : the upper board is considered, set board_up=1<<7 to apply this; 0 » : the lower board is considered.
The output target offset for every channel we want to set. Take care: this is the value we want to set. To apply this value to the channel the instruction instr_output_offset_to_be_set_option must be launched. Table below shows how to proceed. Byte0 and Byte1 are the value of the offset to set, in mV. The channels to which the offset is defined are at Byte6 according to the syntax below the Table. The same offset value can be applied to different channles at a time. This function is necessary before the offset is applied to the channels and need to be launched for every different value needed.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | |
---|---|---|---|---|---|---|---|---|
input instr | Byte0: LSB of the bias to set in mV | Byte1: MSB of the bias to set in mV | X | X | X | X | The channels this offset is to be set, and the bit for board selection, see ex. below | see the bullet at Ins..off..we |
output ans | 0 | 0 | 0 | 0 | 0 | 0 | Byte6 above | see the bullet at Ins..off..we |
Byte6 of Table_instr_ouput_offset_we_want_to_set_option above:
Setting Ch0=1, Ch1=2, Ch2=4, Ch3=8, Ch4=16 and Ch5=32, then the channel to which the target offset is defined are the OR of the settings above, exmaple Ch1 | Ch5 ;
Bit7: 1 » : the upper board is considered, set board_up=1<<7 to apply this; 0 » : the lower board is considered.
The target offset, in mV is evaluated according to: Byte0 + Byte1 << 8, or Byte0 + 28 Byte1.
The output offset, whose target was stored at instr_ouput_offset_we_want_to_set, can be adjusted at the PGA outputs of the selected channels. A few parameters can be set according to the Table and instructions below.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | |
---|---|---|---|---|---|---|---|---|
input instr | x | x | Average # (≤200) of ADC node readings, see below | See list below for available options | Waiting time between settings in units of 100 ms | Tolerance for the target offset in mV | The channels this offset is to be set, and the bit for board selection, see ex. below | see the bullet at Ins..offs..set |
output ans | 0 | 0 | 0 | 0 | Same as Byte4 above | Same as Byte5 above, except in case of errors, see below. | A "1" for the channles found out of tolrence | See the bullet at Ins..offs..set |
Byte5 on answer : In case of errors it is set to the value of 255, or 0xff if the corresponding instruction byte is different from 0xff, otherwise it is set to 250 or 0xfa.
Byte2 : a node voltage is read this number of times and averaged. This increase accuracy, but it slows down the adjustmente process. If the value passed is 0 the default of 1 is applied. Each reading takes about 10 ms.
Byte3 options:
Byte4: waiting time between each setting. It is in units of 100 ms, that means that a value of 10 means 1000 ms, or 1 s. The limit of the bye is 255, or 25.5 s. If this byte is passed 0, then 1 s is set as default.
Byte5: final maximum error in mV from the target voltage.
Byte6 of Table_instr_detector_Vbias_we_want_to_set_option above:
Setting Ch0=1, Ch1=2, Ch2=4, Ch3=8, Ch4=16 Ch5=32, then the channels to which the voltage is applied are the sum, or OR, of the settings just considered.
Bit7: 1 » : the upper board is considered, set it board_up=1<<7; 0 » : the lower board is considered.
Example: if we want the same voltage at channel 2, 3 and 5, the Byte6 must be: Ch2+Ch3+Ch5.
This function is a so called atomic function: it allows to read from or write to any of the trimmers of the detector bias. This is possible through Table_instr_preamplifier_scrittura_lettura_trimmer_offset and the following list.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | |
---|---|---|---|---|---|---|---|---|
input instr | Value to write, in case of write (0, 255) | x | x | x | x | Trimmer to write in or read from (0, 3) | channel whose trimmer is managed, R/W and Board UP/Down. Ssee ex. below | see the bullet at Ins..R/W..trim.. |
output ans | trimmer contents | 0 | 0 | 0 | 0 | Same as Byte5 above, except in case of errors, see below. | Byte6 above | see the bullet at Ins..R/W..trim.. |
Byte5 on answer : In case of errors it is set to the value of 255, or 0xff if the corresponding instruction byte is different from 0xff, otherwise it is set to 250 or 0xfa.
Byte6 of Table_instr_preamplifier_scrittura_lettura_trimmer_offset above:
Setting Ch0=1, Ch1=2, Ch2=4, Ch3=8, Ch4=16 and Ch5=32, then the channel from which the trimmer is read or written is the one settled. If more than one channel is selected, then the lower one is considered;
Bit6: 1 » the trimmer is written, let's call it write_trimmer=1<<6, 0 » : the trimmer is read;
Bit7: 1 » : the upper board is considered, set it board_up=1<<7; 0 » : the lower board is considered.
Example: if we want the write in trimmer of channel 3, upper board, then Byte6 must be Ch3 | write_trimmer | board_up.
See Table Table_instr_PGA_gain_set.
The applied gain is at Byte0. It must be between 1 V/V and 100 V/V. The same gain can be applied to channels indicated at Byte6, see below.
In the answers at Byte0 the actual applied gain is given, that can be differ slightly due to approximation to the nearest integer.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | |
---|---|---|---|---|---|---|---|---|
input instr | 1 ≤ Gain ≤ 100 | x | Average # (≤200) of ADC node readings, if Byte5 is 1 (*) | Waiting time between settings in units of 100 ms, if Byte5 is 1 (*) | Tolerance for the target offset in mV if Byte5 is 1 (*) | if 1 the offset, for the selected channels, is maintened the actual after that the gain is changed. | The channels to which the gain is applied and the board bit selction | see the bullet at Ins..gain_set.. |
output ans | Actual Gain set | 0 | 0 | 0 | 0 | Same as Byte5 above, except in case of errors, see below. | same as Byte6 above | see the bullet at Ins..gain_set.. |
(*) If this parameter is passed 0, when byte5 is 1, the default is adopted.
Byte5 on answer : In case of errors it is set to the value of 255, or 0xff if the corresponding instruction byte is different from 0xff, otherwise it is set to 250 or 0xfa.
Byte6 of Table_instr_PGA_gain_set above:
Setting Ch0=1, Ch1=2, Ch2=4, Ch3=8, Ch4=16 and Ch5=32, then the channels to which the new gain is set are those ORed, see example below;
Bit5: 1 » : the gain is changed to the new value and the offset is set at the value at Byte1 and Byte2 expressed in mV.
Bit7: 1 » : the upper board is considered, set it board_up=1<<7; 0 » : the lower board is considered.
Exmaple: if the gain is being applied to channles 2, 3 and 5 of upper board, then Bit6 should be: Ch2 | Ch3 | Ch5 | (1<<7).
This is an atomic function that users could not use. It allows to set the gain of the unput stage of the two stages PGA. The gain of this stage is set by means of a relay and can take the 2 values of 1 V/V and 10 V/V.
The larger gain is set settin "1" at Byte4.
The same gain can be applied to the channels listed at Byte6, see below.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | |
---|---|---|---|---|---|---|---|---|
input instr | x | x | x | x | If 1 the gain is set high | x | The channels to which the gain is applied and the board bit selection | see the bullet at Ins..S/R..gain.. |
output ans | 0 | 0 | 0 | 0 | same as Byte4 above | e. It allows to set the gain of the second stage of Same as Byte5 above, except in case of errors, see below. | same as Byte6 above | see the bullet at Ins..S/R..gain.. |
Byte5 on answer : In case of errors it is set to the value of 255, or 0xff if the corresponding instruction byte is different from 0xff, otherwise it is set to 250 or 0xfa.
Byte6 of Table_instr_PGA_set_reset_pre_PGA_gain above:
Setting Ch0=1, Ch1=2, Ch2=4, Ch3=8, Ch4=16 and Ch5=32, then the channels to which the new gain is set are those ORed, see example below;
Bit7: 1 » : the upper board is considered, set it board_up=1<<7; 0 » : the lower board is considered.
Exmaple: if the gain is being applied to channles 2, 3 and 5 of upper board, then Bit6 should be: Ch2 | Ch3 | Ch5 | board_up.
This is an atomic function that users could not use. It allows to set the gain of the second stage of the two stages PGA. The gain of this stage is set by means of a DAC in feedback to an OA.
The gain is set setting the value at Byte4, a number between 1 and 100.
The same gain can be applied to the channels indicated at Byte6, see below.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | |
---|---|---|---|---|---|---|---|---|
input instr | x | x | x | x | The gain to set | x | The channels to which the gain is applied and the board bit selection | see the bullet at Ins..DAC..gai.. |
output ans | 0 | 0 | 0 | 0 | same as Byte4 above | Same as Byte5 above, except in case of errors, see below. | same as Byte6 above | see the bullet at Ins..DAC..gai.. |
Byte5 on answer : In case of errors it is set to the value of 255, or 0xff if the corresponding instruction byte is different from 0xff, otherwise it is set to 250 or 0xfa.
Byte6 of Table_instr_PGA_DAC_GAIN_CROSS above:
Setting Ch0=1, Ch1=2, Ch2=4, Ch3=8, Ch4=16 and Ch5=32, then the channels to which the new gain is set are those ORed, see example below;
Bit7: 1 » : the upper board is considered, set it board_up=1<<7; 0 » : the lower board is considered.
Exmaple: if the gain is being applied to channles 2, 3 and 5 of upper board, then Bit6 should be: Ch2 | Ch3 | Ch5 | board_up.
The occurrence of any error can be inspected here. A few actions are possible according to the options of the Table_instr_ERROR_echo_on_off below.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | |
---|---|---|---|---|---|---|---|---|
input instr | If Inst2: the address of the queried error register | x | x | x | x | x | See "Note to Byte6" below. Inst1: It is asked if there are errors; Inst2: it is asked to send back the content of the register indicated at Byte0 Inst3: reset all errors Inst4: echo status is returned at Byte0 | see the bullet at Ins..Err..ins.. |
output ans | If Inst1: Address of the last error register; if Inst2: Byte0 of the selected error register; if Inst4: 1 if Echo is ON, 0 if Echo is off | if Inst1: the number of errors; if Inst2: Byte1 of the selected error register | if Inst2: Byte2 of the selected error register | if Inst2: Byte3 of the selected error register | 0 | if Inst2: The address of the selected error regsiter | Same as Byte6 above | see the bullet at Ins..Err..ins.. |
Note to Byte6 of Instruction: Inst1,…, Inst4=1,…,4: these are the reference code that set the choices for all the bytes of the instruction and output that refer it.
The error registers are at List of error resisters, while the meaning of the flags contained in the registers is at Errors flags .
Error occurence can be notified via CAN bus as soon as it happens. Here this option can be set ON or OFF when the command is sent from the control room. If Echo is ON and a verification of error happens the μ-controller send back the notification to the CAN via row 3 of Table_instr_ERROR_echo_on_off below.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | |
---|---|---|---|---|---|---|---|---|
input instr | 1=set echo ON; 0=set echo off | x | x | x | x | x | x | see the bullet at instr_ERROR_echo_on_off |
output ans | If Echo is ON → 1; If Echo is OFF → 0 | 0 | 0 | 0 | 0 | 0 | 0 | See the bullet at Ins..Er..Ech.. |
From the CAN at error verification, Echo ON case | Byte0 of error register | Byte1 of error register | Byte2 of error register | Byte3 of error register | 0 | Error Register address | 1 (this marks there is an error echoed) | See the bullet at Ins..Er..Ech.. |
The instruction instr_ADC_LETTURA needs to specify the node to be read. There are 32 possible different nodes connectible to the ADC. In the present version of the hw not all the 32 are used. The list of the usable nodes and the code to be used at byte MSB-1 of the CAN message are listed at user_use_of_ADC. This happens if Byte5 of the instruction is 0. When Byte5 is 1 the μ-controller sets up the node to be read, but the ADC used is not that on board and the last 2 rows of TableInstr_instr_ADC_LETTURA applies. This operation is for developer only and its details are given below the table.
I/O instruction is at table TableInstr_instr_ADC_LETTURA. The result of the measurement is found at the 4 LSB.
The result is in µV: Meas0 + (Meas1 <<8) + (Meas2 <<16) + (Meas3 <<24), or Meas0 + 28⋅Meas1 + 216⋅Meas2 + 224⋅Meas3.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | |
---|---|---|---|---|---|---|---|---|
input instr | x | x | x | 0=ADC offset is measured and discharged; 1=ADC offset is not measured; | Average # (<200) of ADC node readings, see below | bit_0: 1= read from external ADC bit_0: 0= read from on board ADC, bit_1: 0= read single ended PGA/PreOut/detector bias bit_1: 1= read differential PGA/PreOut/detector bias see note below | see the list below at Byte6 for node to read. To select board up "or" the Byte with 0x80 | see the bullet at Ins..ADC..let.. |
output ans | Meas0 (differential PGA/PreOut) Meas0 (positive PGA/PreOut) | Meas1 (differential PGA/PreOut) Meas1 (positive PGA/PreOut) | Meas2(differential PGA/PreOut) Meas0 (negative PGA/PreOut) | Meas3 (differential PGA/PreOut) Meas1 (negative PGA/PreOut) | 0 | Same as Byte5 above, except in case of errors, see below. | see the list below Byte6 | see the bullet at Ins..ADC..let.. |
output ans with ext ADC from micro | 0 | 0 | 0 | 0 | 0 | The node to measure | 1 (that means the node to measure must come from the CAN) | see the bullet at Ins..ADC..let.. |
answer to micro | Meas0 from CAN | Meas1 from CAN | Meas2 from CAN | Meas3 from CAN | 0 | The node measured | 0 (that means the node is coming from the CAN) | see the bullet at Ins..ADC..let.. |
Byte5 on answer : In case of errors it is set to the value of 255, or 0xff if the corresponding instruction byte is different from 0xff, otherwise it is set to 250 or 0xfa.
Byte2: a node voltage is read the number of times the content of this byte and averaged. This increase accuracy, but slow down the adjustmente process. Each reading takes about 10 ms.
Byte5: Bit_0: this option will be obsolote after installation. Set it as "0". Bit_1: if 1 2 readings are given for positive and negative ouputs in case of PGa and PreOut. The values are in mV in this case and Byte0 and Byte1 of answer is for positive output while Byte2 and Byte3 is for the negative ouput. Bit_1: if 0 the differential ouput is answered in µV from Byte0 to Byte3.
Byte5 Bit_0 is set to 1 by developer. When this is applied the μ-controller sets up the node to read, then it sends bak to the CAN the third row of TableInstr_instr_ADC_LETTURA. The control room then measures the node with an external ADC such as a multimeter, then sends the result back to the μ-controller according to the last row of TableInstr_instr_ADC_LETTURA. If Bit_0 is 0 the node is read from the on-board ADC.
If Bit_1 is 0 the node is read single ended, while if Bit_1 is 1 the node is read differential.
Byte6: The list of the available node voltage to measure is listed in the 2 Tables below. Take note of the node number on the left of each definition. Discrimination between the upper and lower boards is made with bit 7. The names of the nodes is the same for the 2 boards, what changes is only bit 7.
At the moment, there is an alternative way to select and PGA channels from 0 to 5 are considered on the board down while PGA channels from 6 to 11 are considered on the board up.
The same is for the preamplifier outputs, except the fact that they start to be counted from 12.
PGA and Preamplifier outputs and Power Supplies nodes have direct individual connections to the output connector of mainboard A. The number to use are the bullets for both board up and down for channels in the same position.
PGA output | Pream outputs | Power Supplies | ||
---|---|---|---|---|
node_voltage_PGA_offset: offset for the first set of nodes (for developers only). | node_voltage_PreOut_offset: offset for the first set of nodes (for developers only). | node_voltage_PowSupp_offset: offset for the first set of nodes (for developers only). | ||
|
The analog Multiplexers have connected the following nodes. The number to use are the bullets for both board up and down for channels in the same position.
Mux 0 | Mux 1 |
---|---|
node_voltage_Analog_Mux_0_offset: starting offset for Mux 0 (for developers only).
| node_voltage_Analog_Mux_1_offset: starting offset for Mux 1 (for developers only).
|
There are additional nodes that can be selected that are usefull to the developers only:
Additional selectable nodes, for developers |
---|
|
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | |
---|---|---|---|---|---|---|---|---|
input instr | x | x | x | x | x | variable to read according to the list below | channel from which the variable is read | see the bullet at Ins..readback.. |
output ans | variable value | 0 | 0 | 0 | 0 | Byte5 | Byte6 above | see the bullet at Ins..readback.. |
Byte5: List of the possible variables to be read, the bullet number is the code to use at this byte:
Byte6 of Table_instr_readback_variables above:
Setting Ch0=1, Ch1=2, Ch2=4, Ch3=8, Ch4=16 and Ch5=32, then the channels to read from is the one selcted;
Bit7: 1 » : the upper board is considered, set board_up=10^7; 0 » : the lower board is considered.
Exmaple: if we need to read from channel 5, upper board, then Bit6 should be: Ch5 | board_up.
Node voltages can be read from an external ADC and sent to the µ-controller for comparison, internal use and the like. Take care that this function works only if a multiplexed multimeter is available or the DAQ is connected and either the multimeter or the DAQ must respond to the sw.
This is a non conventional function since the µ-controller asks for the measurement of some nodes: it is a bi-directional function. Byte6 is "0" when the communication is from the external ADC, that communicates to have read the node at Byte5. The result, in mV, is at Byte0 and Byte1: the µ-controller will read it. When Byte6 is "1" is the µ-controller that asks to the external ADC to take the measurement of node at Byte5.
The instruction works if the ADC is connected to the ouput connector of the mainboard A, in parallel to mainboard B.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | |
---|---|---|---|---|---|---|---|---|
input instr | LSB of the node measured (mV), if Byte6=0 | MSB of the node measured (mV), if Byte6=0 | x | x | 1= selected node is from board up; 0= selected node is from board down | Readable nodes are at Node list. | 0: the voltage is from the ouside, 1: the node voltage is required from the µ-controller | see the bullet at Ins..read_nod.. |
output ans | 0 | 0 | 0 | 0 | 0 | Node voltage to be measured | "1" | see the bullet at Ins..read_nod.. |
Every time the fine or the coarse trimmers for offset adjustment are varied by one or more steps, the output voltage changes by a proper amount. This amount is known by design but, due to accuracy limits, it can be slisgltly different from channel to channel. In addition, it could be totally wrong if fails are present. With this function the calibration values are determined and stored in the EPROM. These calibration values are feedbacked in response to the instruction once evaluated so that it is possible to verify their accuarcy.
The first 2 bytes passed with the instruction, in input, are the integer slope expected for fine trimmer, the following 2 bytes are those for coarse trimmer. The conversion value for the fine slope is 1 V to 106 µV, while that for coarse slope is 1 V to 105 (*10)µV
In output the 2 couples of bytes are the measured values. If the results differ from the input by more than about 15% a "0" is set in the output Byte5 in the corresponding position and the input value is stored in the EPROM.
The slope can be measured for both fine and coarse, fine only or coarse only. In case the either of the fine or coarse slopes are determined the other is returned as 0.
It is suggested to disconnect the detector during this operation.
The value to output at the lower PGA gain for CROSS, for the lower series noise version of the preamplifier, are 1.97 mV/step for fine slope and 242,6 mV/step for coarse slope.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | |
---|---|---|---|---|---|---|---|---|
input instr | LSB fine target | MSB fine target | LSB coarse target | MSB coarse target | 1=node voltages read from external ADC 0=node voltage read from on board ADC; Bit2 to bit7: ADC number of averaged measurements in case of internal ADC (max 127 averages) | 01=fine, 10=coarse, 11=both | The channels to which the gain is applied and the board bit selection, see below. | see the bullet at instr_offset_trimmer_calibration |
output ans | LSB fine calibration result, if asked | MSB fine calibration result, if asked coarse | LSB coarse calibration result, if askedd | MSB coarse calibration result, if askedd | 0 | The replay of Byte5 above for positive results, 4= starting voltage outside limits, 0=slope outside tolerance, the default is used. | same as Byte6 above | see the bullet at Ins..off..tri.. |
Byte6 of Ins..off..tri..:
Setting Ch0=1, Ch1=2, Ch2=4, Ch3=8, Ch4=16 and Ch5=32, then the channel to which the calibration is done is that having the lower value among the ORed, see example below;
Bit7: 1 » : the upper board is considered, set it board_up=1<<7; 0 » : the lower board is considered.
Example: if the calibration is being applied to channle 3 of upper board, then Bit6 should be: Ch3 | x | x | board_up, where x must be > Ch3. The suggestion is to set to "1" only the bit of the channel to calibrate.
In costruzione inizio
Every time the fine or the coarse trimmers for detector bias are varied by one or more steps, the detector bias changes by a proper amount. This amount is known by design but, due to expected spread of load resistors, it can be slisgltly different from channel to channel. In addition, it could be totally wrong if fails are present. With this function the calibration values are determined and stored in the EPROM. These calibration values are feedbacked in response to the instruction once evaluated so that it is possible to verify their accuarcy.
The first 4 bytes passed with the instruction, in input, are the integer slope expected for both positive and negative trimmer: they are expected similar. The conversion value for the fine slope is 1 V to 106 µV.
In output the first 2 couples of bytes are the measured values. Byte5 is the multiplication conversion number to convert the 2 byte in µV. If the results differ from the input by more than about 15% a "0" is set in the output Byte5 in the corresponding position and the nominal value value is stored in the EPROM.
Since it is exepcted a tolerance of about 10% in the absolute values of the load resistors and their refernces, the slopes are misured for the positive and negative bias and are stored in independent memory locations.
The slopes can be measured in pair for positive and negative fine and positive and negative coarse.
It is suggested to disconnect the detector during this operation.
The value to output at the lower PGA gain for CROSS, for the lower series noise version of the preamplifier, are 260.4 mV/step for fine slope and 2.96 mV/step for coarse slope.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | |
---|---|---|---|---|---|---|---|---|
input instr | LSB target byte, first target byte (*) | second target bute (*) | third target byte (*) | MSB target byte (*) | 1=node voltages read from external ADC 0=node voltage read from on board ADC; Bit2 to bit7: ADC number of averaged measurements in case of internal ADC (max 127 averages) | 01=fine, 10=coarse | The channels to which the gain is applied and the board bit selection, see below. | see the bullet at Ins..DetBi_cal.. |
output ans | LSB positive calibration result | MSB positive calibration result | LSB negative calibration result | MSB negative calibration result | Multiplication factor, 1 or 10, for each pair of bytes on the left to obatin the result in µV | The replay of Byte5 above for positive results, 3= positive slope outside limits, 4=negative slope outside limits. If 3 or 4 the default is stored but the switch memory is not upgraded. Except in case of errors, see below. | same as Byte6 above | see the bullet at Ins..DetBi_cal.. |
(*): If these 4 bytes are passed 0 then the tolerance about the measured slope is not performed.
Byte5 on answer : In case of errors it is set to the value of 255, or 0xff if the corresponding instruction byte is different from 0xff, otherwise it is set to 250 or 0xfa.
Byte6 of Table_instr_offset_trimmer_calibration:
Setting Ch0=1, Ch1=2, Ch2=4, Ch3=8, Ch4=16 and Ch5=32, then the channel to which the calibration is done is that having the lower value among the ORed, see example below;
Bit7: 1 » : the upper board is considered, set it board_up=1<<7; 0 » : the lower board is considered.
Example: if the calibration is being applied to channle 3 of upper board, then Bit6 should be: Ch3 | x | x | board_up, where x must be > Ch3. The suggestion is to set to "1" only the bit of the channel to calibrate.
In costruzione end
There is one EPROM in every preamplifier, an EPROM on the mainboard and 2 EPROM's on the post mainboard. Here the way to read from or write to each of them.
There are several loactions in which system parameters are stored that should not be written. Links to these locations are given below.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | |
---|---|---|---|---|---|---|---|---|
input instr | LSB address (see below) | MSB address (see below) | EPROM first byte to W | EPROM second byte to W | EPROM third byte to W | EPROM fourth byte to W | W/R, which EPROM, board up or down, Preamplifier Channel, according to the rules below. | see the bullet at Ins..EPR..R/W.. |
output ans | LSB address | MSB address | EPROM first byte | EPROM second byte | EPROM third byte | EPROM fourth byte, except in case of errors, see below. | same as Byte6 above | see the bullet at Ins..EPR..R/W.. |
Byte5 on answer : In case of errors it is set to the value of 255, or 0xff if the corresponding instruction byte is different from 0xff, otherwise it is set to 250 or 0xfa and Byte0 is set to 0xff or 255 if Byte0 on instruction is different from
Byte6 on instruction :
Example: If we want to read from the channel 4 of the upper board of the preamplifier we must set at Bit6: (1<<7)|(2<<0).
Memory address syntax : To each memory location are dedicated 4 bytes, an uint32_t. To determine address of the memory location of interest consider the list below, the bullet numbers should be multiplied by 4 for determining the actual address. This is not necessary in the instruction since it is done by fw. As an example, if we want to read/write from/in the Memory_preamplifier_address_coarse_trimmer_slope_offset we must write 3 in the adddresses bytes of Table_instr_EPROM_read_write , Byte0 and Byte1 of the isntruction.
The Memory addresses table for preamplifiers is at Preamplifier EPROM location list.
The Memory addresses table for mainboard is at Mainboard EPROM location list.
The Memory addresses table for post-mainboard is at Post-mainboard EPROM location list.
Note that the last definition in the enums marks the number of system locations used and the first free addrres.
This is an atomic function. It is possible to route one of the analog nodes connected to the anlog mux to the respectively ouput. Do not forget: this function must be run 2 times. the first is to connect the node, the second to disconnect the node.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | |
---|---|---|---|---|---|---|---|---|
input instr | x | x | x | x | 1= selected node is from board up; 0= selected node is from board down | Readable nodes are at Mux Nodes list. | 0: disconnect the node, 1: connect the node | see the bullet at Ins..mux..nod.. |
output ans | 0 | 0 | 0 | 0 | 0 | The node voltage connected, 0 if no node is connected, except in case of errors, see below. | Same as Byte6 above | see the bullet at Ins..mux..nod.. |
Byte5 on answer : In case of errors it is set to the value of 255, or 0xff if the corresponding instruction byte is different from 0xff, otherwise it is set to 250 or 0xfa.
This function allows to set ON or OFF the RED and/or the GREEN LEDs. It is an useful function to test the LED operation during the test phase and it is usefull for checking the operation of the board with the CAN bus commands. For verification of the address of the board, as an instance.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | |
---|---|---|---|---|---|---|---|---|
input instr | x | x | x | x | x | 1: LEDs are controlled as defined at Byte6; 0: LEDs are controlled by hw, in default mode | Bit0=1 : RED LED is ON; Bit0=0: RED LED is OFF; Bit1=1: GREEN LED is ON; Bit1=0: GREEN LED is OFF | see the bullet at instr_LED_ON_OFF |
output ans | 0 | 0 | 0 | 0 | 0 | Same as command Byte5 | LEDs state | see the bullet at instr_LED_ON_OFF |
This function allows to reset the communication periephrals, CAN bus, I2C (both I2C0 and I2C1) and SPI. The operation can be made in parallel with a single call.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | |
---|---|---|---|---|---|---|---|---|
input instr | x | x | x | x | x | x Bit0=1 : CAN bus is reset; Bit1=1: both I2C are reset; Bit2=1: SPI is reset see below | see the bullet at instr_periferal_reset | |
output ans | 0 | 0 | 0 | 0 | 0 | 0 | same as Byte6 of isnctruction | see the bullet at instr_periferal_reset |
Byte6: the reset can be made in parallel by OR-ing. Example for CAN bus + SPI reset: binary is 101, or 0x05.