AnsweredAssumed Answered

FRDM-K22F  PIT TOGGLE  Output Frequency

Question asked by Jack Xu on Jul 13, 2016
Latest reply on Jul 28, 2016 by Jack Xu

Hi there,

 

I'm interested about the output frequency of PIT(pit_frdmk22f). I run the project pit_frdmk22f, which is a frdmk22f board driving example. The pit_source_clock is at 40MHz, and the PIT_LDVAL0 is 100000U, and using digital oscilloscope read from port PTA1, shows the frequency is 10Hz.

 

When i set PIT_SetTimerPeriod(PIT, kPIT_Chnl_0, USEC_TO_COUNT(10000U, PIT_SOURCE_CLOCK)), the digital oscilloscope shows 100Hz.

 

When i set PIT_SetTimerPeriod(PIT, kPIT_Chnl_0, USEC_TO_COUNT(1000U, PIT_SOURCE_CLOCK)), the digital oscilloscope shows 250Hz.

 

When i set PIT_SetTimerPeriod(PIT, kPIT_Chnl_0, USEC_TO_COUNT(100U, PIT_SOURCE_CLOCK)), the digital oscilloscope shows 300Hz.

 

is the frequency  calculated by this PIT_SOURCE_CLOCK / PIT_LDVAL0?

 

TERATERM.png

#define PIT_SOURCE_CLOCK CLOCK_GetFreq(kCLOCK_BusClk)

#define PIT_CORE_CLOCK CLOCK_GetFreq(kCLOCK_CoreSysClk)

            PRINTF("\r\n PIT_SOURCE_CLOCK is: %d", PIT_SOURCE_CLOCK);

            PRINTF("\r\n PIT_CORE_CLOCK is: %d", PIT_CORE_CLOCK);

 

Also, what settings are needed to be set to achieve the right frequency?

 

Thanks in advance!

 

- Jack

Outcomes