2025-04-26 1:10 AM - edited 2025-04-26 1:52 AM
#define TEMPSENSOR_CAL1_ADDR ((uint16_t*) (0x08FFF814UL)) /* Address of parameter TS_CAL1: On STM32H5,
temperature sensor ADC raw data acquired at temperature 30 DegC
(tolerance: +-5 DegC), Vref+ = 3.3 V (tolerance: +-10 mV). */
uint16_t regval = *TEMPSENSOR_CAL1_ADDR;
as soon as this address is read, the CPU goes into Hardfault. I double checked the Address in the Datasheet..
also restarts the CPU, when I try to show this Memory with the debugger.
also tested it with a Nucleo-H563ZI.
the same access with other STM32 CPUs (U5, L4 etc) work with no problems.
Solved! Go to Solution.
2025-04-26 2:48 AM
Hi,
its a problem with the cache : disable cache, then see:
int flsz = FLASH_SIZE;
printf("size : %d \n", flsz);
int regval = *TEMPSENSOR_CAL1_ADDR;
printf("tempcal1 %ld C : %d \n", TEMPSENSOR_CAL1_TEMP, regval);
To be able to read into system flash you need to disable the cache associated to this area.
This can be done by setting non cacheable attribute this this region.
You have an example for accessing this UID in the STM32CubeH5 here:
STM32Cube_FW_H5_V1.3.0\Projects\NUCLEO-H563ZI\Examples_LL\UTILS\UTILS_ReadDeviceInfo\
(by Jocelyn R.)
2025-04-26 2:48 AM
Hi,
its a problem with the cache : disable cache, then see:
int flsz = FLASH_SIZE;
printf("size : %d \n", flsz);
int regval = *TEMPSENSOR_CAL1_ADDR;
printf("tempcal1 %ld C : %d \n", TEMPSENSOR_CAL1_TEMP, regval);
To be able to read into system flash you need to disable the cache associated to this area.
This can be done by setting non cacheable attribute this this region.
You have an example for accessing this UID in the STM32CubeH5 here:
STM32Cube_FW_H5_V1.3.0\Projects\NUCLEO-H563ZI\Examples_LL\UTILS\UTILS_ReadDeviceInfo\
(by Jocelyn R.)
2025-04-26 4:16 AM
Thank you so much!