I wrote a driver for the FRDM_KL03Z's MCG module, all seems work, the only strange beahvior is that when mesure the IRC48M reference with a timer, I obtain 8MHz instead 48MHz.
Help me! Does anyone know why this happens?
Best Regards!
Alessio Paolucci
解決済! 解決策の投稿を見る。
Hi,
You can check the IRC48M frequency in a pin setting the CLKOUT pin. I tested this on the FRDM-KL03 on the pin PTA12 which is J4[3] on the board.
You need to set the following registers:
SIM_SOPT2 = SIM_SOPT2_CLKOUTSEL(7) //Selects the IRC48M clock output on the CLKOUT pin.
SIM_SCGC5 |= SIM_SCGC5_PORTA_MASK; //PORTA clock enabled
PORTA_PCR12 = PORT_PCR_MUX(0x05) | PORT_PCR_DSE_MASK; //Set PTA12 to CLOCKOUT functionallity and DS on the pin
I initialized the Core at 48 MHz and the Bus clock at 24 MHz using the IRC48M internal reference clock and measured ~48 MHz on the PTA12.
Hope this information can help you
Best Regards,
Adrian Sanchez Cano
Technical Support Engineer
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi,
You can check the IRC48M frequency in a pin setting the CLKOUT pin. I tested this on the FRDM-KL03 on the pin PTA12 which is J4[3] on the board.
You need to set the following registers:
SIM_SOPT2 = SIM_SOPT2_CLKOUTSEL(7) //Selects the IRC48M clock output on the CLKOUT pin.
SIM_SCGC5 |= SIM_SCGC5_PORTA_MASK; //PORTA clock enabled
PORTA_PCR12 = PORT_PCR_MUX(0x05) | PORT_PCR_DSE_MASK; //Set PTA12 to CLOCKOUT functionallity and DS on the pin
I initialized the Core at 48 MHz and the Bus clock at 24 MHz using the IRC48M internal reference clock and measured ~48 MHz on the PTA12.
Hope this information can help you
Best Regards,
Adrian Sanchez Cano
Technical Support Engineer
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thanks, I try this solution and, even if the waveform is very blunt, the frequency is in fact 48MHz.
Best Regards.
Alessio Paolucci