I am trying to disable rising of BusFault exсeption for some piece of code. I suppose it's possible to make the exception rising flags, but not rising any kind of handlers. Descriprion of BFHFNMIGN bit in Programming manual (PM0214 p.230) looks exactly like the thing I'm looking for: "Enables handlers with priority -1 or -2 to ignore data bus faults caused by load and store instructions. <..>". That's my try:
SCB->SHCSR ^= SCB_SHCSR_BUSFAULTENA_Msk; //Disable only BusFault_Handler
SCB->CCR |= SCB_CCR_BFHFNMIGN_Msk; //Enable BFHFNMIGN
*(uint32_t *)(0x000FFFFE) = 0xAA; //Test if BFHFNMIGN flag works
i+=1; //Any stuff
I expect the execution to go further, but after the "any stuff" line the execution gets to the HardFault_Handler as if I haven't used BFHFNMIGN bit. With help of debugger I have checked by address that BFHFNMIGN bit is set and that there are all attributes of BusFault in other registers. So why doesn't the HardFault ignore the BusFault?