Access to the trimmed ADC_VREF value requires mapping the content of the InfoPage to the entry address of INTFLASH2. The code sequence, how the mapping is performed, is part of the low-level driver package within the source file
system_netx.c and must be executed from internal SRAM.
The InfoPage includes two sets of data, initially supposed to be used by the end user, as a placeholder to calibrate out the temperature error. This procedure would require reference measurements at two different temperatures for each device that are often perceived as not acceptable by the user as it increases the testing time of the embedded device.
The structure of the data set is represented by a typedef in the header file system_netx.h:
Code Block |
---|
language | c# |
---|
linenumbers | true |
---|
|
typedef struct NETX_TEMP_CALIBRATION_Ttag
{
unsigned long aulCalDate[2];
unsigned short ulADCValue;
unsigned char sRefTemperature;
unsigned char saucReserved[9];
unsigned long ulCrc32;
} NETX_TEMP_CALIBRATION_T; |
The trimmed ADC_VREF value is stored in the reserved field of the data set at offset:
Offset | Size [bytes] | Name | Description |
---|
2048 | 8 | atTempDiode[0].s.aucCalDate | Calibration date for temperature diode at temperature 0 |
2056 | 2 | atTempDiode[0].s.usADCValue | ADC value equivalent to reference temperature for temperature diode at temperature 0 |
2058 | 1 | atTempDiode[0].s.cRefTemperature | Reference temperature for temperature diode at temperature 0 |
2059 | 1 | atTempDiode[0].s.aucReserved1 | Reserved |
2060 | 2 | atTempDiode[0].s.usADCVREFValue | Trimmed ADC_VREF x 214 stored during final part test |
2062 | 6 | atTempDiode[0].s.aucReserved2 | Reserved |
2068 | 4 | atTempDiode[0].ulCrc32 | CRC32 value over the whole structure |
The stored 16-bit integer for the variable usADCVREFValue must be divided by 214 to get the analog value of the trimmed ADC_VREF, e.g.:
- Binary : 1010011011100001
- Decimal : 42721
- Conversion : 42721 / 214 = 2.6075 V
As an alternative to the calibration at two fixed temperature points, calculating the temperature using the actual trimmed ADC_VREF value for VREF_ADC with Δ VREF_ADC ± 10 mV, the temperature error reduces to ± 5°C.