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.

TMS320F28379D: Help with Intrerrupt nesting in F28379D

Part Number: TMS320F28379D

Hi,

I have a working closed loop vector control code using the new functions approach header files. I am using EPWM1 INT to compute the control code and EPWM6 INT to update-settings.

I want to implement interrupt nesting where EPWM1 INT could be called whille EPWM6 INT is ongoing.

I am looking the sample exmaples which mainly used the register based approach but I am having difficulty accessing the PieCtrlRegs. I get error of PieCtrlRegs not define as expected. I couldnt find it address to use directly without any header files and adding the register based header files causes a lot of errors.

What is the best way to implement this? (looking to solve errors related to undefine PieCtrlRegs)

Sample code: (any suggestions or potential issues are welcome)

__interrupt void epwm6ISR(void)
{
    //added extra code for interrupt nesting
    uint16_t TempPIEIER;
    TempPIEIER=PieCtrlRegs.PIEIER3.all;  //ERROR
    IER |= 0x003;   // Set global priority by adjusting IER
    IER &= 0x003;
    PieCtrlRegs.PIEIER3.all &= 0x0001;    //ERROR// Set group priority by adjusting PIEIER3 to allow INT3.1 to interrupt current ISR
    PieCtrlRegs.PIEACK.all = 0xFFFF;      //ERROR// Enable PIE interrupts
    asm("       NOP");                    // Wait one cycle
    EINT;

    //added extra code for interrupt nesting

    GPIO_writePin(22,1);  // GPIO pin to check code computation time


    //UPDATE OF SETTINGS AND PARAMETERS |||| MOVE TO SLOWER FUNCTIONS LATER
     update_allsettings(); //update filter settings

     //
    // Clear INT flag for this timer
    //
    EPWM_clearEventTriggerInterruptFlag(EPWM6_BASE);

    //
    // Acknowledge interrupt group
    //
    Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP3);

    //DEVICE_DELAY_US(5);

    GPIO_writePin(22,0);  // GPIO pin to check code computation time

    //GPIO_togglePin(24); //gpio 24 PIN 34
    //GPIO_togglePin(16); //gpio 16 PIN 33

    //added extra code for interrupt nesting


    //added extra code for interrupt nesting
    DINT;
    PieCtrlRegs.PIEIER2.all = TempPIEIER; //ERROR
    added extra code for interrupt nesting

}

 

image.png

 

 

  • Added definition and piectrl header file:

    #include "UserPieCtrl.h"
    #ifdef __cplusplus
    #pragma DATA_SECTION("PieCtrlRegsFile")
    #else
    #pragma DATA_SECTION(PieCtrlRegs,"PieCtrlRegsFile");
    #endif
    volatile struct PIE_CTRL_REGS PieCtrlRegs;

    Modified working code: (EPWM1 INT nested withing EPWM6 INT)

    __interrupt void epwm6ISR(void)
    {
    GPIO_writePin(22,1); // GPIO pin to check code computation time

    EPWM_clearEventTriggerInterruptFlag(EPWM6_BASE);
    //EPWM_clearEventTriggerInterruptFlag(EPWM6_BASE);
    Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP3);
    //added extra code for interrupt nesting

    uint16_t TempPIEIER;
    TempPIEIER=PieCtrlRegs.PIEIER3.all;

    //tempvecvar[0]= TempPIEIER;
    IER |= 0x004; // Set global priority by adjusting IER
    IER &= 0x004;
    //tempvecvar[1]=IER;
    //tempvecvar[2]=PieCtrlRegs.PIEIER3.all;
    PieCtrlRegs.PIEIER3.bit.INTx1 = 1; // Set group priority by adjusting PIEIER3 to allow INT3.1 to interrupt current ISR
    //Interrupt_enable(INT_EPWM1);
    //tempvecvar[3]=PieCtrlRegs.PIEIER3.all;
    //PieCtrlRegs.PIEACK.all = 0xFFFF; // Enable PIE interrupts
    asm(" NOP"); // Wait one cycle
    EINT; //enable global interrupts for nesting
    //added extra code for interrupt nesting


    //UPDATE OF SETTINGS AND PARAMETERS |||| MOVE TO SLOWER FUNCTIONS LATER
    update_allsettings(); //update filter settings
    //
    // Clear INT flag for this timer
    //

    //added extra code for interrupt nesting
    DINT; //disable global interrupts again
    PieCtrlRegs.PIEIER3.all = TempPIEIER;
    //added extra code for interrupt nesting

    GPIO_writePin(22,0); // GPIO pin to check code computation time

    }