cancel
Showing results for 
Search instead for 
Did you mean: 

Hardfault, when reading TEMPSENSOR_CAL1_ADDR with STM32H56x

ingwmeier
Senior
#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.

1 ACCEPTED SOLUTION

Accepted Solutions
AScha.3
Chief III

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);

 

AScha3_0-1745660782921.png

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.)

 

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

2 REPLIES 2
AScha.3
Chief III

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);

 

AScha3_0-1745660782921.png

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.)

 

If you feel a post has answered your question, please click "Accept as Solution".

Thank you so much!