pflib v3.13.3-1-gf856638
Pretty Fine HGCROC Interaction Library
Loading...
Searching...
No Matches
pflib::Bias Class Reference

The HGC ROC has 4 MAX5825 chips doing the DAC for the bias voltages. More...

#include <Bias.h>

Collaboration diagram for pflib::Bias:
[legend]

Public Member Functions

 Bias (std::shared_ptr< I2C > bias_i2c, std::shared_ptr< I2C > board_i2c, bool use_cache)
 Wrap I2C objects for communicating with all the DAC chips.
 
 Bias (const Bias &)=delete
 dont copy construct this class
 
Biasoperator= (const Bias &)=delete
 dont copy assign this class
 
void initialize ()
 Initialize to standard settings.
 
double readTemp ()
 Read the temperature from the temp sensor on the HGCROC board.
 
std::optional< int > readSiPM (uint8_t i_sipm)
 
std::optional< int > readLED (uint8_t i_led)
 
void setSiPM (uint8_t i_sipm, uint16_t code)
 
void setLED (uint8_t i_led, uint16_t code)
 

Static Public Attributes

static const int N_CHANNELS = 16
 
static const uint8_t ADDR_LED_0 = 0x18
 DAC chip addresses taken from HGCROC specs.
 
static const uint8_t ADDR_LED_1 = 0x1A
 
static const uint8_t ADDR_SIPM_0 = 0x10
 
static const uint8_t ADDR_SIPM_1 = 0x12
 

Private Attributes

std::shared_ptr< I2Ci2c_bias_
 I2C comms with bias DACs MAX5825.
 
std::shared_ptr< I2Ci2c_board_
 I2C comms with HGCROC board periferials.
 
std::vector< MAX5825led_
 LED bias chips.
 
std::vector< MAX5825sipm_
 SiPM bias chips.
 
bool use_cache_
 whether to use the software cache of the settings
 
std::array< std::optional< int >, N_CHANNELS > sipm_cache_
 cache of sipm settings
 
std::array< std::optional< int >, N_CHANNELS > led_cache_
 cache of led settings
 

Detailed Description

The HGC ROC has 4 MAX5825 chips doing the DAC for the bias voltages.

Two of the chips handle the 16 LED bias voltages and the other two handle the 16 SiPM bias voltages.

Both the LED and SiPM bias voltages are indexed from 0 to 15. The conversion from that index to a chip and DAC index on that chip is done in this class.

The readback of the DAC settings in the MAX5825 seem to require a "repeated start" I2C transaction where the register to be read and the read command are sent before the next I2C stop. Originally pointed out by Lennart at Lund, this "repeated start" transaction cannot be done by the lpGBT, so actual readback of the DAC settings is not supported in fiberfull setups.

Constructor & Destructor Documentation

◆ Bias()

pflib::Bias::Bias ( std::shared_ptr< I2C > bias_i2c,
std::shared_ptr< I2C > board_i2c,
bool use_cache )

Wrap I2C objects for communicating with all the DAC chips.

The bus is 4 + <board-number>, so we set the default to 4 for the case where we only have one board with bus number 0.

Parameters
[in]bias_i2cI2C object for interacting with MAX5825 bias DACs
[in]board_i2cI2C object for talking with HGCROC board periferials
[in]use_cachewhether to use the software cache for readback (true) or not (false). This is necessary for readback to function on fiberless setups.

Member Function Documentation

◆ initialize()

void pflib::Bias::initialize ( )

Initialize to standard settings.

reset all CODEs, DACs, and CRs to zero

Set internal ref on DAC to 4.096 V

Set up the GPIO device MCP23008

Turn on the status LED

Set up the board temperature sensor TMP101

Set up the two onewire-to-I2C devices DS2482


The documentation for this class was generated from the following files: