TLE5012B Register Class

class Reg

Collaboration diagram for tle5012::Reg:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "1" [label="tle5012::Reg" tooltip="tle5012::Reg" fillcolor="#BFBFBF"] "2" [label="tle5012::Reg::AddressField_t" tooltip="tle5012::Reg::AddressField_t"] "1" -> "2" [dir=forward tooltip="usage"] }

Register class for the TLE5012B sensor.

tle5012b_reg.cpp - core register support header for the TLx5012B angle sensor family.

GMR-based angle sensor for angular position sensing in automotive applications

This file includes the registry definition macros of all Sensor registers and the bit settings for each of the register content values. Depending on the type of secondary interface (PWM, IIF or HSM) the meaning of some register values differs, so please have look in the TLE5012 manual for the exact meaning. Also included here are other senseful macros for handling the TLE5012 sensor.

Author

Infineon Technologies AG

Copyright

2019-2024 Infineon Technologies AG

Version

4.0.0

SPDX-License-Identifier: MIT

static const AddressField_t addrFields[] = {{REG_STAT, 1}, {REG_ACSTAT, 2}, {REG_AVAL, 3}, {REG_ASPD, 4}, {REG_AREV, 5}, {REG_FSYNC, 6}, {REG_MOD_1, 7}, {REG_SIL, 8}, {REG_MOD_2, 9}, {REG_MOD_3, 10}, {REG_OFFX, 11}, {REG_OFFY, 12}, {REG_SYNCH, 13}, {REG_IFAB, 14}, {REG_MOD_4, 15}, {REG_TCO_Y, 16}, {REG_ADC_X, 17}, {REG_ADC_Y, 18}, {REG_D_MAG, 19}, {REG_T_RAW, 20}, {REG_IIF_CNT, 21}, {REG_T25O, 22},}

Registers bitfields.

Reg(void *p)

Construct a new Reg::Reg object.

Parameters:

p – nested pointer to parent

~Reg()

Destroy the Reg::Reg object.

bool isStatusReset(void)

Indication that there was a reset state.

Returns:

true indication of reset, power up power break firmware or active reset

Returns:

false no reset since last readout

bool isStatusWatchDog(void)

Permanent check of watchdog.

Returns:

true watchdog counter expired, ASRST must be activated

Returns:

false normal operation

bool isStatusVoltage(void)

Permanent check of internal and external supply voltages.

Returns:

true over voltage, GND off

Returns:

false voltages ok

bool isStatusFuse(void)

Cyclic CRC check of configuration registers and startup CRC.

Returns:

true CRC fail

Returns:

false CRC ok

bool isStatusDSPU(void)

Check DSPU, CORDIC and CAPCOM at startup.

Returns:

true DSPU self-test not ok or still running

Returns:

false DSPU self-test ok

bool isStatusOverflow(void)

Cyclic check of DSPU (Digital Signal Processing Unit) overflow.

Returns:

true DSPU overflow occurred

Returns:

false No DSPU overflow occurred

bool isStatusXYOutOfLimit(void)

Cyclic check of X and > raw values.

Returns:

true X,Y data out of limit

Returns:

false X,Y data ok

bool isStatusMagnitudeOutOfLimit(void)

Vector lengths cyclic check of X,Y values after error compensation.

Returns:

true GMR-magnitude out of limit

Returns:

false GMR magnitude ok

bool isStatusADC(void)

Check signal path with test vectors.

Returns:

true Test vectors out of limit

Returns:

false Test vectors ok

bool isStatusROM(void)

Check of ROM-CRC at startup.

Returns:

true CRC fail or running

Returns:

false CRC ok

bool isStatusGMRXY(void)

No valid GMR X,Y values, cyclic check of ADC input.

Returns:

true no valid GMR X,Y values

Returns:

false valid GMR X,Y value

bool isStatusGMRA(void)

No value GMR angle value, cyclic check of DSPU output.

Returns:

true no valid GMR angle values on the interface

Returns:

false valid GMR angle values

bool isStatusRead(void)

Read status, checks if any status register changed since last readout.

Returns:

true status values changed since last readout

Returns:

false status values not changed

uint8_t getSlaveNumber(void)

Get the actual slave number of the sensor. Up to four sensors can be selected via this register field.

Returns:

uint8_t

void setSlaveNumber(const uint8_t snr)

Set the slave number of the sensor. Up to four sensors can be selected with this register field.

Parameters:

snr – Slave number between 0 and 3

bool isActivationReset(void)

Hardware reset, will be performed after chip select returns to high.

Returns:

true activation of hardware reset

Returns:

false after reset, thus always returns false

void setActivationReset(void)

Set the Activation Reset object Performs a hardware reset.

void enableWatchdog(void)

Enable the DSPU watchdog.

void disableWatchdog(void)

disable the DSPU watchdog

bool isWatchdog(void)

Get the status of the DSPU watchdog.

Returns:

true DSPU watchdog is enabled

Returns:

false DSPU watchdog is disabled

void enableVoltageCheck(void)

Enable the voltage regulator check.

void disableVoltageCheck(void)

disable the voltage regulator check

bool isVoltageCheck(void)

Get the status of the voltage regulator check.

Returns:

true voltage regulator check is enabled

Returns:

false voltage regulator check is disabled

void enableFuseCRC(void)

Enable the fuse CRC check.

void disableFuseCRC(void)

disable the fuse CRC check

bool isFuseCRC(void)

Get the status of the fuse CRC check.

Returns:

true fuse CRC check is enabled

Returns:

false fuse CRC check is disabled

void enableDSPUbist(void)

Enable the DSPU bist check.

void disableDSPUbist(void)

disable the DSPU bist check

bool isDSPUbist(void)

Get the status of the DSPU bist check.

Returns:

true DSPU bist check is enabled

Returns:

false DSPU bist check is disabled

void enableDSPUoverflow(void)

Enable the DSPU overflow check.

void disableDSPUoverflow(void)

disable the DSPU overflow check

bool isDSPUoverflow(void)

Get the status of the DSPU overflow check.

Returns:

true DSPU overflow check is enabled

Returns:

false DSPU overflow check is disabled

void enableXYCheck(void)

Enable the X,Y out of limit check.

void disableXYCheck(void)

disable the X,Y out of limit check

bool isXYCheck(void)

Get the status of the X,Y out of limit check.

Returns:

true X,Y out of limit check is enabled

Returns:

false X,Y out of limit check is disabled

void enableGMRCheck(void)

Enable the GMR magnitude check.

void disableGMRCheck(void)

disable the GMR magnitude check

bool isGMRCheck(void)

Get the status of the GMR magnitude check.

Returns:

true GMR magnitude check is enabled

Returns:

false GMR magnitude check is disabled

void enableADCCheck(void)

Enable the ADC test vector check.

void disableADCCheck(void)

disable the ADC test vector check

bool isADCCheck(void)

Get the status of the ADC test vectorGMR magnitude check.

Returns:

true ADC test vector check is enabled

Returns:

false ADC test vector check is disabled

void activateFirmwareReset(void)

Activate the firmware reset, all configuration registers retain their contents. Will also set the SRST register.

bool isFirmwareReset(void)

Get the status of the firmware reset register.

Returns:

true activation on firmware reset

Returns:

false default after execution of reset

bool isAngleValueNew(void)

Do we have a new calculated angle value since last readout.

Returns:

true new angle value available

Returns:

false no new angle value calculated

uint16_t getAngleValue(void)

Get a new calculated angle value.

Returns:

uint16_t calculated angle value

bool isSpeedValueNew(void)

Do we have a new calculated speed value since last readout.

Returns:

true new speed value available

Returns:

false no new speed value calculated

uint16_t getSpeedValue(void)

Get a new calculated speed value.

Returns:

uint16_t calculated speed value

bool isNumberOfRevolutionsNew(void)

Do we have a new number of revolutions since last readout.

Returns:

true new number of revolutions available

Returns:

false no number of revolutions

uint16_t getNumberOfRevolutions(void)

Get a new number of revolutions value.

Returns:

uint16_t number of revolutions

uint16_t getFrameCounter(void)

Get the frame counter value. Internal frame counter increments every update period.

Returns:

uint16_t frame counter

void setFrameCounter(uint16_t fcnt)

Set the frame counter value.

uint16_t getFrameSyncCounter(void)

Get the frame synchronisation counter value Internal frame sub counter within one frame.

Returns:

uint16_t frame synchronisation counter

void setFrameSyncCounter(uint16_t fsync)

Set the frame synchronisation counter value.

uint16_t getTemperatureValue(void)

