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.

level interrupts in motorware_12

Other Parts Discussed in Thread: MOTORWARE

hi:

I don't know why motorware use ADCINT at group10 interrupts verctor. should be at group1?

when I changed cpuHandle,CPU_IntNumber_10) in  HAL_enableAdcInts() to  

CPU_enableInt(obj->cpuHandle,CPU_IntNumber_1);  ,

It doesn't work!  I want chang this ,because I will use other interrupts  in motorware.

Till know , I haven't success configurated PWM_TZINT. any way I try!——

who can tell me how can I use interrupts in motorware12!F28069M

thanks!

  • Till now , I haven't success configurated PWM_TZINT. any way I try!——

  • Yanzhen,

    There are two options for these interrupts.  Group 1 only has ADCINT1, ADCINT2, and ADCINT9.  Group 10 has all 8 ADC interrupts.  Motorware is designed to use group 10 because they need to use all of the different ADC interrupts.  Certainly if you need three high priority ADC interrupts you should use group 1.

    You are looking in the right place.  CPU_enableInt needs to be changed as you have already done, but PIE_enableAdcInt also needs to be changed.  If you dig a little deeper you would find that in /drivers/adc/src/32b/f28x/f2806x/adc.h there are high priority interrupt enumerations that you can use to replace ADC_IntNumber1.  Try using ADC_IntNumber_1HP.

    BR,

  • hi:BR

    In motorware , mainISR() should be highest level interrupt in system. because, other peripherals should use lower interrupts resouce.

     I remember it uses group1 in controlsuit . so I need detail process how chang.

    In motorware. other peripherals configurations API less can used. so I must establish them myself. . It hard to me...

    last post I want use PWM_TZINT.  .but fail. In the future I will use SCI. I2C. or capture interrupt. I must know how to use interrupt in motorware. so....I want to know why I was fail..where was wrong!

    can you do PWM_TZINT .? if it is ok. show me!

  • Hi: Tray

    I changed these:

    void HAL_enableAdcInts(HAL_Handle handle)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;


      // enable the PIE interrupts associated with the ADC interrupts
      PIE_enableAdcInt(obj->pieHandle,ADC_IntNumber_1HP);


      // enable the ADC interrupts
      ADC_enableInt(obj->adcHandle,ADC_IntNumber_1HP);


      // enable the cpu interrupt for ADC interrupts
      CPU_enableInt(obj->cpuHandle,CPU_IntNumber_1);

      return;
    } // end of HAL_enableAdcInts() function

    and:

     // acknowledge the ADC interrupt
      HAL_acqAdcInt(halHandle,ADC_IntNumber_1HP);

    but It doesn't work!

    where place do I need chang also ?

  • and:

    static inline void HAL_acqAdcInt(HAL_Handle handle,const ADC_IntNumber_e intNumber)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;


      // clear the ADC interrupt flag
      ADC_clearIntFlag(obj->adcHandle,intNumber);


      // Acknowledge interrupt from PIE group 10
      PIE_clearInt(obj->pieHandle,PIE_GroupNumber_1);

      return;
    } // end of HAL_acqAdcInt() function

  • Hello Yanzhen Fu,

    Please try:

    void HAL_enableAdcInts(HAL_Handle handle)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;


      // enable the PIE interrupts associated with the ADC interrupts
      PIE_enableAdcInt(obj->pieHandle,ADC_IntNumber_1HP);


      // enable the ADC interrupts
      ADC_enableInt(obj->adcHandle,ADC_IntNumber_1);


      // enable the cpu interrupt for ADC interrupts
      CPU_enableInt(obj->cpuHandle,CPU_IntNumber_1);

      return;
    } // end of HAL_enableAdcInts() function

    Also you need to modify the code inside HAL_acqAdcInt() -> I saw that you have modified it.

    But please call  HAL_acqAdcInt(halHandle,ADC_IntNumber_1); instead of   HAL_acqAdcInt(halHandle,ADC_IntNumber_1HP);

     

    Best regards,

    Maria

  • hi; Maria.

    thanks your reply. but It doesn't work either. I use hv_kit  try it . I don't know why . can you try it?

  • yes,Maria.

    I have done. I changed :

    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;
      pie->ADCINT_1HP = &mainISR;

      DISABLE_PROTECTED_REGISTER_WRITE_MODE;

    return;

    }

    thanks !

    How about PWM_TZINT? I need API.

  • yanzhen fu said:
      pie->ADCINT_1HP = &mainISR;

    I think you should keep it as pie->ADCINT1 = &mainISR;

     

    Anyway, I will try next week and let you know.

    Best regards,

    Maria

  • Hello Yanzhen Fu,

    I have tried to use ADC Int from PIE group 1 (not 10), and I can see that gLEDcnt in expression window (that is put in mainISR) are changing (which means the interrupt occurs). I used my own board (not the controlCard) so I can not see the LED blinking or not (but I am sure it is).

    The modifications are:

    hal.c

    void HAL_enableAdcInts(HAL_Handle handle) {
        HAL_Obj *obj = (HAL_Obj *) handle;

        // enable the PIE interrupts associated with the ADC interrupts
        //PIE_enableAdcInt(obj->pieHandle, ADC_IntNumber_1);
        PIE_enableAdcInt(obj->pieHandle, ADC_IntNumber_1HP);     // for testing ADC int

        // enable the ADC interrupts
        ADC_enableInt(obj->adcHandle, ADC_IntNumber_1);

        // enable the cpu interrupt for ADC interrupts
        //CPU_enableInt(obj->cpuHandle, CPU_IntNumber_10);
        CPU_enableInt(obj->cpuHandle, CPU_IntNumber_1); // for testing ADC int

        return;
    } // end of HAL_enableAdcInts() function

    hal.h

    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;
      pie->ADCINT_1HP = &mainISR;    // for testing ADC int

      DISABLE_PROTECTED_REGISTER_WRITE_MODE;

      return;
     } // end of HAL_initIntVectorTable() function

    static inline void HAL_acqAdcInt(HAL_Handle handle,const ADC_IntNumber_e intNumber)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;


      // clear the ADC interrupt flag
      ADC_clearIntFlag(obj->adcHandle,intNumber);


      // Acknowledge interrupt from PIE group 10
     // PIE_clearInt(obj->pieHandle,PIE_GroupNumber_10);
      PIE_clearInt(obj->pieHandle,PIE_GroupNumber_1); // for testing ADC int

      return;
    } // end of HAL_acqAdcInt() function

    If you have done the same, I don't have any idea why these modifications don't work in your board.

    Hope you can figure it out (ah, sorry, I misunderstood, seems that you have made this working, that's great!)

    Also I have another ISR (SCI and timer2) beside mainISR and they works fine.

    I will try about the TZ interrupt.

    Best regards,

    Maria

  • I have tried PWM TZ interrupt and the answer is in your previous thread: http://e2e.ti.com/support/microcontrollers/c2000/f/902/t/337490.aspx

    Best regards,

    Maria

  • hi : maria

    thanks your testing!

    I try TZ interrupt. like these

       // enable the TZ1 interrupts
       HAL_enableTz1Ints(halHandle);

    in Hal.c:

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

     // enable the PIE interrupts associated with the TZ1 interrupts
     PIE_enableTzInt(obj->pieHandle,PWM_Number_1);     //PWM_Number_1=0;

     // enable the Tz interrupts
     Tz_enableInt(obj->pwmHandle[PWM_Number_1]);

    //  PWM_enableTripZoneSrc(obj->pwmHandle[PWM_Number_1],PWM_TripZoneSrc_OneShot_TZ1_NOT);

        // enable the cpu interrupt for EPWM1_TzINT
        CPU_enableInt(obj->cpuHandle,CPU_IntNumber_2);

    return;

    }

    in pie.c:


    void PIE_enableTzInt(PIE_Handle pieHandle,const  PWM_Number_e pwmNumber)   //新增
    {
       PIE_Obj *pie = (PIE_Obj *)pieHandle;
       uint16_t index = 1;
       uint16_t setValue = (1 << pwmNumber);


       // set the value
       pie->PIEIER_PIEIFR[index].IER |= setValue;

       return;
    }

    In pwm.c :

    void Tz_enableInt(PWM_Handle pwmHandle)
    {
     PWM_Obj *pwm = (PWM_Obj *)pwmHandle;
     ENABLE_PROTECTED_REGISTER_WRITE_MODE;

     //set the bits
     pwm->TZEINT |= 0x04;

     DISABLE_PROTECTED_REGISTER_WRITE_MODE;


     return;
    }

    In Hal.h:

    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->ADCINT_1HP = &mainISR;


      DISABLE_PROTECTED_REGISTER_WRITE_MODE;
     
      ENABLE_PROTECTED_REGISTER_WRITE_MODE;

      pie->EPWM1_TZINT =&ipmISR;

      DISABLE_PROTECTED_REGISTER_WRITE_MODE;

      return;
     } // end of HAL_initIntVectorTable() function

    in mymain.c:

    interrupt void ipmISR(void)    //变频器硬件故障
    {
      HAL_Obj *obj1 = (HAL_Obj *)halHandle;
       // close 244
       GPIO_setLow(obj1->gpioHandle,GPIO_Number_17);

       HAL_acqTzInt(halHandle,PWM_Number_1);

    }

    In Hal.h:

    static inline void HAL_acqTzInt(HAL_Handle handle,const PWM_Number_e pwmNumber)
    {
     HAL_Obj *obj = (HAL_Obj *)handle;
     TZ_clearIntFlag(obj->pwmHandle[pwmNumber]);
       // Acknowledge interrupt from PIE group 2
        PIE_clearInt(obj->pieHandle,PIE_GroupNumber_2);

    }

    In pwm.h:

    static inline void TZ_clearIntFlag(PWM_Handle pwmHandle)
    {
     PWM_Obj *pwm = (PWM_Obj *)pwmHandle;

     //set the bits
     pwm->TZCLR = PWM_TZCLR_INT_BITS;
     pwm->TZCLR = PWM_TZCLR_OST_BITS;

     return;

    }

    in main.h:

    interrupt void mainISR(void);
    interrupt void ipmISR(void);

    in hal.h:

    extern void HAL_enableTz1Ints(HAL_Handle handle);

    in pwm.h:

    //! \brief    Enables the TZ interrupt
    extern void Tz_enableInt(PWM_Handle pwmHandle);

    end,

    but it doesn't work. !

    Yanzheng

    thanks!

     

     

     

     

  • oh: let me look and try. thanks maria.!

  • Hello Yanzhen Fu,

    I am not sure why it doesn't work.

    But please try these modifications:

    1. hal.c

    void HAL_enableTz1Ints(HAL_Handle handle)
    {
     HAL_Obj *obj = (HAL_Obj *)handle;
     PIE_Obj *pie = (PIE_Obj *)obj->pieHandle; // delete this

     // enable the PIE interrupts associated with the TZ1 interrupts
     PIE_enableTzInt(obj->pieHandle,PWM_Number_1);     //PWM_Number_1=0;

     // enable the Tz interrupts
     Tz_enableInt(obj->pwmHandle[PWM_Number_1]);

    //  PWM_enableTripZoneSrc(obj->pwmHandle[PWM_Number_1],PWM_TripZoneSrc_OneShot_TZ1_NOT);

        // enable the cpu interrupt for EPWM1_TzINT
        CPU_enableInt(obj->cpuHandle,CPU_IntNumber_2);

    return;

    }

    2. pwm.h

    static inline void TZ_clearIntFlag(PWM_Handle pwmHandle)
    {
     PWM_Obj *pwm = (PWM_Obj *)pwmHandle;

     ENABLE_PROTECTED_REGISTER_WRITE_MODE;

     //set the bits
     pwm->TZCLR |= PWM_TZCLR_INT_BITS;
     pwm->TZCLR |= PWM_TZCLR_OST_BITS;

    DISABLE_PROTECTED_REGISTER_WRITE_MODE;

     return;

    }

    3. pie.h, add

    extern void PIE_enableTzInt(PIE_Handle pieHandle,const  PWM_Number_e pwmNumber);

    4. hal.h, add

    extern interrupt void mainISR(void);
    extern interrupt void ipmISR(void);

     

    5. And in what line that you put this HAL_enableTz1Ints(halHandle); ?

    Please try to put it in your main after:

    // setup faults
        HAL_setupFaults(halHandle);

     

    Best regards,

    Maria