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.

Interrupts skipping during function call in main() - C2000 F28069

I am running into a problem with my ISRs during active CPU computation in main(). I am reading samples at a fixed 44.1kHz interval via the McBSP interface (MRINTA ISR). I am outputting these samples to the ePWM module at a custom frequency using the CPU Timer0 (TINT0 ISR) varying between 44.1kHz and 88.2kHz. My McBSP interrupt routine takes 1.25 microseconds to run, and my Timer0 routine takes 5 microseconds to run (it does a bit of floating point math).

I have a main loop that calls a computation-heavy function roughly every 30ms (33Hz), which does a lot of floating point math on buffers that are (I believe) stored in flash -- they are in L5 DPSARAM. It takes about 7ms to run. During this function call both my TINT0 and MRINTA interrupt routines are severely degraded, and it seems that interrupts are being skipped from both. They both run fine in the intervals between this function call, and if I comment out the function entirely, both ISRs work perfectly.

It is my understanding that interrupts are prioritized over the main CPU and will run to completion before context-switching back to anything else. I have done the math and the CPU should have enough processing time to finish the function call while still handling every interrupt. Why are my ISRs are being clobbered? Where can I begin looking to debug this issue? Is there something I'm not understanding about the relationship between interrupt routines and function calls in main()?

Any help is greatly appreciated, and I am happy to provide any code that might shed light on this issue. I neglected putting code in this initial question since I'm not sure which snippets would be best. Thanks in advance!

  • Sominder,

    When the function call is enabled (30ms rate) - your observation is that the interrupts of TINT0 and MRINTA go haywire for the first 7ms (duration of your floating point math function) and behave as expected for the rest of the time. Is this correct?
    Also, what is the event used to call the function every 30ms? is it another timer?

    -Bharathi.

  • Ah, I might have been a bit unclear. The function call takes 7ms to execute. I am running it every 30ms. During the 7ms of execution some interrupts are dropped. during the "downtime" between each execution the interrupts run as expected.

    I am using the 44.1k MRINTA to read samples into a buffer. The function then does some floating point calculations on this buffer (it takes 30ms at 44.1kHz to fill the buffer). The code looks like this:

    //--- Main Loop
    while(1)
    {
    asm(" NOP");
    if (new_data == 1) {

    /* once we have new data, find its pitch */
    pitch = pitch_detect(detect_buf);

    /* once we find the pitch, data is used */
    new_data = 0;
    }
    }

    when the buffer is filled with data MRINTA1 sets the global variable "new_data" to be 1, triggering the function call. During the execution of the function, all the interrupts go haywire. Once the function is done and new_data=0, the ISRs are fine.

    Is there any more information I can provide?
  • Thanks for the details.
    Is there any portions of the code that are not interruptible in the function?