Get the temperature value as signed offset compensated temperature value Saturated between -30°C and above 140°C.

Returns:

uint16_t temperature value

void setFilterDecimation(uint8_t firmd)

Set the filter decimation, update rate setting.

uint8_t getFilterDecimation(void)

Get the filter decimation, update rate setting.

Returns:

uint16_t filter decimation

void setIIFMod(uint8_t iifmod)

Set the IIF (Incremental Interface Mode)

uint8_t getIIFMod(void)

Get the temperature value as signed offset compensated temperature value Saturated between -30°C and above 140°C.

Returns:

uint16_t IIF mode

void holdDSPU(void)

Set DSPU on hold.

void releaseDSPU(void)

release DSPU operations

bool isDSPUhold(void)

Get the status of DSPU operations.

Returns:

true DSPU is on hold

Returns:

false DSPU is in operation

void setInternalClock(void)

Set the clock source to internal oscillator.

void setExternalClock(void)

Set clock source to external SCK.

bool statusClockSource(void)

Get the status of the clock source.

Returns:

true external 4MHz clock on pin IFC selected

Returns:

false internal oscillator

void enableFilterParallel(void)

Enable the Filter parallel diagnostics function.

void disableFilterParallel(void)

disable the Filter parallel diagnostics function

bool isFilterParallel(void)

Get the status of the Filter parallel diagnostics function.

Returns:

true filter parallel is enabled

Returns:

false filter parallel is disabled

void enableFilterInverted(void)

Enable the Filter inverted diagnostics function.

void disableFilterInverted(void)

disable the Filter inverted diagnostics function

bool isFilterInverted(void)

Get the status of the Filter inverted diagnostics function.

Returns:

true filter inverted is enabled

Returns:

false filter inverted is disabled

void enableADCTestVector(void)

Enable the ADC test vector diagnostics function.

void disableADCTestVector(void)

disable the ADC test vector diagnostics function

bool isADCTestVector(void)

Get the status of the ADC test vector diagnostics function.

Returns:

true ADC test vector is enabled

Returns:

false ADC test vector is disabled

void setFuseReload(void)

Set the fuse reload register and trigger a reload.

bool getFuseReload(void)

Get the status of the fuse reload register.

Returns:

true reload of registers from fuses immediately

Returns:

false normal operations

void setTestVectorX(uint8_t adctvx)

Set the test vector x.

uint8_t getTestVectorX(void)

Get the test vector x.

Returns:

uint8_t test vector x

void setTestVectorY(uint8_t adctvy)

Set the test vector s.

uint8_t getTestVectorY(void)

Get the test vector y.

Returns:

uint8_t test vector y

void directionClockwise(void)

Set angle direction clockwise.

void directionCounterClockwise(void)

Set angle direction counter clockwise.

bool isAngleDirection(void)

Get the angle direction.

Returns:

true angle direction is clockwise

Returns:

false angle direction is counter clockwise

void enablePrediction(void)

Enable the angle prediction based on current speed.

void disablePrediction(void)

disable the angle prediction

bool isPrediction(void)

Get the status of angle prediction.

Returns:

true prediction is enabled

Returns:

false prediction is disabled

void setAngleRange(angleRange_t range)

Set the representation of the angle output value and the speed value.

angleRange_t getAngleRange(void)

Get the representation of the angle range.

Returns:

angleRange_t type of angle range

void setCalibrationMode(calibrationMode_t autocal)

Set the automatic calibration mode.

calibrationMode_t getCalibrationMode(void)

Get the actual automatic calibration mode.

Returns:

angleRange_t type of calibration mode

void enableSpikeFilter(void)

Enable the analog spike filter to filter voltage spikes in IFC, SCK, CS.

void disableSpikeFilter(void)

disable the analog spike filter to filter

bool isSpikeFilter(void)

Get the status of the analog spike filter.

Returns:

true spike filter is enabled

Returns:

false spike filter is disabled

void enableSSCOpenDrain(void)

Enable open drain on SSC interface.

void enableSSCPushPull(void)

Enable push pull on SSC interface.

bool isSSCOutputMode(void)

Get the status of the SSC output mode.

Returns:

true SSC open drain

Returns:

false SSC push pull default

void setAngleBase(uint16_t base)

Set a new value for the angle base calibration.

uint16_t getAngleBase(void)

