STM32 WWDG interrupt firing when not configured

前端 未结 8 1647
执念已碎
执念已碎 2021-02-12 14:51

I have an application that I am porting from the Keil IDE to build with the GNU toolchain due to license issues. I have successfully be able to set up, build, flash and run the

相关标签:
8条回答
  • 2021-02-12 15:19

    So thanks to the kick in the pants by D Krueger. I was able to figure out that the HardFault_Handler was what was actually being called. So, anyone that stumbles on this post, verify which IRQ is truly being called by writing temporary functions to cover the likely culprits i.e. HardFault. The true issue for the IRQ call is a bad memory access by memcpy which I am on my way to solving next.

    0 讨论(0)
  • 2021-02-12 15:28

    I had a very similar problem when merging two projects generated separately by STM32CubeMX for an STM32F2XX processor. One project was using the Ethernet peripheral, while the other was not. Besides that one difference, the two projects used the same set of peripherals.

    After integrating the two projects together by manually copying files, the application would end up in the WWDG_IRQHandler after starting the first task (when interrupts are enabled for the first time). I first confirmed that the WDGA bit of the WWDG register was indeed not set and, therefore, that the WWDG peripheral was disabled. Next, I verified that the interrupt vector table was initialized correctly. Finally, after several hours of digging, I realized that I had not defined the ETH_IRQHandler function in stm32f2xx_it.c, which provoked the Ethernet interrupt to be handled by the default handler, masking itself as the WWDG_IRQHandler -- likely due to optimization.

    0 讨论(0)
  • 2021-02-12 15:31

    I had exactly the same error as OP (apparent WWDG interrupt, but actually the HardFault_Handler firing) when porting an example for the STM32F3 Discovery board to compile in CooCox CoIDE 1.7.7 with STM32Cube F3 libraries (v1.1.0). The code ran fine as long as I didn't try using any interrupts, but as soon as I turned on the SysTick timer interrupt, the HardFault exception tripped.

    The problem was that I had neglected to include the stm32f3xx_it.h and stm32f3xx_it.c files in the project. Their absence wasn't causing any compiler warnings/errors. Once they were compiled & linked in, the code with interrupts ran fine.

    0 讨论(0)
  • 2021-02-12 15:31

    In my case, I had a function written in the GCC assembly that was migrated from the ARM assembly. The problem went away after I had added the .thumb_func line to the assembly file.

    I was getting this error:

    (gdb) c
    +c
    Continuing.
    
    Program received signal SIGINT, Interrupt.
    WWDG_IRQHandler () at ...startup_stm32f40_41xxx.s:121
    
    (gdb) bt
    #0  WWDG_IRQHandler () at ...startup_stm32f40_41xxx.s:12
    #1  <signal handler called>
    #2  RTOS_SysTick_Handler () at ...osKernel.s:18
    #3  <signal handler called>
    #4  0x0800021a in task0 () at ...main.cpp:10
    #5  0x08000214 in frame_dummy ()
    #6  0x00000000 in ?? ()
    

    RTOS_SysTick_Handler is a function written in assembly and the WWDG_IRQHandler was always triggered before any first assembly instructions in that function (tried different instructions and it didn't change anything).

    I was doing some tweaks around the C code and at some point, I hit another handler: UsageFault which led me to the .thumb_func hint: ARM Cortex M4 SVC_Handler "UsageFault".

    0 讨论(0)
  • 2021-02-12 15:35

    I've had this problem due to the same root cause as awilhite. I'm using Atollic TrueStudio 8.0.0. I used it to start a project for STM32F030 and (probably manually) added libraries folder with stm32f0xx.h, which defines ADC1_IRQn (IRQ channel number used in NVIC setup).

    And I implemented ADC1_IRQHandler(void) in my main.c (as I'm used to and it always worked so far -- x_IRQn -> x_IRQHandler)

    But after 2 days frustration, I found out, that startup_stm32f0xx.s in my project defines ADC1_COMP_IRQHandler.

    So, ultimately, my ADC interrupt handler was undefined and when the ADC generated the interrupt, the program crashed (WWDG interrupt).

    I hope this helps to people like me, who think they did implement their handler but in fact, they did not.

    0 讨论(0)
  • 2021-02-12 15:35

    The core problem is that the Default Handler is called instead of another irq handler. I doubt that our situations are the same but here is my solution:

    I was working on a c++ project, the same happened to me. This was the first time I made a project from scratch & with CMSIS. After some unsuccessful attempts I went through a generated project when I noticed that in the stm32xxxx_it.h the IRQ handler function prototypes are guarded by these:

    extern "C"
    {
        void TIM7_IRQHandler(void);
    }
    

    With these guards the linker could find my own interrupt handler functions.

    0 讨论(0)
提交回复
热议问题