I have a custom board based on the K60F120M tower board, which has an clock generator on XTAL0/EXTAL0, and a crystal on XTAL1/EXTAL1. I left off the external clock, and have only the crystal, but unfortunately I left it on XTAL1/EXTAL1, and now it seems like that won't work.
But when I change to use XTAL0/EXTAL0, the basic tower board demo projects don't run anyway.
1. Is it possible to run the device off a crystal on XTAL1/EXTAL1 pins only? From reviewing the reference manual, it looks like XTAL1/EXTAL1 can only drive some peripherals, and not all internal clocks. Is this right?
2. Assuming I move the crystal to the XTAL0/EXTAL0 pins, is there some clock configuration change I need to make to work off the crystal as opposed to a clock input? I noticed some settings such as gain, etc., but I tried various things and couldn't get it starting. It stalls in __pe_initialize_hardware of bsp_cm.c in a while loop waiting for a required clock condition.
Thanks
Solved! Go to Solution.
Hi Angelo,
The RTC oscillator is needed for such case, that might add a little bit cost for a 32.768KHz crystal, but you may configure the clock as below:
I have also successfully implemented it based on TWR-K70, you may try it as well on TWR-K60F120M.
Hope that helps,
Have a great day,
Kan
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Angelo,
Yes, it is possible to run the device off a crystal on XTAL1/EXTAL1 pins only, MCGPLL1CLK is one of the alternative clock sources for MCGOUTCLK, so it can be used to drive all the on-chip peripherals. and if you move the crystal to XTAL0/EXTAL0 pins, there should be changes in the code for original reference clock configuration, you may refer to the demos in C:\Freescale\CW MCU v10.6\MCU\CodeWarrior_Examples\Processor_Expert\Kinetis\TWR-K40X256 for details, since TWR-K40X256 uses a 8MHz crystal connected with XTAL/EXTAL pins.
Hope that helps,
Have a great day,
Kan
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thank you Kan,
I couldn't find that folder in CW10.5 so I'll install 10.6 and check again. In the meantime I tried to create a new PE project to let it generate code for my configuration and see what it looks like, but I wasn't too sure about how it should be configured since there are so many options. Going through the manual is somewhat helping but again there is a lot going on and I'm not familiar enough with the entire clock tree to know what options to use, e.g. FEI, FEE, PBE, etc.
If I leave the crystal on the same XTAL1/ETXAL1 pins I have it on now, what registers should I be looking at to change it from external clock to crystal?
Thanks,
Angelo
Hi Angelo,
According to my experience on PE, I think you may configure the clock source from ref clock to crystal by the following steps:
1. change system oscillator:
2.change MCG mode and PLLx
3.Set PLL output freq:
4.Set system clocks:
Hope that helps,
Have a great day,
Kan
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thank you Kan,
It looks like you have it set to use XTAL0. If I try to set it up using XTAL1, I'm not able to select oscillator 1 for the MCG reference clock. Please see the attached image.
Using the demo project for the K60 tower board, on my custom board that has a 12MHz crystal on XTAL1, and nothing on XTAL0, the crystal oscillates but the device doesn't run. I tried to redirect the clock to MCG (as shown in the image, and also changing MCG control registers directly), but I can't get it to run.
If I rewire the crystal to XTAL0, it doesn't oscillate. I enabled the PORTA_PCR19 MUX (since it was getting a reference clock on one pin only and not a crystal connection on the tower), and I enabled the oscillator (EREFS0=1 in MCG_C2), but I still don't get the crystal oscillating.
I'm not sure what to try next.
Thanks,
Angelo
Hi Angelo,
The RTC oscillator is needed for such case, that might add a little bit cost for a 32.768KHz crystal, but you may configure the clock as below:
I have also successfully implemented it based on TWR-K70, you may try it as well on TWR-K60F120M.
Hope that helps,
Have a great day,
Kan
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thanks Kan,
Do you know if this would mean that I still need an oscillator on XTAL1? I.e. the PLL reference select options are OSC0 or OSC1, so I assume I can't just run everything off the RTC crystal only, correct?
Thanks,
Angelo
Hi Angelo,
Yes, the crystal on XTAL1 is still needed , with a RTC crystal on the RTC oscillator you may use PLL1 in PEE mode, and generate system clock, bus clock , DDR2 clock for associated modules.
Have a great day,
Kan
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------