Get the actual 0° angle position The 0° angle position is factory calibrated parallel to the edge of the chip.

Returns:

uint16_t angle base calibration

void setPadDriver(uint8_t pad)

Set a new pad driver configuration.

uint8_t getPadDriver(void)

Get the pad driver configuration.

Returns:

uint8_t pad driver

int16_t getOffsetX(void)

Get offset correction x value.

Returns:

int16_t offset x value

void setOffsetX(int16_t offx)

Set offset correction x value.

int16_t getOffsetY(void)

Get offset correction y value.

Returns:

int16_t offset y value

void setOffsetY(int16_t offy)

Set offset correction y value.

void setAmplitudeSynch(int16_t synch)

Set amplitude correction value.

int16_t getAmplitudeSynch(void)

Get amplitude correction value.

Returns:

int16_t offset y value

void setFIRUpdateRate(bool fir)

Set the FIR (Filter Initial Rate) update rate.

uint8_t getFIRUpdateRate(void)

Get the FIR update rate.

Returns:

uint8_t(bool) FIR update rate

void enableIFABOpenDrain(void)

Enable open drain in IFA, IFB and IFC.

void enableIFABPushPull(void)

Enable push pull in IFA, IFB and IFC.

bool isIFABOutputMode(void)

Get the status of the IFA, IFB and IFC output mode.

Returns:

true IFA, IFB and IFC open drain

Returns:

false IFA, IFB and IFC push pull default

void setOrthogonality(int16_t ortho)

Set the orthogonality correction of x y components.

int16_t getOrthogonality(void)

Get the orthogonality correction of x y components.

Returns:

int16_t orthogonality correction

void setHysteresisMode(uint8_t hyst)

Set the hysteresis mode for HSM, or the unit time if in SPC mode (see manual)

uint8_t getHysteresisMode(void)

Get the hysteresis mode for HSM, or the unit time if in SPC mode (see manual)

Returns:

uint8_t hysteresis mode/unit time

void setInterfaceMode(interfaceType_t ifmd)

Set the interface Mode on IFA,IFB,IFC.

interfaceType_t getInterfaceMode(void)

Get the interface Mode on IFA,IFB,IFC.

Returns:

interfaceType_t interface type

void setIFABres(uint8_t res)

Set multipurpose register, PWM frequency, IIF resolution, SPC frame configuration.

uint8_t getIFABres(void)

Get multipurpose register.

Returns:

uint8_t multipurpose, HSM pole pairs, PWM frequency, IIF resolution, SPC frame configuration

void setHSMplp(uint8_t plp)

Set multipurpose register, HSM pole pairs, PWM frequency, IIF resolution, SPC frame configuration.

uint8_t getHSMplp(void)

Get multipurpose register.

Returns:

uint8_t multipurpose, PWM frequency, IIF resolution, SPC frame configuration

void setOffsetTemperatureX(int8_t tcox)

Set offset temperature coefficient for x component.

int8_t getOffsetTemperatureX(void)

Get offset temperature coefficient for x component.

Returns:

int8_t x temperature coefficient

void setOffsetTemperatureY(int8_t tcoy)

Set offset temperature coefficient for y component.

int8_t getOffsetTemperatureY(void)

Get offset temperature coefficient for y component.

Returns:

int8_t x temperature coefficient

void enableStartupBist(void)

Enable startup bist.

void disableStartupBist(void)

Disable startup bist.

bool isStartupBist(void)

Get the status of startup bist.

Returns:

true Bist enabled

Returns:

false Bist disabled

void setCRCpar(uint16_t crc)

Set CRC of parameters from address 08h to 0Fh.

uint16_t getCRCpar(void)

Get CRC of parameters from address 08h to 0Fh.

Returns:

uint16_t CRC

int16_t getADCx(void)

Get GMR ADC x value.

Returns:

uint16_t ADC x

int16_t getADCy(void)

Get GMR ADC y value.

Returns:

uint16_t ADC y

uint16_t getVectorMagnitude(void)

Get angle vector magnitude.

Returns:

uint16_t MAG

uint16_t getTemperatureRAW(void)

Get Temperature Sensor raw value.

Returns:

uint16_t Temperature raw value

bool isTemperatureToggle(void)

Is there a new Temperature Sensor RAW value.

Returns:

true Bist enabled

Returns:

false Bist disabled

uint16_t getCounterIncrements(void)

