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.

TMS320F28069: Cannot get interrupts to work

Part Number: TMS320F28069
Other Parts Discussed in Thread: MOTORWARE

I am working on a motorware project and need to get interrupts working.  The first order of business is for me to get external interrupts working. The following code snippet looks like it should get the job done but no joy. I am following the procedure in the TRM for the 28069 while using the motorware calls. Any help would be appreciated.  I see the high to low transition on the pin but the ISR fails to toggle the test bit. If I shut off the ISR and poll the input pin the toggle the output bit on the transition all is well.

this is located in main.c

//setup external interrupts
GPIO_setExtInt(obj->gpioHandle, GPIO_Number_13, CPU_ExtIntNumber_1);
PIE_enableExtInt(obj->pieHandle, CPU_ExtIntNumber_1);
PIE_setExtIntPolarity(obj->pieHandle, CPU_ExtIntNumber_1, PIE_ExtIntPolarity_FallingEdge);
CPU_enableInt(obj->cpuHandle,CPU_IntNumber_4);

HAL_initIntVectorTable(halHandle);
CPU_enableGlobalInts(obj->cpuHandle);

this is how the vector table is set:

//! \brief Initializes the interrupt vector table
//! \details Points ADCINT1 to mainISR
//! \param[in] handle The hardware abstraction layer (HAL) handle
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->XINT1 = &HallISR;

DISABLE_PROTECTED_REGISTER_WRITE_MODE;

return;
} // end of HAL_initIntVectorTable() function

I'll be the first to admit I'm not the sharpest tool in the shed but this ought to work. No?

  • CPU_enableInt() input parameter is for the row, not the column, of the corresponding interrupt in the PIE chart. For XINT1, that would be row 1, making the input parameter CPU_IntNumber_1, not CPU_IntNumber_4. I understand the confusion as XINT4 is the 4th column on that row. I believe you'll also have to set GPIO13 to GPIO mode (it's set to TZ mode by default) in HAL_setParams() -> HAL_setupGpios().

    I see using this XINT as being a possible issue in the future unless you set the ADC interrupt to the "high priority" interrupt (PIE1.1) when making changes to the code. You will want the ADC interrupt to be the highest priority overall so it isn't preempted (which can screw up InstaSPIN).

    Sean
  • Sean; I made the change you suggested but no joy. GPIO13 is set as follows in the Hal_setupGPIOS function:

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

    /****************** PWM Configuration ***************************************/
    GPIO_setMode(obj->gpioHandle,GPIO_Number_0,GPIO_0_Mode_EPWM1A); // PWM1
    GPIO_setMode(obj->gpioHandle,GPIO_Number_1,GPIO_1_Mode_EPWM1B); // PWM2
    GPIO_setMode(obj->gpioHandle,GPIO_Number_2,GPIO_2_Mode_EPWM2A); // PWM3
    GPIO_setMode(obj->gpioHandle,GPIO_Number_3,GPIO_3_Mode_EPWM2B); // PWM4
    GPIO_setMode(obj->gpioHandle,GPIO_Number_4,GPIO_4_Mode_EPWM3A); // PWM5
    GPIO_setMode(obj->gpioHandle,GPIO_Number_5,GPIO_5_Mode_EPWM3B); // PWM6

    /****************** Discrete Input Configuration ****************************/
    #ifdef USES_MOTOR_HALLS
    // Motor Halls - Optional
    GPIO_setMode(obj->gpioHandle,GPIO_Number_6,GPIO_6_Mode_GeneralPurpose); //Hall U
    GPIO_setDirection(obj->gpioHandle,GPIO_Number_6,GPIO_Direction_Input);
    GPIO_setPullup(obj->gpioHandle,GPIO_Number_6,GPIO_Pullup_Enable);

    GPIO_setMode(obj->gpioHandle,GPIO_Number_7,GPIO_7_Mode_GeneralPurpose); //Hall V
    GPIO_setDirection(obj->gpioHandle,GPIO_Number_7,GPIO_Direction_Input);
    GPIO_setPullup(obj->gpioHandle,GPIO_Number_7,GPIO_Pullup_Enable);

    GPIO_setMode(obj->gpioHandle,GPIO_Number_8,GPIO_8_Mode_GeneralPurpose); //Hall W
    GPIO_setDirection(obj->gpioHandle,GPIO_Number_8,GPIO_Direction_Input);
    GPIO_setPullup(obj->gpioHandle,GPIO_Number_8,GPIO_Pullup_Enable);
    #endif

    //Gearbox selector Hall Switches
    GPIO_setMode(obj->gpioHandle,GPIO_Number_13,GPIO_13_Mode_GeneralPurpose); //Rundown Mode Gearbox input
    GPIO_setDirection(obj->gpioHandle,GPIO_Number_13,GPIO_Direction_Input);
    GPIO_setPullup(obj->gpioHandle,GPIO_Number_13,GPIO_Pullup_Enable);
    .......

    return;
    } // end of HAL_setupGpios() function

    I have also removed the ADC interrupt for the moment so it won't get in the way, I'll revisit that once this is sorted out. I am fairly certain I am missing something else here but just can't see it, too many disparate registers to set up. Any other suggestions?