Skip to content
This repository has been archived by the owner on Mar 31, 2021. It is now read-only.

low level hardware interface

Adam Schoenwald edited this page Feb 3, 2021 · 16 revisions

Low Level Hardware Interface Documentation

ADCs

Each FEE has two ADCs. ADC1 monitors voltages and currents of the FEE. ADC2 monitors temperatures as well as the bias voltage and current. Reading from the following file locations, where ${ch} is 0 through 7, updates and returns the adc value on that channel.

Side A, ADC1 /sys/bus/spi/devices/spi1.0/iio\:device0/in_voltage${ch}_raw

Side A, ADC2 /sys/bus/spi/devices/spi1.1/iio\:device1/in_voltage${ch}_raw

Side B, ADC1 /sys/bus/spi/devices/spi2.0/iio\:device2/in_voltage${ch}_raw

Side B, ADC2 /sys/bus/spi/devices/spi2.1/iio\:device3/in_voltage${ch}_raw

FEE ADC# Ch Name Units Equation CODE Scale Value Expected Path
A 1 0 IN-5p4V-Conn Volts V_5p4 = CODE * (3.3/4096) * ((10e3 +10e3) / (10e3 )) 3359 0.001611328 5.4E+0 5.4 /sys/bus/spi/devices/spi1.0/iio\:device0/in_voltage0_raw
A 1 1 1p9V Current Amps I_1p9 = CODE * (3.3/4096) * (100/3e3) * (1/0.33) 4000 8.13802E-05 325.5E-3 /sys/bus/spi/devices/spi1.0/iio\:device0/in_voltage1_raw
A 1 2 IN-m5p4V-ConnVolts Volts V_m5p4 = CODE*(-1)*(3.3/4096) * ((10e3 +10e3) / (10e3 )) 3349 -0.001611328 -5.4E+0 -5.4 /sys/bus/spi/devices/spi1.0/iio\:device0/in_voltage2_raw
A 1 3 m2p4 Current Amps I_m2p4 = CODE * (3.3/4096) * (100/3e3) * (1/0.33) 4004 8.13802E-05 325.8E-3 /sys/bus/spi/devices/spi1.0/iio\:device0/in_voltage3_raw
A 1 4 1p5V-ASIC Volts V_1p5 =  CODE * (3.3/4096)*(1/(1+1)) 3713 0.000402832 1.5E+0 1.5 /sys/bus/spi/devices/spi1.0/iio\:device0/in_voltage4_raw
A 1 5 1p5V-ASIC Current Amps I_1p5  = CODE * (3.3/4096) * (100/4.99e3) * (1/1.0) 3926 1.61456E-05 63.4E-3 /sys/bus/spi/devices/spi1.0/iio\:device0/in_voltage5_raw
A 1 6 m2p0V-ASIC Volts V_m2p0 =  CODE * (-1)*(3.3/4096) 2445 -0.000805664 -2.0E+0 -2 /sys/bus/spi/devices/spi1.0/iio\:device0/in_voltage6_raw
A 1 7 m2p0V-ASIC Current Amps I_m2p0 = CODE * (3.3/4096) * (100/4.99e3) * (1/1.0) 4002 1.61456E-05 64.6E-3 /sys/bus/spi/devices/spi1.0/iio\:device0/in_voltage7_raw
B 1 0 IN-5p4V-Conn Volts V_5p4 = CODE * (3.3/4096) * ((10e3 +10e3) / (10e3 )) 3363 0.001611328 5.4E+0 5.4 /sys/bus/spi/devices/spi2.0/iio\:device2/in_voltage0_raw
B 1 1 1p9V Current Amps I_1p9 = CODE * (3.3/4096) * (100/3e3) * (1/0.33) 3999 8.13802E-05 325.4E-3 /sys/bus/spi/devices/spi2.0/iio\:device2/in_voltage1_raw
B 1 2 IN-m5p4V-ConnVolts Volts V_m5p4 = CODE*(-1)*(3.3/4096) * ((10e3 +10e3) / (10e3 )) 3352 -0.001611328 -5.4E+0 -5.4 /sys/bus/spi/devices/spi2.0/iio\:device2/in_voltage2_raw
B 1 3 m2p4 Current Amps I_m2p4 = CODE * (3.3/4096) * (100/3e3) * (1/0.33) 4000 8.13802E-05 325.5E-3 /sys/bus/spi/devices/spi2.0/iio\:device2/in_voltage3_raw
B 1 4 1p5V-ASIC Volts V_1p5 =  CODE * (3.3/4096)*(1/(1+1)) 3716 0.000402832 1.5E+0 1.5 /sys/bus/spi/devices/spi2.0/iio\:device2/in_voltage4_raw
B 1 5 1p5V-ASIC Current Amps I_1p5  = CODE * (3.3/4096) * (100/4.99e3) * (1/1.0) 3933 1.61456E-05 63.5E-3 /sys/bus/spi/devices/spi2.0/iio\:device2/in_voltage5_raw
B 1 6 m2p0V-ASIC Volts V_m2p0 =  CODE * (-1)*(3.3/4096) 2446 -0.000805664 -2.0E+0 -2 /sys/bus/spi/devices/spi2.0/iio\:device2/in_voltage6_raw
B 1 7 m2p0V-ASIC Current Amps I_m2p0 = CODE * (3.3/4096) * (100/4.99e3) * (1/1.0) 3999 1.61456E-05 64.6E-3 /sys/bus/spi/devices/spi2.0/iio\:device2/in_voltage7_raw
A 2 0 Thermistor 1 2180 2.99E+02 26.1E+0 /sys/bus/spi/devices/spi1.1/iio\:device1/in_voltage0_raw
A 2 1 Thermistor 2 2180 2.99E+02 26.1E+0 /sys/bus/spi/devices/spi1.1/iio\:device1/in_voltage1_raw
A 2 2 Thermistor 3 4091 3.70E+02 96.8E+0 /sys/bus/spi/devices/spi1.1/iio\:device1/in_voltage2_raw
A 2 3 Thermistor 4 2175 2.99E+02 26.1E+0 /sys/bus/spi/devices/spi1.1/iio\:device1/in_voltage3_raw
A 2 4 TP1 V_TP1 = CODE * (3.3/4096) 2175 /sys/bus/spi/devices/spi1.1/iio\:device1/in_voltage4_raw
A 2 5 TP2 V_TP2 = CODE * (3.3/4096) 2176 /sys/bus/spi/devices/spi1.1/iio\:device1/in_voltage5_raw
A 2 6 Detector Bias Voltage Volts V_bias = CODE * (3.3/4096) *((30.1e3 + 330e3 *3)/30.1e3 ) 3 0.02730425 81.9E-3 /sys/bus/spi/devices/spi1.1/iio\:device1/in_voltage6_raw
A 2 7 Detector Bias Current  I_bias = CODE * (3.3/4096) * (165/4.99e3) * (1/6.8e3) 5 3.91768E-09 19.6E-9 /sys/bus/spi/devices/spi1.1/iio\:device1/in_voltage7_raw
B 2 0 Thermistor 1 2180 2.99E+02 26.1E+0 /sys/bus/spi/devices/spi2.1/iio\:device3/in_voltage0_raw
B 2 1 Thermistor 2 2180 2.99E+02 26.1E+0 /sys/bus/spi/devices/spi2.1/iio\:device3/in_voltage1_raw
B 2 2 Thermistor 3 4091 3.70E+02 96.8E+0 /sys/bus/spi/devices/spi2.1/iio\:device3/in_voltage2_raw
B 2 3 Thermistor 4 2181 2.99E+02 26.1E+0 /sys/bus/spi/devices/spi2.1/iio\:device3/in_voltage3_raw
B 2 4 TP1 V_TP1 = CODE * (3.3/4096) 2173 0.000805664 1.8E+0 /sys/bus/spi/devices/spi2.1/iio\:device3/in_voltage4_raw
B 2 5 TP2 V_TP2 = CODE * (3.3/4096) 2171 0.000805664 1.7E+0 /sys/bus/spi/devices/spi2.1/iio\:device3/in_voltage5_raw
B 2 6 Detector Bias Voltage Volts V_bias = CODE * (3.3/4096) *((30.1e3 + 330e3 *3)/30.1e3 ) 3 0.02730425 /sys/bus/spi/devices/spi2.1/iio\:device3/in_voltage6_raw
B 2 7 Detector Bias Current  I_bias = CODE * (3.3/4096) * (165/4.99e3) * (1/6.8e3) 5 3.91768E-09 /sys/bus/spi/devices/spi2.1/iio\:device3/in_voltage7_raw

