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.

Unwaited interrupt

Hello,

I'm working on a F28377D.

I started with the simple demonstration code IDDK_PM_Servo_F2837x to control a broshless motor.

All work correctly,

I add on this project the generic Slave Stack Code for EtherCAT and make some adaptation to compile on my target.

Since that, I have an expected ISR and I not find the source.

In fact, the ADCA1_ISR is called on F2837_D_DefautISR.c file, but this interrupt is masked.

So the "ESTOP0" instruction implemented in this default file make stop my debuger..

You can seen when I stopped in this function, the corresponding flag is not set (Ack ADN PIEIER1)!! but PIECTRL.PIEVECT is 0x0d41 then correspond to ADCA1 isr...

I don't find a way or solution to determine why I'm here.

Have you an Idea or a way which will help me to find my problem? some other registrer to see will help me to understand what append...?

Thank

  • yeah, this seems weird. Is PIEIER1 enabled at any point in your code and is ADCA1 set-up at any point in your code?
    does the problem happen at the same point always? Can you check your code if you are configuring PIE twice? what happens if you do not enable INT4?

    PIE VECT shows 0xD40 (INT1)
    PIE ACK for INT1 is set
    PIEIFR and PIEIER for INT4 is set.


    Best Regards
    Santosh Athuru
  • Hello

    Sorry for the late, I'm was in vacation.

    I used the INT4 for XINT1 to get an external signal interrupt from an EtherCAT controller.

    My Init code is like following:

    PieVectTable.XINT1_INT = &EscIsr;

    PieCtrlRegs.PIEIER1.bit.INTx3 = 1; // Enable ADCC1INT in PIE group 1
    PieCtrlRegs.PIEIER1.bit.INTx4 = 1; // Enable PIE Group 1 INT4 (for XINT1)

    IER |= M_INT1; // Enable group 1 interrupts
    EINT; // Enable Global interrupt INTM
    ERTM; // Enable Global realtime interrupt DBGM
    EDIS;

    // GPIO69 are inputs
    EALLOW;
    GpioCtrlRegs
    .GPCMUX1.bit.GPIO69 = 0; // GPIO
    GpioCtrlRegs.GPCDIR.bit.GPIO69 = 0; // input
    GpioCtrlRegs.GPCQSEL1.bit.GPIO69 = 0; // XINT1 Synch to SYSCLKOUT only
    EDIS;

    // GPIO69 is XINT1
    GPIO_SetupXINT1Gpio(69);

    // Configure XINT1
    XintRegs.XINT1CR.bit.POLARITY = 0; // Falling edge interrupt

    // Enable XINT1
    XintRegs.XINT1CR.bit.ENABLE = 1; // Enable XINT1

     

    Then I use a generic stack which allow to dialog with an external EtherCAT controller (Beckhoff ET1100).

    This stack is called SSC for Slave Stack Code and the link with extarnal controller is via the SPI.

    To work correctly, we need to disable sometime the external interrupt from this controller (during SPI Read/Write access)

    Then the following macro is used:

    #define DISABLE_ESC_INT() (PieCtrlRegs.PIEIER1.bit.INTx4 = 0)
    #define ENABLE_ESC_INT() (PieCtrlRegs.PIEIER1.bit.INTx4 = 1)

    With this code, I have the trouble explain on my first post.

    Then I try two things:

    1) May be the access to PieCtrlRegs.PIEIER1.bit.INTx4 is composed by many assembler instruction , then maybe we are interrupted between them and cause problem.

    So I try following:

    #define DISABLE_ESC_INT() DINT;(PieCtrlRegs.PIEIER1.bit.INTx4 = 0);EINT;
    #define ENABLE_ESC_INT() DINT;(PieCtrlRegs.PIEIER1.bit.INTx4 = 1);EINT;

    But problem still present.

     

    2) So I try following:

    #define DISABLE_ESC_INT()
    #define ENABLE_ESC_INT()

    This is radical and can cause problem for my Read/write on SPI access!

    So with this, ADCA1_ISR interruption not occurs, problem dessapears!.

     

    3) I had also tested the following solution which work:

    #define DISABLE_ESC_INT() (XintRegs.XINT1CR.bit.ENABLE = 0)
    #define ENABLE_ESC_INT() (XintRegs.XINT1CR.bit.ENABLE = 1)

    I'm not able to know which is the beter solution between  Enable/Disable Xint or Pier Xint4? (If we forget the problem with the last solution...)

     

    An idea..?

  • Ok

    According the Reference Manual §2.4.2.2 PIE Stage p90 (SPRUHM8E - December 2013 - Revised September 2015) it is say  the PIE returns the vector for channel 1.

    This append if  Enable Flag is clear while Interrupt is propagating.

    So I should respect the procedure indicated on $2.4.4.3....