2020-02-14 11:45 AM
I use STM32CUBEMX 5.5.0 create code for Nucleo-G474RE, when I set PIN PC2 to GPIO_EXTI2, after create code, the code didn't create correct code, only create two lines for EXTI15_10_IRQn, how EXTI15_10_IRQn can handle PC2?
2020-02-15 01:27 AM
EXTI15_10_IRQn can't handle PC2/EXTI2, but EXTI2_IRQHandler() can.
Clear the pending flag in EXTI->PR1, and do whatever you want to do in the handler.
void EXTI2_IRQHandler() {
EXTI_PR1 = EXTI_PR1_PIF2;
/* user code goes here */
}
Of course as CubeMX failed to generate code for the interrupt handler, you cannot assume it has managed to generate correct code for the rest (you should never trust generated code, CubeMX fails at it more often than not), so the first thing you should do is to verify with a debugger whether the interrupt handler above is actually called. If not, verify the following registers
2020-02-18 03:28 PM
Hello Berendi,
Thank you very much for this information!
I use one STM32Cube example code change as you noticed, it is work, but still something wrong, the EXTI-PR1 can't clear for some reason.
The NVIC in ST document is very badly, I check ARM CM4 program manual , looks I need set more NVIC register, I did set NVIC->ICER[0], the EXTI->PR1 still keep.
Regards,
Richard
2020-02-19 01:54 AM
The flag in NVIC should be cleared by hardware when EXTI->PR1 is cleared in the interrupt handler.
Verify that the bits for EXTI2 in SYSCFG->EXTICR are set for PC2, and check the signal on the pin for noise.
2020-02-19 11:09 AM
Hello Berendi,
I set GPIO with PU, (I use falling interrupt) it is better.
But there are two question I can't fig out:
Attached my test file.
2020-02-19 11:10 AM