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.

Standard interrupt is not executed

Other Parts Discussed in Thread: UCD3138CC64EVM-030, UCD3138

Hello,

below, my source code just to use standard interrupt every 100 us. But when I debug and set a breakpoint in standard interrupt routine, the debugger don't stop at the breakpoint. When I download this code in the target UCD3138CC64EVM-030,  ACOMP_G_THRESH has 0 as value and the adc_poll function is not executed. I don't know where is the problem. Does anyone have an idea for this problem. 

Thank you for your help.

#define MAIN 1

#include "system_defines.h"
#include "cyclone_device.h"
#include "pmbus_commands.h"
#include "pmbus.h"
#include "variables.h"
#include "function_definitions.h"
#include "software_interrupts.h"
#include "cyclone_defines.h"
#include "stdio.h"


int ram_event2; // comment for hyperknob [min=2500, max=37500, step=2500]
volatile int interrupt_status;


void init_timer_interrupt(void)
{

TimerRegs.T16PWM0CMP0DAT.all = 0xffff; //Threshold to reset counter - 15.625 mHz/10 KHz.
TimerRegs.T16PWM0CMPCTRL.all = 2; //Enables compare 0 (reset) interrupt
TimerRegs.T16PWM0CNTCTRL.all = 0x00c; //PWM counter is running & enables PWM counter reset by compare action on compare 0


disable_interrupt();
disable_fast_interrupt();

interrupt_status = FaultMuxRegs.FAULTMUXINTSTAT.all;

//Configure IRQ
write_reqmask(CIMINT_ALL_PWM0_COMP);
//Configure FIQ
write_firqpr (CIMINT_ALL_FAULT_MUX);
//Enable interrupts
enable_interrupt();
enable_fast_interrupt();
}


void main()
{

if(GioRegs.FAULTIN.bit.TMS_IN == 0) //emergency backdoor - TMS is normally pulled up by external resistor
{

clear_integrity_word(); //if it's pulled down, clear checksum (integrity word)
}

init_pmbus();
init_ADC_polled();
init_timer_interrupt();
//This is necessary to make sure all interrupt status values are
//cleared.

ram_event2 = Dpwm0Regs.DPWMEV1.all; //initialize hyperknob

for(;;)
{
pmbus_handler();
Dpwm0Regs.DPWMEV1.all = ram_event2; //put hyperknob value into register
}
}

#pragma INTERRUPT(c_int00,RESET)

void c_int00(void)
{
main();
}

/////////////////////////////////////////////////////////////

/// Standard interrupt           /////////////

////////////////////////////////////////////////////////////

#include "system_defines.h"
#include "cyclone_device.h"
#include "pmbus_commands.h"
#include "pmbus.h"
#include "variables.h"
#include "function_definitions.h"
#include "software_interrupts.h"

void poll_adc(void)
{
if(AdcRegs.ADCSTAT.bit.ADC_INT == 1) // Conversion complete
{
Vin = AdcRegs.ADCAVGRESULT[0].bit.RESULT;
Vout = AdcRegs.ADCAVGRESULT[1].bit.RESULT;
}
AdcRegs.ADCCTRL.bit.SW_START = 1;

}


#pragma INTERRUPT(standard_interrupt,IRQ)
void standard_interrupt(void)
{
poll_adc();

FaultMuxRegs.ACOMPCTRL3.bit.ACOMP_G_THRESH = 21;


TimerRegs.T16PWM0CMPCTRL.all = 3; //clear interrupt bit by a read/write.
}

  • It's ok. The problem is the Converting UCD3138 Firmware Project from Code Composer Studio Version 3.3 to 5.2.
  • Aha! Glad you found the answer! What version of CCS were you using?
  • Brandon,

    I use CCS V5.5. I realized that the file interrupt.c had undergone some changes especially around swi_number between CCS 3.3 and CCS V5.2. Even so the fast interrupt don't run on my source code. Is there others files to be updated between version 5.2 and 5.5 of CCS for fast interrupt ?

    Is that a fault mux can trigger a fast interrupt ? I don't know. Anyone have an idea ? I Know that a fault mux run with standard interrupt.

    Best regards

  • Sebastien,

    In main.c try commenting out the following statement (usually located just above the void c_int00(void) function):

    //#pragma INTERRUPT(c_int00,RESET)

    Try that and let me know your results.

  • Brandon,

    I just try this source code

    1) In main.c I try to commenting out the following statement (usually located just above the void c_int00(void) function):
    //#pragma INTERRUPT(c_int00,RESET)

    2) I put a Timer PWM1 to trigger on fast interrupt every 100 us like the standard interrupt

    3 ) On fast interrupt routine I just increment a counter cpt_time.

    But when I read cpt_time on memory debugger : Cpt_time = 0; So I think that the fast interrupt routine is not executed.

    Why Fast interrupt is not executed ?



    void init_timer_interrupt(void)
    {

    TimerRegs.T16PWM0CMP0DAT.all = 0x1585; //Threshold to reset counter - 15.625 mHz/10 KHz.
    TimerRegs.T16PWM0CMPCTRL.all = 2; //Enables compare 0 (reset) interrupt
    TimerRegs.T16PWM0CNTCTRL.all = 0x00c; //PWM counter is running & enables PWM counter reset by compare action on compare 0

    TimerRegs.T16PWM1CMP0DAT.all = 0x1585; //Threshold to reset counter - 15.625 mHz/10 KHz.
    TimerRegs.T16PWM1CMPCTRL.all = 2; //Enables compare 0 (reset) interrupt
    TimerRegs.T16PWM1CNTCTRL.all = 0x00c; //PWM counter is running & enables PWM counter reset by compare action on compare 0

    disable_interrupt();
    disable_fast_interrupt();

    interrupt_status = FaultMuxRegs.FAULTMUXINTSTAT.all;

    //Configure IRQ
    write_reqmask(CIMINT_ALL_PWM0_COMP);
    //Configure FIQ
    write_firqpr (CIMINT_ALL_PWM1_COMP);
    //Enable interrupts
    enable_fast_interrupt();
    enable_interrupt();
    }

    void main()
    {

    if(GioRegs.FAULTIN.bit.TMS_IN == 0) //emergency backdoor - TMS is normally pulled up by external resistor
    {

    clear_integrity_word(); //if it's pulled down, clear checksum (integrity word)
    }

    init_pmbus();
    init_ADC_polled();
    init_timer_interrupt();

    for(;;)
    {
    pmbus_handler();
    }
    }

    //#pragma INTERRUPT(c_int00,RESET)

    void c_int00(void)
    {
    main();
    }


    #pragma INTERRUPT(fast_interrupt,FIQ)
    void fast_interrupt(void)
    {
    volatile int32 temp;
    //register int32 fiq_number, interrupt_bits;
    fiq_number = CimRegs.FIQIVEC.all; // Clear on read

    cpt_time ++;

    FaultMuxRegs.ACOMPCTRL2.bit.ACOMP_F_THRESH = 35;

    TimerRegs.T16PWM1CMPCTRL.all = 3; //clear interrupt bit by a read/write.
    }