Dear all,
I am currently working with the MK81 microcontroller on a custom board and have successfully implemented booting from an external QSPI flash (by using physical addresses). The boot process completes correctly, and a simple test application executes as expected, confirming that the QCB configuration is valid.
Following this, I am attempting to implement the clock_change() function as described in the MBOOTQSPIUG.pdf document. My goal is to configure the MCG in PEE mode using an external 12 MHz oscillator as the primary clock source. From this, I aim to generate a 144 MHz output on MCGOUTCLK.
Subsequently, I configure the SIM->CLKDIV1 register to derive a 72 MHz system clock from the 144 MHz MCGOUTCLK. This 72 MHz system clock is then intended to be used as the new source for the QSPI interface clock, applying a divider of 2 to achieve the final 72 MHz QSPI clock frequency.
Unfortunately, the application stucks as soon as I reset the board. I can not debug it, and I noticed just that an hard fault or something similar happens.
I have attached the implementation of the clock_change() function, which reflects the steps outlined above. I would appreciate it if you could review the function and advise whether there might be any issues or overlooked aspects that could affect the QSPI interface or overall system stability.
Thank you in advance for your support.
Best regards,
Vladimir Zitoli