2011-06-20 03:31 AM
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-stm32f2x2011-06-20 08:39 AM
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.html2011-06-20 09:05 AM
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, Johannes2011-06-20 10:04 AM
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.