Hi guy, ?
I'm studying the MCG of KL05Z.
I open the sysinit.c in the sample code.
I see the function mcg_clk_hz = fei_fee(CLK0_FREQ_HZ,HIGH_GAIN,CLK0_TYPE);
I understand this function is transform FEI mode into FEE mode by IREFS ( internal reference select bit) in MCG_C1.
can i keep the FEI mode ?
There are many MCG mode in the KL05Z , so would you like to give me some advices when a mode is chosen ?
Thanks,
Nhat Minh.
Hi,
The function that you mentioned moves from FEI (FLL Engaged Internal) mode to FEE (FLL Engaged External) mode. The FEE mode operates with the external reference clock. This means you are changing form the operation with the internal reference clock (IRC) to the external reference clock. See this modes of operations and a description in the reference manual (Document Number: KL05P48M48SF1RM ) in the section 24.4.1.1 MCG modes of Operartion.
The MCG FEI mode is the default mode, it means after reset the devices goes into this mode, the typical frequency (fMCGOUTCLK) is 21 MHz. if you want to stay in the FEI mode then do not modify the MCG registers.
If you want to achieve different modes you need to do transition between them in an specific order. You can see the MCG mode state diagram (Figure 24-11) in the Reference Manual to see this feature.
Hope this information helps!
Reference Manual:
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. It would be nice!
-----------------------------------------------------------------------------------------------------------------------
hi Adrian Sanchez Cano,
Thank you very much for your reply,
I don't have experience too much about Embedded system,
So would you like to give me some example application on which MCG mode used ?
Thank you,
Minh.
Hi,
The MCG mode you have to use will depend on your application. It is possible you need to want or need to use the just the internal reference clock or the external reference clock. In the MCG modes of operation section in the description of each mode you can see from where each mode is derived.
The fei_fee function is used to configure the core frequency at 48 Mhz which is the maximum frequency for the KL05 uC. If you want in your application to run your device at the max frequency derived from a external clock source the FEE mode is the one you have to choose.
Please check more information on the KLQRUG document. The information shown there for the MCG module is applied for bigger device of the KL family but the information is similar for all the KL members.
I hope this information can help you.
KLQRUG:
http://cache.freescale.com/files/32bit/doc/quick_ref_guide/KLQRUG.pdf
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. It would be nice!
-----------------------------------------------------------------------------------------------------------------------