AnsweredAssumed Answered

Counter stops once execution is suspended, never resumes

Question asked by Michael Liebert on Oct 6, 2016
Latest reply on Oct 18, 2016 by Jorge Antonio Alcala Vazquez

So I'm using KDS Version: 3.2.0 on a Windows 7 Pro PC.

 

I've simplified my code to:

-------------------------------------------------------------------------------------------

int main(void) {
  /* Init board hardware. */
  BOARD_InitPins();
  BOARD_BootClockRUN();
  BOARD_InitDebugConsole();

 

  InitFTM1();

 

  /* Add your code here */

 

  for(;;) { /* Infinite loop to avoid leaving the main function */
    __asm("NOP"); /* something to use as a breakpoint stop while looping */
  }
}

 


void InitFTM1()
{
    SIM_SCGC6 |= (1<<FTM1);                    // Enable Power to FTM1
    FTM1_MODE = (1<<WPDIS) + (1<<FTMEN);    // FTM not old TPM mode
    FTM1_MOD = 75*100-1;                    // 75 Mhz clock  100 us clock period
    FTM1_SC = (1<<CLKS);                    // use system clock
}

------------------------------------------------------------------------------------------------

When I suspend execution I observe the following hex register values:

FTM1_SC      88

FTM1_CNT      varies

FTM1_MOD   1db4

FTM1_MODE   5

 

When I resume and suspend (multiple times) the FTM1_CNT is always the same as the first time I suspended.

 

I want it to resume counting.  What am I doing wrong?

Outcomes