I'm trying to migrate a project from the MK10DN512 to the MK10FN1M microcontroller and as a first experiment I just flashed the code compiled for the MK10DN512 into the MK10FN1M and it seems to work but it runs about half the speed. I checked the reference manuals in order to figure out what register configurations are different or extra but I'm having a hard time figuring it out. I have made several experiments with the register values but I haven't been able to make it work.
In an attempt to know what to do I decided to use the graphical clock configuration from the MCUXpresso SDKs to compare the register values. I was able to find and download the SDK for the MK10DN512 directly on MCUXpresso:
But there is no SDK for the MK10FN1M!!!, is this correct or am I missing something? If there really is no SDK or support for this part, is there a 100% equivalent part for which I could download its SDK in order to use it to configure the MK10FN1M clock? I don't really need to even generate code, just configure the clock with the correct values and take the resulting register values as a reference for my project. It is a very old project that uses MQX3.8 and Keil in which values are being written directly into the registers, so that's why I would not use the generated code, just the values as reference.
For example, everything works really well for the MK10DN512. This is its clock config:
And the equivalent code in my legacy project:
/* Switch to PEE Mode */
/* OSC_CR: ERCLKEN=1,??=0,EREFSTEN=1,??=0,SC2P=0,SC4P=0,SC8P=0,SC16P=0 */
OSC_CR = (uint8_t)0xA0U;
/* MCG_C1: CLKS=0,FRDIV=3,IREFS=0,IRCLKEN=0,IREFSTEN=0 */
MCG_C1 = (uint8_t)0x00U;
/* MCG_C2: LOCRE0=0,??=0,RANGE0=2,HGO0=1,EREFS0=1,LP=0,IRCS=1 */
MCG_C2 = (uint8_t)0xACU;
/* MCG_C5: ??=0,PLLCLKEN0=1,PLLSTEN0=0,PRDIV0=1 */
MCG_C5 = (uint8_t)0x41U;
/* MCG_C6: LOLIE0=0,PLLS=1,CME0=1,VDIV0=0x01(25) */
MCG_C6 = (uint8_t)0x41U;
while((MCG_S & 0x0CU) != 0x0CU) /* Wait until output of the PLL is selected */
{}
while((MCG_S & MCG_S_LOCK_MASK) == 0x00U) /* Wait until locked */
{}
It works like a charm!!
So the only thing I need to do is get the equivalent values for those registers for the MK10FN1M for the same 8MHz external xtal and for the frequencies shown in the image. It is just that there is no SDK for the MK10FN1M.
So, would an equivalent part with a supported SDK do the trick? I guess if it has the exact same registers as the MK10FN1M then it would work, but I don't know what part that is...
Hi @mmalagon ,
Yes, not all the Kinetis are supported by MCUXpresso IDE. MK10FN1Mxxx12 is old and it is not supported by MCUXpresso and hasn't SDK package.
It is possible that K10DN512's clock configure code can run on K10FN1M because all kinetis K family has similar SCG block and register map. But it is not safe. You can see that their structure is different.
So, you'd better use CW or KDS or third part IDE like IAR/Keil. If you really want to use MCUXpresso, please don't use MK10DN512xxx10 head file and don't use MCUXpresso config tool to generate MK10DN512 code for MK10FN1M, except you are sure that their module are same.
Regards,
Jing