Change clock configuration when 32 kHz oscillator is not available

Showing results for 
Search instead for 
Did you mean: 

Change clock configuration when 32 kHz oscillator is not available

Change clock configuration when 32 kHz oscillator is not available

If the application running in the KW41Z does not operate in low power mode, the device could work without the 32 kHz oscillator. However, for it to work correctly, the clock configuration must be changed.


Figure 1.  KW41Z clock distribution

By default, the software stack running on the KW41Z selects a clock source that requires the 32 kHz oscillator. However, if the 32 kHz oscillator is not available, the clock configuration must be changed. Fortunately, the option to change it is already implemented, it is only required to change the clock configuration to the desired one. To do this, change the value for the CLOCK_INIT_CONFIG macro located in the app_preinclude.h file.

/* Define Clock Configuration */
#define CLOCK_INIT_CONFIG           CLOCK_RUN_32‍‍‍‍‍‍‍‍

In the selected mode in this example, CLOCK_RUN_32, the selected clock mode is BLPE (Bypassed Low Power External). In this mode, the FLL is bypassed entirely, and clock is derived from the external RF oscillator, in this case, the 32 MHz external clock.

These macros are the default available options to change the clock configuration, they are located in the board.h file. It is up to the application and the developer to chose the most appropriate configuration.

#define CLOCK_VLPR       1U
#define CLOCK_RUN_16     2U
#define CLOCK_RUN_32     3U
#define CLOCK_RUN_13     4U
#define CLOCK_RUN_26     5U
#define CLOCK_RUN_48_24  6U
#define CLOCK_RUN_48_16  7U
#define CLOCK_RUN_20_FLL 8U‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

More information regarding the different clock modes and their clock sources are available in the KW41Z reference manual, Chapter 5: Clock Distribution, section 5.4 Clock definitions, and Chapter 24: Multipurpose Clock Generator.

Labels (1)

Thanks for the useful post. I have a few issues/questions.

1.) Both my board.h and app_preinclude.h files contains a #define for CLOCK_INIT_CONFIG. The change appears to take affect when I update the value in the app_preinclude.h file as suggested above.

2.) When updating the CLOCK_INIT_CONFIG to be CLOCK_RUN_32 as suggested above, the TMR_Init() module crashes while trying to run OSA_TaskCreate(). Any suggestions?

Version history
Revision #:
2 of 2
Last update:
‎09-10-2020 02:52 AM
Updated by: