This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Interrupt problem = using External Interrupts

Hi,

I am trying to use External Interrupts in a program where I have already several active interrupts and modules.
It happens that after I make the pin description for this external interrupt, any of the VIC interrupts occur anymore?!?

GPIO_InitStructure.GPIO_Direction = GPIO_PinInput;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1; //lines 8 and 9
GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ;
GPIO_InitStructure.GPIO_IPConnected = GPIO_IPConnected_Enable; // HERE IS THE PROBLEM!!
GPIO_Init (GPIO5, &GPIO_InitStructure);

So if I use IPConnected enable the interrupt stop working, if I use disable the external interrupt doesn't work properly.
After reading about it, it looks that there is a error in the library according to the errata and ST sugest us to use a Dummy_handler:


void Dummy_Handler(void)
{
VIC0->VAR = 0xFF;
VIC1->VAR = 0XFF;
}


void VIC_InitDefaultVectors(void)
{
VIC0->DVAR = (u32)Dummy_Handler;
VIC1->DVAR = (u32)Dummy_Handler;
}

But for me still doesn't work.
Does anyone have a clue what is going on??

Thanks

  • Hello Milton,

    I would like to take the opportunity that you are working with external interrupts to tell you that I have a problem with them. I have connected a keyboard to P7 port. The problem is that the interrupts are launched two times: when I press the key and when I release it.
    Have you had the same problem any time?

    Thanks in advance.

  • Some chips can generate interrupts for both low-to-high and high-to-low pin changes.

    But there is another possibility: A keyboard switch can bounce on both press and release, and during the bounce produce several short high/low/high/low/... transitions where your interrupt may only be fast enough to pick up one interrupt for the press and one for the release - this even if your interrupt pin can only be trigged by one of high-to-low or low-to-high.

    Have you spent any time looking at the pin signal with an oscilloscope?

  • Some chips can generate interrupts for both low-to-high and high-to-low pin changes.
    Yes, I know. But you have to select in which case you want that the interrupt occurs.

    Have you spent any time looking at the pin signal with an oscilloscope?
    Yes, and the signal is normal. I have used a low pass filter to eliminate the bounces.

    And the Interrupt Service Routine launches two times. I donÂ't konw which can be the problem.

  • Hi, I have exactly the same problem as well and I don not use switches ... The interrupt is triggered two times for no reason.
    On top of this I work with a couple of interrupts dealing with the WIU interrupt witch only serve the first line in the handler ...

    void WIU_IRQHandler(void)
    {
    vu32 a=0;
    a= VIC1->VAR;
    
    if (WIU_GetITStatus(WIU_Line8)==SET)
        {
            ExtInt1Handler(1);
            WIU_ClearITPendingBit(WIU_Line8);
        }
    
    
    
    if (WIU_GetITStatus(WIU_Line9)==SET)
        {
            ExtInt1Handler(2);
            WIU_ClearITPendingBit(WIU_Line9);
        }
    
    /*write any value to VIC1 VAR*/
    VIC1->VAR = 0xFF;
    }
    
    

    Thanks

  • "Yes, I know. But you have to select in which case you want that the interrupt occurs."

    But some chips allow you to enable rising and falling edge interrupts at the same time. Then you will get one interrupt for press and one for release even if your external filter is perfect.

  • Hello Milton,

    How have you solved the problem of the two launches of the external interrupt?

    ************************

    Hello Per,

    But in my code I enable the interrupt only in the rising edge.