Dear Jeremy,
first thanks for your support.
I use the Freedom Board K22 (512Kb) here.
I verfied the internal clock to 80Mhz using the following function.
void clkout_init(void){
//Configure PCR[3] to clkout.
PORTC->PCR[3] = PORT_PCR_MUX(5) | PORT_PCR_DSE_MASK; //FTM0_CH0
SIM->SOPT2&=~SIM_SOPT2_CLKOUTSEL_MASK;
SIM->SOPT2|=SIM_SOPT2_CLKOUTSEL(0);
}
On the oscilosocpe I could see the 80Mhz.
Now I checked again the clock output using the following code:
void FTM_EPWM(void){
// Enable clock to TIMER FTM0
SIM->SCGC6 |= SIM_SCGC6_FTM0_MASK;
// Enable clock to port pins used by FTM0, we use port C
SIM->SCGC5 |= SIM_SCGC5_PORTC_MASK;
//Set pin to right output
PORTC->PCR[1] = PORT_PCR_MUX(4)| PORT_PCR_DSE_MASK; //FTM0_CH0
PORTC->PCR[2] = PORT_PCR_MUX(4)| PORT_PCR_DSE_MASK; //FTM0_CH1
FTM0->MODE&=~(FTM_MODE_WPDIS_MASK);
FTM0->MODE|=(FTM_MODE_FTMEN_MASK);
FTM0->MOD = 79;
FTM0->CONTROLS[0].CnSC= (FTM_CnSC_MS(0b10) | FTM_CnSC_ELS(0b10)); /* No Interrupts; High True pulses on Edge Aligned PWM */
FTM0->CONTROLS[1].CnSC= (FTM_CnSC_MS(0b01) | FTM_CnSC_ELS(0b01));
FTM0->CONTROLS[0].CnV=40; /* 50% pulse width */
FTM0->CONTROLS[1].CnV=40;
FTM0->SC=FTM_SC_CLKS(0b01)|FTM_SC_PS(0); /* Edge Aligned PWM running from System Clock / 1 */
}
But, still CH1 500kHz and CH2 250 kHz.
Double the frequency is expected.
Is the SYSTEMCLOCK really the souce, or could it be, that the source is busclock?
Could you please help?
-Michael