cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F411RE EXTI Interrupts without something attached

mratzenhofer9
Associate II
Posted on September 13, 2015 at 16:56

I encountered a strange behaviour on several STM32F411 nucleos: When configuring an EXTI for an input GPIO Pin the pending bit gets set, even though nothing is connected to the Pin.

Code is attached.

These two files are included into an example project of STM and no other files were changed.

I was trying to write a code that could detect which PS2-keyboard line is the clock-line and later on read in characters. Therefore I counted interrupts and after 33 occured the LED will be turned on. But the LED went on even before I pressed a key on the keyboard. After trying a lot of things I detached the keyboard, so the only cable to the board was the ST-Link-USB-cable, but still the LED did go on. I tried several different Pins, A0, A12 and C12 come to my mind now, but there also where some others including some from Port B, and every time the same thing happened. Debugging then showed that the Pending Bit gets set all the time, leading to a consistently run ISR. The time between the runs varies, when having a Break-Point at the beginning of the ISR and clicking Run immediatly after reaching it, it took between none to about 15 seconds until it stopped again. Therefore the time it took the LED varied too, but was never greater than one and a half minutes.

The only thing left I can think of is damaged hardware, but all programms not using EXTIs, as well as all programms using the USR-Button as EXTI (maybe due to the condenser connected) worked perfectly fine, and with some Pins only one interrupt occured, solving the problem by adding a EXTI_ClearITPendingBit directly after the EXTI-configuration.

Any ideas?

Thank

3 REPLIES 3
Posted on September 13, 2015 at 17:05

I would suggest that as part of your investigation, that you qualify the source of the interrupt before doing any action, and that you clear it early, not as the last thing you do before exiting, as this is a known NVIC hazard.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
mratzenhofer9
Associate II
Posted on September 13, 2015 at 23:00

thanks for the fast reply clive1, unfortunately I don't get exactly what you mean

did you mean checking whether the Line12 or another one is creating the interrupt? and I guess you meant clearing the pending bit first in the ISR

I therefore changed my ISR to this:

void EXTI15_10_IRQHandler(void)

{

if(EXTI_GetITStatus(EXTI_Line12) == SET) {

EXTI_ClearITPendingBit(EXTI_Line12);

GPIO_ToggleBits(GPIOA,GPIO_Pin_5);

}

}

but all it gives me a blinking LED or some VERY strange behaviour (not blinking, when I put my hand close it starts blinking (have made a video of it, but seems to be to big to upload it))

hmmm

while typing this it stopped this behaviour and doesn't start the ISR, stopping the programm in debug modus shows a set bit in the Interrupt Mask on EXTI line 12

now after resetting, using the RST-Button most of the times the LED stays off, sometimes it blinks

mratzenhofer9
Associate II
Posted on September 13, 2015 at 23:42

second try of uploading a video

now putting my hand close (not touching) only works on the left side of the board (filmed fom the top, so the video is side-inverted) and it works every single time I reset the yC, as soon as my hand is not near it doesn't blink

________________

Attachments :

MOV_0269_1_.mp4 : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0jc&d=%2Fa%2F0X0000000bd2%2FEf1ODwk.KWZE_60u5NJOcGcb2rpmhs8rk.PWaCxsDcg&asPdf=false