2017-01-27 02:39 AM
Hi,
When accessing some calibration registers, I get a hard fault. It might be due to unaligned access.
Is the '
stm32l0xx_ll_adc.h,
V1.7.0' correct?The 'VREFINT_CAL_ADDR' works correctly.
'TEMPSENSOR_CAL1_ADDR' and 'TEMPSENSOR_CAL2_ADDR' do not...
/* ADC internal channels related definitions */
/* Internal voltage reference VrefInt */
#define VREFINT_CAL_ADDR ((uint16_t*) ((uint32_t)0x1FF80078U))
/* Internal voltage reference, address of parameter VREFINT_CAL: VrefInt ADC raw data acquired at temperature 30 DegC (tolerance: +-5 DegC), Vref+ = 3.0 V (tolerance: +-10 mV). */
#define VREFINT_CAL_VREF ((uint32_t) 3000U)
/* Analog voltage reference (Vref+) value with which temperature sensor has been calibrated in production (tolerance: +-10 mV) (unit: mV). */
/* Temperature sensor */
#define TEMPSENSOR_CAL1_ADDR ((uint16_t*) ((uint32_t)0x1FF8007AU))
/* Internal temperature sensor, address of parameter TS_CAL1: On STM32L0, temperature sensor ADC raw data acquired at temperature 30 DegC (tolerance: +-5 DegC), Vref+ = 3.0 V (tolerance: +-10 mV). */
#define TEMPSENSOR_CAL2_ADDR ((uint16_t*) ((uint32_t)0x1FF8007EU))
/* Internal temperature sensor, address of parameter TS_CAL2: On STM32L0, temperature sensor ADC raw data acquired at temperature 130 DegC (tolerance: +-5 DegC), Vref+ = 3.0 V (tolerance: +-10 mV). */
#define TEMPSENSOR_CAL1_TEMP (( int32_t) 30)
/* Internal temperature sensor, temperature at which temperature sensor has been calibrated in production for data into TEMPSENSOR_CAL1_ADDR (tolerance: +-5 DegC) (unit: DegC). */
#define TEMPSENSOR_CAL2_TEMP (( int32_t) 130)
/* Internal temperature sensor, temperature at which temperature sensor has been calibrated in production for data into TEMPSENSOR_CAL2_ADDR (tolerance: +-5 DegC) (unit: DegC). */
#define TEMPSENSOR_CAL_VREFANALOG ((uint32_t) 3000U)
/* Analog voltage reference (Vref+) voltage with which temperature sensor has been calibrated in production (+-10 mV) (unit: mV). */�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?
BR Martin
2017-01-27 04:25 AM
'
uint16_t' was defined as '
unsigned int
', which caused the pointer to be treated as a 32bit pointer.When defining
'
uint16_t' as 'unsigned short', it is correctly handled as 16bit pointer by the compiler.
And it all works!
2017-01-27 05:33 AM
Hi
Jorgensen.Martin
,Thank you for posting your findings and how you fixed the issue, it is good to hear that it was solved.
-Nesrine-