2025-11-16 9:18 PM - edited 2025-11-16 9:31 PM
Hi I am trying to migrate my code from SPL(old version) to HAL based code I have conveted the same setup code to cubemx to generate the init function and I am using a clrc663 IC(card reader) along with it when the Ic Generates an interupt the mcu doesnt process the interuppt but when using test case using software to check the interupt handler it works but when the pin goes from high to low but there is no interupt happening. can anyone explain why it is not working.
mcu->spi & interupt ->clrc663
DBG: TCONTROL read=0x00
state 1 = HIGH
DBG: Write IRQ1EN st=0x0000 write=0xC2 read=0xC2
DBG: IRQ1 cleared
state 2 = HIGH
DBG: TCONTROL written start=0x33
state 1 = LOW
DBG: Before WaitIrq
DBG: MCU IRQ pin after RC663 GLOBALIRQ = LOW
these are the debug outpur ihave used a print statement inside the interupt handle but it is not printed
2025-11-16 10:16 PM
> ... ihave used a print statement inside the interupt handle ...
Which is almost always a bad idea.
Check the implementation of of the debug print function, it surely messes up the timing of your application, blocking other interrupts because it uses interrupts itself.
> ... the Ic Generates an interupt the mcu doesnt process the interuppt but when using test case using software to check the interupt handler it works but when the pin goes from high to low but there is no interupt happening. can anyone explain why it is not working.
Probably not, because your description is not very comprehensible.
Either try to validate your code in steps, as a stop in the debugger most probably breaks up the sequence.
Or, when trying in real-time, take care not to modify the application timing, as debug prints will surely do.
2025-11-16 10:24 PM
but when i use the software testing code the interupt works fine even if i take out the print statements and only place one insisde the handler it still doesnt work.
The IC generates the transition I can tell it for sure because in the middle of the code I have placed program to check the state of the pin and print it the pin only transitions after start signal is send to ic to start timer and the timer sends irq once completed
2025-11-17 2:23 AM
Have you verified that the interrupt is actually enabled?
Is the handler being called?
@naveen-0 wrote:can anyone explain why it is not working.
We can't see your system or your code - so, no.
@naveen-0 wrote:when using test case using software
Unclear what you mean by that.
How to write your question to maximize your chances to find a solution.
2025-11-18 1:26 AM - last edited on 2025-11-18 1:49 AM by Andrew Neil
yes the inerupt is beign enable crorrectly and the handler is working fine if i use
__HAL_GPIO_EXTI_GENERATE_SWIT(GPIO_PIN_9);
both the EXTI9_5_IRQHandler and HAL_GPIO_EXTI_IRQHandler works but when the ic is sending the irq
the irq handler is not waking up the pin is beign pulled down correctly.
GPIO_InitStruct.Pin = GPIO_PIN_9;
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
GPIO_InitStruct.Pull = GPIO_PULLUP;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
HAL_NVIC_SetPriority(EXTI9_5_IRQn, 0, 2);
HAL_NVIC_EnableIRQ(EXTI9_5_IRQn);this is the pin config for irq the same config is used for my SPL code(old)
Edited to apply source code formatting - please see How to insert source code for future reference.
2025-11-18 1:50 AM
Your descriptions are still hard to follow.
Please post a minimum but complete example which illustrates the issue.
2025-11-18 2:00 AM
> both the EXTI9_5_IRQHandler and HAL_GPIO_EXTI_IRQHandler works but when the ic is sending the irq
the irq handler is not waking up the pin is beign pulled down correctly.
The wording suggests you don't fully understand the issue at hand.
Enabling an EXTI interrupt for a specific pin is one thing.
You need to check if the respective interrupt is really raised, and the proper handler called.
And more importantly, most STM32 MCUs have one EXTI interrupt handler responsible for several lines, usually GPIOs with the same index (like PA1, PB1, PC1).
Check you linked to the proper interrupt handler by setting a breakpoint there and applying the appropriate signal.