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.

MSP432P401R: Seeing double interrupts for Timer32

Part Number: MSP432P401R

G'Day,

Is there any reason a Timer32 module would occasionally give two interrupts in very short order (a few 10s of uSec apart)?

I'm using SimpleLink 1.4 (yet to move up to v1.6) and I set up the Timer32 module as described by the code fragment below (I'm basically setting it up to give me an interrupt every 10mSec)

uint32_t tickCnt = 0;

void timer32_hwi(uintptr_t arg)
{
MAP_Timer32_clearInterruptFlag(TIMER_1_BASE);
tickCnt++;
}

void timer32_init(void)
{

// Setup a HWI for the Timer32 module

Hwi_Handle hndl;
Hwi_Params params;

Hwi_Params_init(&params);
params.priority = 0xe0;

hndl = Hwi_create(INT_T32_INT2, timer32_hwi, &params, NULL);

// Setup Timer32 Module - not aware of a SimpleLink driver for Timer32, so use driverlib

MAP_Timer32_haltTimer(TIMER_1_BASE);
MAP_Timer32_initModule(TIMER_1_BASE, TIMER32_PRESCALER_1, TIMER32_32BIT, TIMER32_PERIODIC_MODE);
MAP_Timer32_setCount(TIMER_1_BASE, 480000);
MAP_Timer32_clearInterruptFlag(TIMER_1_BASE);
MAP_Timer32_enableInterrupt(TIMER_1_BASE);
MAP_Timer32_startTimer(TIMER_1_BASE, false);

tickCnt = 0;

}

  • Hello Julian,

    If you are interested in using the TI Driver, look at the example "./examples/rtos/MSP_EXP432P401R/drivers/timerled/". Let us know if you still need help.

    Also what does TIMER_1_BASE map to?

    Thanks,
    Sai
  • Sorry, typo. Should be TIMER32_1_BASE.

    The example you sent through confused me. 

    At first glance I thought the example was using the ti.sysbios.family.arm.msp432 API (which I've used quite a bit) but something was off.

    The Sysbios API has functions/typedefs like Timer_Handle, Timer_Params, Timer_Params_init() (which I see in the example), but not calls like Timer_open() (which also appear in the example)

    It turns out that the Sysbios ti.sysbios.family.arm.msp432 API and the SimpleLink Timer.h API share a bunch of Typedef and function names.  Both APIs implement the items behind those shared names differently.  This seems a bit evil. 

  • How do you know that you are seeing 2x of the interrupts? Tiner32 is a simple peripheral. So show a print of the registers and see if anything is unexpected.
  • The reason I though I was getting Timer32 interrupts very close together is the following RTOS Analyzer Execuction Graph

    Hwi.timer32D_HWI_module_epochCtr() is the HWI for Timer32  TIMER32_1_BASE

    Yesterday I was seeing things like the above trace fairly often. 

    I'm not sure what has changed, but today I don't see interrupts so close together, but I AM still seeing interrupts less than 10mSec apart.

    I modified my HWI as follows so that I can detect when interrupts happen too close together.

      static uint32_t syst = 0;
      uint32_t tDiff;
    
      tDiff = syst - MAP_SysTick_getValue();
      syst = MAP_SysTick_getValue();
      if (tDiff < 400000)  // 480000 is 10mSec..... 
      {
        __nop();
      }
    
      MAP_Timer32_clearInterruptFlag(TIMER32_MODULE_EPOCHCTR);
      g_timer32_epochCnt_u64++;
      g_timer32_freeCnt_u32++;

    If put a breakpointon the __nop(), every few seconds (its pretty random) exeuction stops at the breakpoint with tDiff varying all over the place (rom about 10,000 to over 300,000)

    Screen shot below show registers when stopped at the __nop();

  • Flip a pin in the isr and put a scope on it.

    Is any of the register value unexpected?
  • Looks like I was using Systick incorrectly to measure the period between interrupts.
    Switched to a different timer which has fixed today's problem.

    I can't replicate yesterday's problem so I'll mark this as resolved and open a new issue with further details if I see the original problem again.

**Attention** This is a public forum