2019-12-12 03:17 AM
I am working to generate the CRC for the flash memory, During this I am facing hard fault when the CRC module tries to read from certain flash locations, to debug it I made a small loop which assigns the value of each 4 byte. I found that reading at certain locations results in hardfault.
I tried with different starting address, I found that
when starting address is 0x08000000 hardfault occurred at 0x08000440
when starting address is 0x08001000 hardfault occurred at 0x0800144c
when starting address is 0x08004000 hardfault occurred at 0x080044cc
uint32_t *d1 = 0x08000000;
while(length){
uint32_t temp = *d1;
d1++;
length -= 4;
}
Any Idea of what is causing this issue?
2019-12-12 03:40 AM
MPU enabled ?
Or another unhandled/escalated fault ?
I would check the SCB registers for fault reason & location.
Although, I don't have specific experience with the H7.
2019-12-12 03:48 AM
MPU is not enabled.
2019-12-12 04:10 AM
Unaligned bit is set in UFSR register.
2019-12-12 04:18 AM
I do not find a hit when searching for UFSR in RM0399.
2019-12-12 04:21 AM
It is in programmers manual PM0253.
2019-12-12 04:28 AM
Custom board? Which H7 specifically?
Check clock speeds.
Check supplies and VCAP pins/caps.
Check Flash wait states.
Check length a multiple of 4.
Keil, IAR or GCC?
2019-12-12 04:41 AM
I have STM32H750VB on desk and I have dumped flash with 0 issues:
volatile uint32_t *d1 = 0x08000000;
do{
volatile uint32_t temp = *d1;
d1++;
}while(d1<0x080FFFFF);
Used keil, no HAL, clock is 400 MHz. Afaik STMH7s have sane default setting of flash latency, so it runs with highest clock without touching.
As I understand OT has some other soft already running so it wouldn't matter.
At what exactly instruction it breaks?
HAL usage?
2019-12-12 04:45 AM
Nucleo-h743zi
gcc.
Length and address increments is always a multiple of 4.
The processor runs at 64mHz, with a flash latency set to 0. Changed the flash latency to 4. Still the result is same.
2019-12-12 04:56 AM
Just copy pasted this code,
The hardfault occurs at
volatile uint32_t temp = *d1;
The address in d1 is 0x80029d0 at the time of hardfault, another time is 0x800332c... I have no other code other than this after the initialization.