[EXT] [Zephyr-users] #nxp #k2x

Andrei Gansari

Hello Anton,


As I understand you use a custom board that you managed to create out of tree and you’d like to change clock configuration.

The file /soc/arm/nxp_kinetis/k2x/soc.c  is used for all the SoC in Kinetis 2x family.

The functions used in clock_init() can be found here:  zephyr/../modules/hal/nxp/mcux/devices/MK22F51212/fsl_clock.h.


So, you need to change soc.c to accommodate your board’s changes and use either Kconfig or Device Tree to differentiate between configurations.

You can use Kconfig to make cpu/board specific changes like, e.g. CONFIG_OSC_LOW_POWER.

Device tree can be used to tell the clock source for a specific peripheral, but I’m not sure about main clock source.




Andrei Gansari


From: users@... <users@...> On Behalf Of antoker via lists.zephyrproject.org
Sent: Saturday, May 16, 2020 7:24 PM
To: users@...
Subject: [EXT] [Zephyr-users] #nxp #k2x


Caution: EXT Email

Hi all,

I'm new to zephyr and am not sure if this is a correct place to ask questions. But here is my challenge. I've been playing with zephyr for some time now being able to both compile and run sample apps for frdm-k22f board and make my own apps. The next step was to make an out of tree board, which is based on k2x, to my suprise, after digging through /soc/arm/nxp_kinetis/k2x/soc.c i found out that clock_init() for k2x always uses external oscillator so I have a couple of questions:

  1. Is it possible to provide custom implementation of clock_init for my out of tree board which overrides /k2x/soc.c ?
  2. If yes, what is the proper way to do this?