I can build the blinky example Zephyr application, flash it to the FRDM-K22F dev board, and it works fine.
However, when flashing the blinky application on our custom board (with a modified LED GPIO according to our schematic), it doesn't blink its LED, and debugging it revealed that it stops upon configuring the clock. It's not surprising since our custom board doesn't have a crystal, unlike the FRDM-K22F board.
Before starting to use Zephyr, we've been using a bare metal firmware, and you can see its clock configuration code. I tried to replicate this clock configuration with Zephyr but couldn't so far.
In Kconfig, I set:
CONFIG_SOC_SERIES_KINETIS_K2X=y
As for the devicetree, I found the relevant bindings, and set the following based on our bare metal firmware:
&sim {
pllfll-select = <KINETIS_SIM_PLLFLLSEL_MCGPLLCLK>;
er32k-select = <KINETIS_SIM_ER32KSEL_OSC32KCLK>;
};
I was advised to modify the clock_init() used by the K22F device. I've been trying to figure out how to modify this function but couldn't, so I could use some help.
Ideally, one shouldn't fork the entire repo and modify this function but configure the clock via the devicetree, the board file, or some native mechanism supported by Zephyr.