Search code examples
cembeddedinterrupttexas-instrumentscode-composer

breakpoint inside interrupt C


I'm using LCDK C6748 of Texas Intruments with Code Composer Studio and TMDSEMU100V2U-14T - XDS100v2 USB JTAG Emulator.

LCDK comes with bunch of support functions, including a function that initialize the board and defines which callback functions are called for each interrupt.

I just implemented the callback function, so it does something whenever a new sample comes from the ADC.

I tried to set a breakpoint inside the interrupt but in run time the program "flow" didn't get there.

Furthermore, I've done something simpler:

volatile int flag = 0;


interrupt void interrupt4(void) // interrupt service routine
{
   flag = 1;
   return;
}

int main(){
    // board initializing function, defining sampling rate etc.
    L138_initialise_intr(FS_48000_HZ,ADC_GAIN_0DB,DAC_ATTEN_0DB);

    while(1){
       if (flag == 1){
          printf("interrupt entered");
          flag = 0;
       }
    }
}

but the from some reason the while loop was entered only once.

it surprised me because if I don't set breakpoint the interrupt is entered continuously- I tried to just pass the samples to the speakers line without doing anything else and I heard music.

I have a feeling that I'm missing something very basic about interrupts, I'm quite new to this subject.

Can someone please explain to me [or link me to good source that explain how the mechnism works in DSP]:

1) why we can't set a breakpoint inside interrupt?

2) why even if I set breakpoint in the main, it seems the interrupt doesn't occur, and if I don't it does.

3) which ways I have to have access to the variables in run time, in CCS?

thanks


Solution

    1. Try putting breakpoint and then run. see if it hits atleast once. If it does, then your interrupt source is not cleared automatically [because you are not doing so explicitly inside ISR]. in TI controller they expect you to clear ISR path to receive next as per my experience,.
    2. If you dont receive even 1st time interrupt then, check assembly generated for ISR and optimization done by compiler.

    3. Although, you might need to see the timing and global variable protection later, in case of conflicts but as of now above 2 suggestions shall do.