EEPROM

The EEPROM devices can be accessed as if they are files. The DBE EEPROM can be accessed after booting, but the AFE EEPROMs must have their drivers loaded once the AFE has been powered up, using the code

echo -n "spi1.2" > /sys/bus/spi/drivers/at25/bind

echo -n "spi2.2" > /sys/bus/spi/drivers/at25/bind

The ~/scripts/afe_enable.sh script automatically re-loads these after turning on the front end boards.

EEPROM detailslocations:

  • DBE EEPROM
    • Location = /sys/bus/i2c/devices/0-0050/eeprom
    • Size = 256 Bytes
    • Part = M24C02-FDW6TP
    • Bus = IIC0 , Address x50
  • FEE Side A EEPROM
    • Location = /sys/bus/spi/devices/spi1.2/eeprom
    • Size = 125k Bytes
    • Part = M95M01-RDW6TP
    • Bus = SPI 1.2
  • FEE Side B EEPROM /sys/bus/spi/devices/spi1.2/eeprom

Writing to EEPROM:

Note: If data is too large, will write up to size of memory and then report error on stderr

cp ~/eeprom.bin /sys/bus/i2c/devices/0-0050/eeprom

or

echo "Some Test Data" > /sys/bus/i2c/devices/0-0050/eeprom

Reading from EEPROM:

cp /sys/bus/i2c/devices/0-0050/eeprom ~/eeprom.bin

or

hexdump /sys/bus/i2c/devices/0-0050/eeprom -Cv