AnsweredAssumed Answered

Hard Fault in STM32CubeMX Generated Code

Question asked by Stephen on Aug 5, 2016
Latest reply on Aug 5, 2016 by Clive One
This is an STM32CubeMX 4.16.0 generated project. The  STM32CubeMX project file is attached. The processor is an STM32F373VCT6

I have a Hard Fault. Below is the call stack and register contents when the Hard Fault happened. It happens in STM32CubeMX generated code. I have suspicion it has something to do with TIM6, which is used to serve as the hardware ticker timer for FREERTOS. TIM6 was selected in an earlier version of STM32CubeMX. I no longer see where the hardware ticker timer is selected for FREERTOS. I only see that TIM6 is grayed out in Pinout tab.

This function is where it happened:
  NVIC->ISER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
Any help in fixing this would be appreciated.

HardFault_Handler() at Segger_HardFaultHandler.c:293 0x8006578    
<signal handler called>() at 0xfffffff1    
HAL_TIM_IRQHandler() at stm32f3xx_hal_tim.c:2,812 0x800d902    
TIM6_DAC1_IRQHandler() at stm32f3xx_it.c:255 0x801ae24    
<signal handler called>() at 0xfffffff9    
NVIC_EnableIRQ() at core_cm4.h:1,628 0x8017da0    
HAL_NVIC_EnableIRQ() at stm32f3xx_hal_cortex.c:237 0x8017da0    
HAL_InitTick() at stm32f3xx_hal_timebase_TIM.c:74 0x801aee0    
HAL_Init() at stm32f3xx_hal.c:165 0x8019de0    
main() at main.c:244 0x801b588    

HardFaultRegs.SavedRegs    struct {...}    {...}    
    r0    volatile unsigned int    0x20006ea8    
    r1    volatile unsigned int    0x0    
    r2    volatile unsigned int    0xfffffff7    
    r3    volatile unsigned int    0x0    
    r12    volatile unsigned int    0x0    
    lr    volatile unsigned int    0x801ae25    
    pc    volatile unsigned int    0x800d902    
    psr    union {...}    {...}    
        byte    volatile unsigned int    0x21000046    
        bits    struct {...}    {...}    
            IPSR    unsigned int    0x46    
            EPSR    unsigned int    0x10000    
            APSR    unsigned int    0x4