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.

Compiler/TMS320F28379D: what is the Difference between USER_ISR and mainISR Functions

Part Number: TMS320F28379D
Other Parts Discussed in Thread: MOTORWARE, C2000WARE

Tool/software: TI C/C++ Compiler

Hi,

   when i was gothrough the example codes  , seen the  "mainISR" function in motorware examples and "USER1_ISR" in C2000ware Default ISR file . What is the difference between them?

when and where  will use it ?

Thanks in advance.

  • Hi Rani,

    Both are just interrupt function name. You can rename these function names to any name you like. 

    FYI. MotorWare software package is for InstaSPIN-FOC/Motion solution with F2802x/05x/06x. If you are targeting motor application with F2837x, you can refer to the MotorControl SDK. You can also find many examples in C2000Ware for C2000 peripherals.

    Regards,

    Steve  

  • Hi steve,

       Both are interrupts but implementation procedure are varying i thnik so.

      1. mainISR

    #ifdef FLASH
    #pragma CODE_SECTION(mainISR,"ramfuncs");
    #endif
    #ifdef FLASH
    // Used for running BackGround in flash, and ISR in RAM
    extern uint16_t *RamfuncsLoadStart, *RamfuncsLoadEnd, *RamfuncsRunStart;
     memCopy((uint16_t *)&RamfuncsLoadStart,(uint16_t *)&RamfuncsLoadEnd,(uint16_t *)&RamfuncsRunStart);



    2.USER1_ISR

     Interrupt_register(INT_USER1, &USER1_ISR);


        //
            // Enable interrupts required for this example
            //
        Interrupt_enable(INT_USER1);
        // Code for raising user interrupts:

         __asm(" TRAP #20");    // This will raise USER1 interrupt. 20 is the vector id

    So, Trap is highest priority interrupt(Software interrupt) while we call __asm( TRAP#20) it occurs , function is working  .what  about main ISR  , when its interrupts  will occurs ? and How? when we will go for mainISR?

  • Rani,

    mainISR() is a callback function of ADC interrupt. mainISR() is assigned to ADCINT1 interrupt vector table by calling HAL_initIntVectorTable() below. In the MotorWare, ePWM triggers ADC SOC at counter zero. In other words, at every zero counter, ADC automatically starts conversion and generate ADCINT at the end of conversion. You can see more details in InstaSPIN-FOC and MOTION Users Guide(SPRUHJ1) Chapter 8 and 9.

    //---------------------------------------------------------------------------------

    static inline void HAL_initIntVectorTable(HAL_Handle handle)
    {
        HAL_Obj *obj = (HAL_Obj *)handle;
        PIE_Obj *pie = (PIE_Obj *)obj->pieHandle;

        ENABLE_PROTECTED_REGISTER_WRITE_MODE;

        pie->ADCINT1 = &mainISR;

        DISABLE_PROTECTED_REGISTER_WRITE_MODE;

        return;
    } // end of HAL_initIntVectorTable() function

    //---------------------------------------------------------------------------------

    Regards,

    Steve

  • Thanks a lot Steve Lim. I have understand the mainISR now.