AnsweredAssumed Answered

Possible error in clocks tool output file clock_config.c

Question asked by John Aldridge on Mar 25, 2019
Latest reply on Mar 28, 2019 by jeremyzhou

Working with the MIMXRT1021 EVK board with MCUXpresso and gcc.

I'm changing the clock frequency to conform to the lower maximum core clock for the industrial temperature rated parts.

The auto-generated code in clock_config.c may have an issue when changing the source and frequency of the AHB clock. In this case is is necessary to not declare SKIP_SYSCLK_INIT. The generated code is:

#ifndef SKIP_SYSCLK_INIT
/* Disable Semc clock gate. */
CLOCK_DisableClock(kCLOCK_Semc);
/* Set SEMC_PODF. */
CLOCK_SetDiv(kCLOCK_SemcDiv, 5);
/* Set Semc alt clock source. */
CLOCK_SetMux(kCLOCK_SemcAltMux, 0);
/* Set Semc clock source. */
CLOCK_SetMux(kCLOCK_SemcMux, 0);
#endif
  1. (Simple issue for information). If this is compiled with no optimization then the inline functions are treated as normal functions. If the stack pointer is in external RAM this causes a problem when the SEMC clock is disabled. Perhaps this could be highlighted in a comment.
  2. There is no corresponding call to CLOCK_EnableClock(kCLOCK_Semc). This can be added by hand, but the change is over-written if the file is updated again from the tool.

In point (2). Have I missed something? If not then could the call to CLOCK_EnableClock(kCLOCK_Semc) be added to this section of code as an output from the Clocks tool?

Outcomes