Skip to main content
APipe.2
Visitor II
January 24, 2021
Question

Catching and clearing BusFaults in STM32 H743

  • January 24, 2021
  • 1 reply
  • 1044 views

We are having issues with corrupted flash on the STM32 H7 series. The problem manifests where a read to the offending address in flash will cause a bus fault. We think it is down to bad CRC and the way to resolve is usually to wipe the flash and reprogram. What I would like to do is do this on the fly, so detect the offending address and erase the page. I was hoping to do this roughly though the following:

// enable the busfault handler
SCB->SHCSR|= SCB_SHCSR_BUSFAULTENA_Msk;
 
// disable all faults
 __disable_fault_irq();
 __DSB();
 
// read the offending data here
read()
 
// check the outcome
if (SCB->SHCSR & SCB_SHCSR_BUSFAULTPENDED_Msk) {
 // erase the sector here
}
 
// reset
 __enable_fault_irq();
 __DSB();
SCB->SHCSR &= ~SCB_SHCSR_BUSFAULTENA_Msk;

However this does not work - the fault is prevented correctly but the pending bit is never set and I don't seem to have anyway to detect that a bus fault would have occurred

What am I missing? Or am I totally barking up the wrong tree?

This topic has been closed for replies.

1 reply

Bubbles
ST Employee
November 15, 2022

Hello @APipe.2​,

not CRC but ECC.

The bus fault is a result of 2-bit error in the program memory, the ECC can handle 1-bit errors. Most of the time one error exists in the flash word before a second bit goes bad. So here I'd recommend to enable the 1-bit error interrupt (ECCC) and try fixing the problem before it escalates to ECCD - two bit error detection.

BR,

J

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.