This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Visiting XINT interrupt twice

Hi,

Please help to understand and debug the following behavior.

I have a XINT interrupt triggered by external GPIO.

During the debug session, I have a break point inside this interrupt.

I am generating the interrupt touching the associated GPIO pin with 3v wire.

Debugger stops on my breakpoints, but when clicking NEXT it stops on the same breakpoints again. Only when clicking next second time the flow continues to its normal behavior.

Can this be related to the bouncing during my wire touch?

I am using the following input Qualification parameters:

GpioCtrlRegs.GPAQSEL1.bit.GPIO0 = 1;  - changing it to 2 did not help
GpioCtrlRegs.GPACTRL.bit.QUALPRD0 = 0xFF;

Other idea?

I need no ensure that this interrupt is visited only once after it is triggered

Thanks

  • Hi Alex,

    Please add a flag inside ISR after breakpoint and check if the value of flag changes when you hit fisrt RUN after execution stops at breakpoint.

    Is the ISR in RAM or Flash? Also which version of CCS you are using?



    Regards,
    Vivek Singh
  • Hi Vivek,

    I am using CCS v6 and the code is placed in RAM.

    My code looks like this:
    interrupt void xint1_isr(void)
    {
        GpioDataRegs.GPASET.bit.GPIO9 = 1;  (breakpoint)
        if (fault_counter <32000) fault_counter++;

    ........

    When the code is first stops at the breakpoint the fault_counter is 0. After I click Resume (F8), the fault_counter in increased to 1 and the code stops again at the same breackpont. Next click on F8 the counter is increased one more time and the code proceeds to its normal run outside the ISR.

    BTW, same exercise, but using F5 instead of F8 works as expected - the counter is increased only once and the code continues to it's normal operation step by step, but then when I want to resume it to run continuously by clicking F8 it goes back to the ISR.

    Hope the explanation is clear 

  • Alex,

    From this it look like GPIO is seeing two toggle. Instead of touching the wire to 3.3 V, you could connected the XINT to another GPIO pin and drive that GPIO from code itself.

    Regards,

    Vivek Singh
  • Hi Vivek,

    Your suggestion work fine, but in the real life I will need to use a button to generate this.

    So maybe there is a software solution for a kind of one-shot implementation to prevent this double XINT1 visiting?

    Thanks

  • Hi Alex,

    When you use the switch, transition will be clean and should not cause multiple active toggle on line so you'll not see IInd interrupt. To check this is indeed issue because of multiple toggles on line, you can set breakpoint inside ISR and once code stops at breakpoint, check the status of corresponding flag in PIEIFR register in CCS register view (or in expression view by using "PieCtrlRegs" structure name). If you find it to be set ('1') then it means there is another pending interrupt on this line though you have only touched the wire once. If you clear this bit (by writing '0' to this bit field in register view or expression view) then you'll not get the IInd unwanted interrupt.

    You could do same (clear the PIEIFR bit inside ISR) in SW as well (if you think transition with switch also may create multiple active toggle) but there is a potential risk of clearing some other interrupt flag bit in same register while clearing this one (due to Read-Modify-Write operation). If you are not using any other interrupt in that PIE group then that should be fine.

    Regards,

    Vivek Singh
  • Hi Vivek,
    Thanks. This solution is fine for my needs.