pflib v3.9.0-rc3-11-g2537d8f
Pretty Fine HGCROC Interaction Library
Loading...
Searching...
No Matches
pflib::lpGBT Class Reference

Class which provides an interface with an lpGBT ASIC as mounted on an LDMX mezzanine. More...

#include <lpGBT.h>

Collaboration diagram for pflib::lpGBT:
[legend]

Classes

struct  I2C
 

Public Types

typedef std::pair< uint16_t, uint8_t > RegisterValue
 
typedef std::vector< RegisterValueRegisterValueVector
 

Public Member Functions

 lpGBT (lpGBT_ConfigTransport &transport)
 
void write (uint16_t reg, uint8_t value)
 
uint8_t read (uint16_t reg)
 
std::vector< uint8_t > read (uint16_t reg, int len)
 
void write (const RegisterValueVector &regvalues)
 Configure from a vector of register values.
 
RegisterValueVector read (const std::vector< uint16_t > &registers)
 Read values for set of registers.
 
void bit_set (uint16_t reg, int ibit)
 
void bit_clr (uint16_t reg, int ibit)
 
uint32_t serial_number ()
 Get the serial number (somewhat complex)
 
int status ()
 Get the lpGBT status (power up state machine)
 
std::string status_name (int pusm)
 
void gpio_set (int ibit, bool high)
 Set the given gpio bit.
 
bool gpio_get (int ibit)
 Get the given gpio bit.
 
void gpio_set (uint16_t values)
 Set the full GPIO array.
 
uint16_t gpio_get ()
 Get the full GPIO array.
 
int gpio_cfg_get (int ibit)
 Get the GPIO pin configuration.
 
void gpio_cfg_set (int ibit, int cfg, const std::string &name="")
 Set the GPIO pin configuration.
 
GPIOgpio_interface ()
 Get the pflib GPIO object.
 
uint16_t adc_read (int ipos, int ineg, int gain=1)
 Carry out an ADC read for the given pair of channels Valid gain values are 1 or 2, 8, 16, and 32.
 
uint16_t adc_resistance_read (int ipos, int current, int gain=1)
 Carry out an ADC read for the given channel, using the internal reference voltage for the other side of the measurement, with the current DAC enabled to the given amplitude Valid gain values are 1 or 2, 8, 16, and 32.
 
void setup_eclk (int ieclk, int rate, bool polarity=true, int strength=4)
 Setup the given eclk.
 
void setup_erx (int ierx, int align, int alignphase=0, int speed=3, bool invert=false, bool term=true, int equalization=0, bool acbias=false)
 Setup the given elink-rx.
 
void check_prbs_errors_erx (int group, int channel, bool lpgbt_only=false, int data_rate_code=3, uint8_t bert_time_code=4)
 Check for PRBS errors on given eRx group and channel.
 
void setup_etx (int ietx, bool enable, bool invert=false, int drive=4, int pe_mode=0, int pe_strength=0, int pe_width=0)
 Setup the given elink-tx.
 
void setup_ec (bool invert_tx=false, int drive=4, bool fixed=false, int alignphase=0, bool invert_rx=false, bool term=true, bool acbias=false, bool pullup=false)
 Setup the EC port.
 
uint32_t read_efuse (uint16_t addr)
 
void setup_i2c (int ibus, int speed_khz, bool scl_drive=false, bool strong_scl=true, bool strong_sda=true, bool pull_up_scl=false, bool pull_up_sda=false)
 Setup an I2C bus.
 
void start_i2c_read (int ibus, uint8_t i2c_addr, int len=1)
 Start an I2C read.
 
void i2c_write (int ibus, uint8_t i2c_addr, uint8_t value)
 Start an I2C write of a single byte.
 
void i2c_write (int ibus, uint8_t i2c_addr, const std::vector< uint8_t > &values)
 Start an I2C write of multiple bytes.
 
bool i2c_transaction_check (int ibus, bool wait=false)
 Check for transaction completion optionally waiting for completion, throws exception on failure.
 
std::vector< uint8_t > i2c_read_data (int ibus)
 Get back the data from the read.
 
void finalize_setup ()
 finalize the configuration
 

Static Public Attributes

static const int GPIO_IS_OUTPUT = 0x01
 
static const int GPIO_IS_PULLUP = 0x02
 
static const int GPIO_IS_PULLDOWN = 0x04
 
