Skip to main content
danieljohansson9
Associate
June 20, 2011
Question

How to Enable BusFault, MemManage Interrupts

  • June 20, 2011
  • 3 replies
  • 2119 views
Posted on June 20, 2011 at 12:31

Hi,

Is it neccessary to do something to enable BusFault and MemManage Interrupts, or are these active as per default?

I.e. the HardFault interrupt is always enabled, the only thing I need to do is add a HardFault_Handler

But is the same true for BusFault? Or Do I need to do a NVIC_Init for BusFault_IRQn, UsageFault_IRQn etc.

The UsageFault_IRQn has a definition of -10, which looks not to be suitable for the ''NVIC_Init'' function.

The documentation does specify UsageFault_IRQn and BusFault to be settable priority, so perhaps this indicated that they are not always enabled and should be done so by user code?

#stm32f1x-stm32f2x
This topic has been closed for replies.

3 replies

Tesla DeLorean
Guru
June 20, 2011
Posted on June 20, 2011 at 17:39

You're right NVIC_Init is not how to handle system interrupts.

You'd typically use NVIC_SystemHandlerConfig(), NVIC_SystemHandlerPriorityConfig() from the older library, or NVIC_SetPriority() from the newer ones.

Cortex-M3 System Handler Priority (SHP)

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0552a/CIAGECDD.html

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
js23
Associate III
June 20, 2011
Posted on June 20, 2011 at 18:05

For devices with MPU the following is necessary to enable MemManage fault:

SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk;

I am not sure if you will ever get a MemManage fault, if MPU is not available/active.

I guess for BusFault, addtionally SCB_SHCSR_BUSFAULTENA_Msk might have to be set (altough I thought I already run into some BusFaults - isn't it enabled by default?)

Regards,

Johannes
Tesla DeLorean
Guru
June 20, 2011
Posted on June 20, 2011 at 19:04

Yeah, I'm pretty sure it dumps all the stuff not explicitly handled into the Hard Fault handler as a last resort.

Given it's all going to be pretty catastrophic at that point, and unrecoverable without significant explicit case handling, decision making and processing, I'm not sure of the of the utility of doing much more than outputting/logging diagnostic information and restarting.

Doing any diagnostic output would be better than the examples, which grind in an infinite loop.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..