2015-09-13 07:56 AM
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? Thank2015-09-13 08:05 AM
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.
2015-09-13 02:00 PM
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 ISRI 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))hmmmwhile 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 12now after resetting, using the RST-Button most of the times the LED stays off, sometimes it blinks2015-09-13 02:42 PM
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