Get Counter value of increments.

Returns:

uint16_t Temperature raw value

uint16_t getT25Offset(void)

Get Temperature 25°C offset value.

Returns:

uint16_t T25 offset value

Public Types

enum calibrationMode_t

Automatic calibration of offset and amplitude synchronicity for applications with full-turn. Only 1 LSB corrected at each update. CRC check of calibration registers is automatically disabled if AUTOCAL activated.

Values:

enumerator noAutoCal

noAutoCal = no auto-calibration

enumerator mode1

mode1 update every angle update cycle (FIR_MD setting)

enumerator mode2

mode2 update every 1.5 revolutions

enumerator mode3

mode3 update every 11.25°

enum angleRange_t

Values:

enumerator factor1

magnetic angle from -180° to +180°, mapped values from -16384 to 16384

enumerator factor4

magnetic angle from -45° to +45°, mapped values from -16384 to 16384

enumerator factor5

magnetic angle from -180° to +180°, mapped values from -8192 to 8192

enum interfaceType_t

List of possible interface types witch are preset by fuses and can be changed into each other.

Values:

enumerator IIF

IIF Incremental Interface (IIF)

enumerator PWM

PWM Pulse-Width-Modulation (PWM)

enumerator HSM

HSM Hall Switch Mode (HSM)

enumerator SPC

SPC Short-PWM-Code (SPC)

enumerator SSC

SSC Synchronous Serial Communication (SSC)

enum sensorType_t

Values:

enumerator TLE5012B_E1000

TLE5012B_E1000 Sensor2Go variant.

enumerator TLE5012B_E3005

TLE5012B_E3005.

enumerator TLE5012B_E5000

TLE5012B_E5000 Sensor2Go variant.

enumerator TLE5012B_E5020

TLE5012B_E5020.

enumerator TLE5012B_E9000

TLE5012B_E9000 Sensor2Go variant.

enum Access_t

Register access type.

Values:

enumerator REG_ACCESS_R

Read access register.

enumerator REG_ACCESS_W

Write access register.

enumerator REG_ACCESS_RW

Read & write access register.

enumerator REG_ACCESS_U

Update register.

enumerator REG_ACCESS_RU

Read & update register.

enumerator REG_ACCESS_RWU

Read & write & update register.

enumerator REG_ACCESS_RES

Reserved access register.

enum Addr_t

register address enumeration for all sensor registers

Values:

enumerator REG_STAT

STAT status register.

enumerator REG_ACSTAT

ACSTAT activation status register.

enumerator REG_AVAL

AVAL angle value register.

enumerator REG_ASPD

ASPD angle speed register.

enumerator REG_AREV

AREV angle revolution register.

enumerator REG_FSYNC

FSYNC frame synchronization register.

enumerator REG_MOD_1

MOD_1 interface mode1 register.

enumerator REG_SIL

SIL register.

enumerator REG_MOD_2

MOD_2 interface mode2 register.

enumerator REG_MOD_3

MOD_3 interface mode3 register.

enumerator REG_OFFX

OFFX offset x.

enumerator REG_OFFY

OFFY offset y.

enumerator REG_SYNCH

SYNCH synchronicity.

enumerator REG_IFAB

IFAB register.

enumerator REG_MOD_4

MOD_4 interface mode4 register.

enumerator REG_TCO_Y

TCO_Y temperature coefficient register.

enumerator REG_ADC_X

ADC_X ADC X-raw value.

enumerator REG_ADC_Y

ADC_Y ADC Y-raw value.

enumerator REG_D_MAG

D_MAG angle vector magnitude.

enumerator REG_T_RAW

T_RAW temperature sensor raw-value.

enumerator REG_IIF_CNT

IIF_CNT IIF counter value.

enumerator REG_T25O

T25O temperature 25°c offset value.

Public Members

void *p
uint16_t regMap[0x16]

Register map */.

struct AddressField_t

Register address field.

Public Members

uint16_t regAddress

Address field register address */.

uint8_t posMap

Address field register regMap position */.

struct BitField_t

Bit field parameters.

Public Members

uint8_t regAccess

Bitfield register access.

uint16_t regAddress

Bitfield register address.

uint16_t mask

Bitfield mask.

uint8_t position

Bitfield position.

uint8_t resetValue

Bitfield register reset value.

uint8_t posMap

Bitfield position of register in regMap.