Synergy Software Package User's Manual
Clock Initialization

Macros

#define CGC_SRAM_ZERO_WAIT_CYCLES   (0U)
 Specify zero wait states for SRAM.
 
#define CGC_SRAM_ONE_WAIT_CYCLES   (1U)
 Specify one wait states for SRAM.
 

Functions

void bsp_clock_init (void)
 Sets up system clocks. More...
 
uint32_t bsp_cpu_clock_get (void)
 Returns frequency of CPU clock in Hz. More...
 
__STATIC_INLINE void bsp_clocks_mem_wait_set (uint32_t setting)
 This function sets the value of the MEMWAIT register which controls wait cycles for flash read access. More...
 
__STATIC_INLINE uint32_t bsp_clocks_mem_wait_get (void)
 This function gets the value of the MEMWAIT register. More...
 
ssp_err_t bsp_clock_set_callback (bsp_clock_set_callback_args_t *p_args)
 

Detailed Description

Functions in this file configure the system clocks based upon the macros in bsp_clock_cfg.h.

Function Documentation

◆ bsp_clock_init()

void bsp_clock_init ( void  )

Sets up system clocks.

MOCO is default clock out of reset. Enable new clock if chosen.

PLL Source clock is always the main oscillator.

Need to start PLL source clock and let it stabilize before starting PLL

Set PLL Divider.

Set PLL Multiplier.

PLL Source clock is always the main oscillator.

Wait for PLL clock source to stabilize

If the system clock has failed to start call the unrecoverable error handler.

Enable ROM cache

MOCO, LOCO, and subclock do not have stabilization flags that can be checked.

Wait for clock source to stabilize

Set which clock to use for system clock and divisors for all system clocks.

If the system clock has failed to be configured properly call the unrecoverable error handler.

If the USB clock source requested is HOCO set the corresponding bit in the USBCKCR register

◆ bsp_clock_set_callback()

ssp_err_t bsp_clock_set_callback ( bsp_clock_set_callback_args_t *  p_args)

The current frequency must be less than 32 MHz and the mcu must be in high speed mode, before changing wait cycles to 0.

◆ bsp_clocks_mem_wait_get()

__STATIC_INLINE uint32_t bsp_clocks_mem_wait_get ( void  )

This function gets the value of the MEMWAIT register.

Return values
MEMWAITsetting

◆ bsp_clocks_mem_wait_set()

__STATIC_INLINE void bsp_clocks_mem_wait_set ( uint32_t  setting)

This function sets the value of the MEMWAIT register which controls wait cycles for flash read access.

Return values
none

◆ bsp_cpu_clock_get()

uint32_t bsp_cpu_clock_get ( void  )

Returns frequency of CPU clock in Hz.

Return values
Frequencyof the CPU in Hertz