2024-12-19 02:00 AM
Hello,
Any access to the calibration memory addresses of the analogue temperature sensor or the internal reference causes a hard fault if ICACHE is enabled.
Here is an example:
ui16Temp = __HAL_ADC_CALC_VREFANALOG_VOLTAGE(0x0BF0, ADC_RESOLUTION_12B);
MX_ICACHE_Init ();
ui16Temp = __HAL_ADC_CALC_VREFANALOG_VOLTAGE(0x0BF0, ADC_RESOLUTION_12B);
Stepping in the debugger, we can see that the first operation gives the expected result. After enabling the ICACHE, we end up in a hard fault.
I pass the fixed value 0x0BF0 just for testing purposes to skip all the ADC related stuff.
My workaround is to store the calibration values in a global variable before enabling the ICACHE and use the variable instead of the memory addresses. Is there any other solution to this?
Took me a few days to figure this out. Hope it helps someone.
Solved! Go to Solution.
2024-12-19 02:06 AM
Hello @Kilian Nötzold,
Please refer to this KB article: How to avoid a HardFault when ICACHE is enabled on... - STMicroelectronics Community
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-12-19 02:06 AM
Hello @Kilian Nötzold,
Please refer to this KB article: How to avoid a HardFault when ICACHE is enabled on... - STMicroelectronics Community
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.