I want use CLKOUT,so,I config the SIM->CHIPCTL as:
PCC->PCCn[PCC_PORTD_INDEX] |= PCC_PCCn_CGC_MASK;
PORTD->PCR[14] |= 7<<8;
SIM->CHIPCTL|=SIM_CHIPCTL_CLKOUTEN(1)|SIM_CHIPCTL_CLKOUTSEL(8)|SIM_CHIPCTL_CLKOUTDIV(1);
But I only saw a waveform of 128KHZ, no output SPLLDIV2_CLK
Hi,
Could you please tell me which MCU do you use?
I tested it on the S32K144.
My clock settings:
SPLL = 160MHz
SPLLDIV2 is divided by 4 = 40 MHz
My clkout init function:
void CLKOUT_init(void)
{
PCC->PCCn[PCC_PORTD_INDEX]=PCC_PCCn_CGC_MASK; //Enable clock for PORTD
PTD->PDDR |= 1<<14; //Port D14 is configured as output
PORTD->PCR[14] |= PORT_PCR_MUX(7); //Alternative 7, set pin as CLKOUT
SIM->CHIPCTL |= SIM_CHIPCTL_CLKOUTSEL(8);
SIM->CHIPCTL |= SIM_CHIPCTL_CLKOUTDIV(0); //Output clock divide by 1
SIM->CHIPCTL |= SIM_CHIPCTL_CLKOUTEN(1); //Enable CLKOUT
}
After that, I can measure 40 MHz on the CLKOUT pin.
I hope it helps you.
Best Regards,
Diana
I have found the problem, the S32K144 I used should be an early engineering sample, there are some bugs. I changed a piece of the latest development board, there is no problem.Thank you.