Skip to content

Support for AMACstar

Karol Krizka requested to merge kk_amacstar into activeTB

The goal is to implement support for AMACstar in a transparent manner for operation. The main differences between AMACv2 and AMACstar are

  • Added non-critical new read-only fields (ie: SEE counters, AM mux status, DEADBEEF).
  • Removed certain interlock thresholds and corresponding logic settings.
  • Shuffled some of the existing fields around.
  • Added AMAC current measurement as multiplexed channel.

There is no critical change in functionality to the AMAC. All procedures for operating AMACv2 and AMACstar can remain unchanged. It is only necessary to implement an updated field map and method to choose the right one. Fields not present in given chip silently fail (return 0 on read, write updates internal value).

Developing heavier abstraction is not necessary as we don't expect any future changes.

Field Map Implementation

The AMACv2RegMap contains a union of all fields in AMACv2 and AMACstar. The initialization of the actual map is done in functions AMACv2RegMap::init_v2 and AMACv2RegMap::init_star.

To make automatic generation from a spreadsheet easier:

  • Fields with the same definitions are separately initialized in both functions.
  • The two functions are saved in separate files (AMACv2RegMap_v2.cpp and AMACv2RegMap_star.cpp).

Version Detection

The AMACv2 constructor has a new enum argument called version used to select the right register map. For Powerboard tests, this can be set in the configuration file.

This process is automated by reading register 0. The AMACv2::init function automatically initialized the version name.

pre-AMACStar: Reg0[7:6] = 2'b00
AMACStar    : Reg0[7:6] = 2'b01

Class naming

All classes maintain AMACv2 in their name to minimize the amount of changes.

Handling of non-exist registers in AMACv2.cpp

There are some registers/fields present in star but not in v2 and vice versa. To deal with this:

  • access (read and write) to all registers/fields (either in v2 or star) is allowed regardless of the AMAC version
  • AMACv2 will automatically do nothing if the registers are not valid in current version of AMAC.

Copy registers

All copy registers (DCDCenC, CntSetC, IlockC, RstCntC, AMenC, AMpwrC) are not present in AMAC star anymore.

Shunt enable

For AMAC star, the Shunt enable bit, Reg49[8], is needed to be high to enable the shunt x/y DAC outputs. This field doesn't exist in AMAC v2, and setting this bit to high will do nothing (see the "Handling of non-exist registers in AMACv2.cpp").

AMAC channel mapping

AMAC ADC channel mappings are different between AMAC v2 and star. The channel mapping is defined inside AMACv2. Please try to avoid direct calling of a channel number and use the abstracted channel names with AMACv2::readAM instead.

NTC calibration enable bit

The NTC calibration bit (NTCpbCal, NTCx0Cal and NTCy0Cal) for AMAC v2 and star is inverted. The v2 uses value of 0 to enable calibration while star uses 1. This is abstracted in new AMACv2::enable/disableNTCCalibration functions.

linPOL Current Measurement

The internal AMAC current can now be measured via a high/low voltage measurement of VDDLR. A new function called AMACv2::getLinPOLCur has been added to return the measured current in A.

eFuse ID reading

For AMAC star, in order to read the eFuse ID, one first need to write 1 to bit 16 of register 32. This is not implemented in this MR. To see the implementation, check this MR: !142 (merged)

Input current tuning DCDCiP/N

For AMAC star, those two fields have four bits (vs. three bits for AMACv2). This change is not implemented inthis MR. To see the implementation, chech this MR: !143 (merged)

Edited by Zhicai Zhang

Merge request reports