AnsweredAssumed Answered

FTM counter stops working after entering debugger once

Question asked by corecode on Oct 1, 2013
Latest reply on Nov 19, 2015 by Mark Butcher

I noticed that FTM0 on my MK20DX128 will stop incrementing the counter after I enter the debugger once:  a simple break + continue is sufficient to make FTM stop working.

 

If I set CONF[BDMMODE] to 0b11, it works as it should, but does not suspend operation during debugging.  Is this a hardware bug?

 

Code used for testing:

 

#include "MK20DZ10.h"

void
main(void)
{
  SIM_SCGC5 |= SIM_SCGC5_PORTC_MASK;
  PORTC_PCR1 = PORT_PCR_MUX(4);
  SIM_SCGC6 |= SIM_SCGC6_FTM0_MASK;
  FTM0_MOD = FTM_MOD_MOD(0xffff);
  FTM0_CNTIN = FTM_CNTIN_INIT(0);
  FTM0_C0SC = FTM_CnSC_MSB_MASK | FTM_CnSC_ELSB_MASK;
  FTM0_C0V = FTM_CnV_VAL(0x8000);
  FTM0_SC = FTM_SC_CLKS(1);

  for (;;)
  /* NOTHING */;
}

Outcomes