static const int GPIO_IS_STRONG = 0x08
 

Private Attributes

lpGBT_ConfigTransporttport_
 
struct pflib::lpGBT::I2C i2c_ [3]
 
::pflib::lpgbt::GPIO gpio_
 

Detailed Description

Class which provides an interface with an lpGBT ASIC as mounted on an LDMX mezzanine.

inferface class

Includes both low-level and medium-level interfaces. Uses an instance of a lpGBT_ConfigTransport for communication.

The statement as mounted on an LDMX mezzanine indicates that some channel numbers are tuned/adjusted to match the numbers on the mezzanine interface. For example, the pin labelled GPIO3 on the mezzanine is connected to pin GPIO15 on the lpGBT, which is hidden by this class such that this signal is considered to be GPIO3.

Member Function Documentation

◆ check_prbs_errors_erx()

void lpGBT::check_prbs_errors_erx ( int group,
int channel,
bool lpgbt_only = false,
int data_rate_code = 3,
uint8_t bert_time_code = 4 )

Check for PRBS errors on given eRx group and channel.

Parameters
groupERx index (0-6)
channelERx index (0-3)
lpgbt_onlyShould we find errors with internal BERT (true) or external (false) like econ
data_rate_codeData equal to 1, 2, or 3, from table 14.6 in v1 manual. Currently set to 3 for 1280 Mbps
bert_time_codeBERT measurement time from table 14.5 in v1 manual

◆ setup_ec()

void lpGBT::setup_ec ( bool invert_tx = false,
int drive = 4,
bool fixed = false,
int alignphase = 0,
bool invert_rx = false,
bool term = true,
bool acbias = false,
bool pullup = false )

Setup the EC port.

Parameters
invert_txInvert the outgoing signal
driveDrive strength (0-7)
fixedFixed mode?
alignphaseAlignment phase for fixed mode (0-15)
invert_rxInvert the incoming signal
termEnable the internal 100 Ohm termination
acbiasApply a bias appropriate for AC-coupled elinks
pullupEnable the pullup

◆ setup_eclk()

void lpGBT::setup_eclk ( int ieclk,
int rate,
bool polarity = true,
int strength = 4 )

Setup the given eclk.

Parameters
ieclkNumber of the ECLK on the mezzanine interface
rateLHC-nominal clock rate in MHz – 0/40/80/160/320/640/1280 – zero disables the driver
polaritySelect the polarity
strengthValues between 1-7

◆ setup_erx()

void lpGBT::setup_erx ( int ierx,
int align,
int alignphase = 0,
int speed = 3,
bool invert = false,
bool term = true,
int equalization = 0,
bool acbias = false )

Setup the given elink-rx.

Parameters
ierxERx index (0-5)
alignAlignment mode (0-3)
alignphaseAlignment phase particularly for fixed mode (0-15)
speedlink speed as given in lpgbt manual (usually 3)
invertInvert the incoming signal
termEnable the internal 100 Ohm termination
equalizationValue of the equalization field \oaram acbias Apply a bias appropriate for AC-coupled elinks On the LDMX lpGBT mezzanine, each elink-rx is configured with a single active pair.

◆ setup_etx()

void lpGBT::setup_etx ( int ietx,
bool enable,
bool invert = false,
int drive = 4,
int pe_mode = 0,
int pe_strength = 0,
int pe_width = 0 )

Setup the given elink-tx.

For LDMX, all elink-tx are assumed to operate in 320 Mbps mode.

Parameters
ietxETx index (0-6)
enableEnable the ETx
driveDriver strength (0-7)
pe_modePre-Emphasis mode (0 or 2, generally)
pe_strengthPre-emphasis strength (0-7)
pe_widthPre-emphasis width (0-7)

◆ setup_i2c()

void lpGBT::setup_i2c ( int ibus,
int speed_khz,
bool scl_drive = false,
bool strong_scl = true,
bool strong_sda = true,
bool pull_up_scl = false,
bool pull_up_sda = false )

Setup an I2C bus.

Parameters
ibusWhich I2C bus (0-2)
speed_khzI2C speed (appropriate values are 100, 200, 400, 1000)
scl_driveEnable CMOS driver on SCL
strong_sclEnable higher-strength driver on SCL
strong_sdaEnable higher-strength driver on SDA
pull_up_sclEnable internal pullup on SCL
pull_up_sdaEnable internal pullup on SDA

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