HPM SDK
HPMicro Software Development Kit
PLLCTL driver APIs

PLLCTL driver APIs. More...

Macros

#define PLLCTL_PLL_VCO_FREQ_MIN   (375000000U)
 
#define PLLCTL_PLL_VCO_FREQ_MAX   (2200000000U)
 
#define PLLCTL_PLL_LOCK_SS_RESET   PLLCTL_PLL_LOCK_LOCK_SS_RSTPTR_MASK
 
#define PLLCTL_PLL_LOCK_REFDIV   PLLCTL_PLL_LOCK_LOCK_REFDIV_MASK
 
#define PLLCTL_PLL_LOCK_POSTDIV1   PLLCTL_PLL_LOCK_LOCK_POSTDIV1_MASK
 
#define PLLCTL_PLL_LOCK_SS_SPREAD   PLLCTL_PLL_LOCK_LOCK_SS_SPREAD_MASK
 
#define PLLCTL_PLL_LOCK_SS_DIVVAL   PLLCTL_PLL_LOCK_LOCK_SS_DIVVAL_MASK
 
#define PLLCTL_PLL_LOCK_ALL
 

Enumerations

enum  { status_pllctl_not_enabled = ((uint32_t)( status_group_pllctl )*1000U + (uint32_t)( 1 )) , status_pllctl_out_of_range = ((uint32_t)( status_group_pllctl )*1000U + (uint32_t)( 2 )) }
 
enum  pllctl_ss_type { pllctl_ss_centerspread = 0 , pllctl_ss_downspread = 1 }
 

Functions

static hpm_stat_t pllctl_pll_ss_disable (PLLCTL_Type *ptr, uint8_t pll)
 Disables spread spectrum mode for a specified PLL. More...
 
static hpm_stat_t pllctl_pll_powerdown (PLLCTL_Type *ptr, uint8_t pll)
 Powers down a specified PLL. More...
 
static hpm_stat_t pllctl_pll_poweron (PLLCTL_Type *ptr, uint8_t pll)
 Powers on a specified PLL. More...
 
static hpm_stat_t pllctl_set_postdiv1 (PLLCTL_Type *ptr, uint8_t pll, uint8_t div)
 Sets the post-divider (postdiv1) for a specified PLL. More...
 
static hpm_stat_t pllctl_set_fbdiv_int (PLLCTL_Type *ptr, uint8_t pll, uint16_t fbdiv)
 Sets the feedback divider for PLL integer mode. More...
 
static hpm_stat_t pllctl_set_fbdiv_frac (PLLCTL_Type *ptr, uint8_t pll, uint16_t fbdiv)
 Sets the feedback divider for PLL fraction mode. More...
 
static hpm_stat_t pllctl_set_frac (PLLCTL_Type *ptr, uint8_t pll, uint32_t frac)
 Sets the fractional part for PLL fraction mode. More...
 
static hpm_stat_t pllctl_get_div (PLLCTL_Type *ptr, uint8_t pll, uint8_t div_index)
 Gets the current divider value for a specified PLL divider. More...
 
static bool pllctl_div_is_stable (PLLCTL_Type *ptr, uint8_t pll, uint8_t div_index)
 Checks if a specified PLL divider has stabilized. More...
 
static hpm_stat_t pllctl_set_div (PLLCTL_Type *ptr, uint8_t pll, uint8_t div_index, uint16_t div)
 Sets the divider value for a specified PLL divider. More...
 
static bool pllctl_pll_is_enabled (PLLCTL_Type *ptr, uint8_t pll)
 Checks if a specified PLL is enabled. More...
 
static bool pllctl_xtal_is_stable (PLLCTL_Type *ptr)
 Checks if the crystal oscillator has stabilized. More...
 
static bool pllctl_xtal_is_enabled (PLLCTL_Type *ptr)
 Checks if the crystal oscillator is enabled. More...
 
static void pllctl_xtal_set_rampup_time (PLLCTL_Type *ptr, uint32_t cycles)
 Sets the ramp-up time for the crystal oscillator. More...
 
static bool pllctl_pll_is_locked (PLLCTL_Type *ptr, uint8_t pll)
 Checks if a specified PLL is locked. More...
 
hpm_stat_t pllctl_set_pll_work_mode (PLLCTL_Type *ptr, uint8_t pll, bool int_mode)
 Sets the operating mode of a specified PLL. More...
 
hpm_stat_t pllctl_set_refdiv (PLLCTL_Type *ptr, uint8_t pll, uint8_t div)
 Sets the reference divider for a specified PLL. More...
 
hpm_stat_t pllctl_init_int_pll_with_freq (PLLCTL_Type *ptr, uint8_t pll, uint32_t freq_in_hz)
 Initializes a PLL in integer mode for a specific frequency. More...
 
hpm_stat_t pllctl_init_frac_pll_with_freq (PLLCTL_Type *ptr, uint8_t pll, uint32_t freq_in_hz)
 Initializes a PLL in fractional mode for a specific frequency. More...
 
uint32_t pllctl_get_pll_freq_in_hz (PLLCTL_Type *ptr, uint8_t pll)
 Gets the current frequency of a specified PLL. More...
 
hpm_stat_t pllctl_pll_ss_enable (PLLCTL_Type *ptr, uint8_t pll, uint8_t spread, uint8_t div, bool down_spread)
 Enables spread spectrum mode for a specified PLL. More...
 
hpm_stat_t pllctl_pll_setup_spread_spectrum (PLLCTL_Type *ptr, uint8_t pll, uint8_t ss_range, uint32_t modulation_freq, pllctl_ss_type ss_type)
 Configures spread spectrum settings for a specified PLL. More...
 

Detailed Description

PLLCTL driver APIs.

Macro Definition Documentation

◆ PLLCTL_PLL_LOCK_ALL

#define PLLCTL_PLL_LOCK_ALL

#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_pllctl_drv.h>

Value:
| PLLCTL_PLL_LOCK_LOCK_SS_SPREAD_MASK \
#define PLLCTL_PLL_LOCK_LOCK_SS_RSTPTR_MASK
Definition: hpm_pllctl_regs.h:252
#define PLLCTL_PLL_LOCK_LOCK_REFDIV_MASK
Definition: hpm_pllctl_regs.h:264
#define PLLCTL_PLL_LOCK_LOCK_SS_DIVVAL_MASK
Definition: hpm_pllctl_regs.h:300
#define PLLCTL_PLL_LOCK_LOCK_POSTDIV1_MASK
Definition: hpm_pllctl_regs.h:276

◆ PLLCTL_PLL_LOCK_POSTDIV1

◆ PLLCTL_PLL_LOCK_REFDIV

◆ PLLCTL_PLL_LOCK_SS_DIVVAL

◆ PLLCTL_PLL_LOCK_SS_RESET

◆ PLLCTL_PLL_LOCK_SS_SPREAD

#define PLLCTL_PLL_LOCK_SS_SPREAD   PLLCTL_PLL_LOCK_LOCK_SS_SPREAD_MASK

◆ PLLCTL_PLL_VCO_FREQ_MAX

◆ PLLCTL_PLL_VCO_FREQ_MIN

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_pllctl_drv.h>

Enumerator
status_pllctl_not_enabled 
status_pllctl_out_of_range 

◆ pllctl_ss_type

Function Documentation

◆ pllctl_div_is_stable()

static bool pllctl_div_is_stable ( PLLCTL_Type ptr,
uint8_t  pll,
uint8_t  div_index 
)
inlinestatic

#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_pllctl_drv.h>

Checks if a specified PLL divider has stabilized.

Parameters
[in]ptrBase address of the PLLCTL peripheral
[in]pllIndex of the PLL to check
[in]div_indexDivider index (0: DIV0, 1: DIV1)
Returns
true if divider has stabilized, false otherwise

◆ pllctl_get_div()

static hpm_stat_t pllctl_get_div ( PLLCTL_Type ptr,
uint8_t  pll,
uint8_t  div_index 
)
inlinestatic

#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_pllctl_drv.h>

Gets the current divider value for a specified PLL divider.

Parameters
[in]ptrBase address of the PLLCTL peripheral
[in]pllIndex of the PLL to query
[in]div_indexDivider index (0: DIV0, 1: DIV1)
Returns
Current divider value (1-based) or error status

◆ pllctl_get_pll_freq_in_hz()

uint32_t pllctl_get_pll_freq_in_hz ( PLLCTL_Type ptr,
uint8_t  pll 
)

#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_pllctl_drv.h>

Gets the current frequency of a specified PLL.

Parameters
[in]ptrBase address of the PLLCTL peripheral
[in]pllIndex of the PLL to query
Returns
Current PLL frequency in Hertz, 0 if PLL is powered down

◆ pllctl_init_frac_pll_with_freq()

hpm_stat_t pllctl_init_frac_pll_with_freq ( PLLCTL_Type ptr,
uint8_t  pll,
uint32_t  freq_in_hz 
)

#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_pllctl_drv.h>

Initializes a PLL in fractional mode for a specific frequency.

Parameters
[in]ptrBase address of the PLLCTL peripheral
[in]pllIndex of the PLL to configure
[in]freq_in_hzDesired output frequency in Hertz
Returns
status_success if PLL is initialized successfully
Note
Output frequency must be between 375MHz and 2.2GHz

◆ pllctl_init_int_pll_with_freq()

hpm_stat_t pllctl_init_int_pll_with_freq ( PLLCTL_Type ptr,
uint8_t  pll,
uint32_t  freq_in_hz 
)

#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_pllctl_drv.h>

Initializes a PLL in integer mode for a specific frequency.

Parameters
[in]ptrBase address of the PLLCTL peripheral
[in]pllIndex of the PLL to configure
[in]freq_in_hzDesired output frequency in Hertz
Returns
status_success if PLL is initialized successfully
Note
Output frequency must be between 375MHz and 2.2GHz

◆ pllctl_pll_is_enabled()

static bool pllctl_pll_is_enabled ( PLLCTL_Type ptr,
uint8_t  pll 
)
inlinestatic

#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_pllctl_drv.h>

Checks if a specified PLL is enabled.

Parameters
[in]ptrBase address of the PLLCTL peripheral
[in]pllIndex of the PLL to check
Returns
true if PLL is enabled, false otherwise

◆ pllctl_pll_is_locked()

static bool pllctl_pll_is_locked ( PLLCTL_Type ptr,
uint8_t  pll 
)
inlinestatic

#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_pllctl_drv.h>

Checks if a specified PLL is locked.

Parameters
[in]ptrBase address of the PLLCTL peripheral
[in]pllIndex of the PLL to check
Returns
true if PLL is locked, false otherwise

◆ pllctl_pll_powerdown()

static hpm_stat_t pllctl_pll_powerdown ( PLLCTL_Type ptr,
uint8_t  pll 
)
inlinestatic

#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_pllctl_drv.h>

Powers down a specified PLL.

Parameters
[in]ptrBase address of the PLLCTL peripheral
[in]pllIndex of the PLL to configure
Returns
status_success if PLL is powered down successfully
Note
This will stop the clock signals generated by the PLL

◆ pllctl_pll_poweron()

static hpm_stat_t pllctl_pll_poweron ( PLLCTL_Type ptr,
uint8_t  pll 
)
inlinestatic

#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_pllctl_drv.h>

Powers on a specified PLL.

Parameters
[in]ptrBase address of the PLLCTL peripheral
[in]pllIndex of the PLL to configure
Returns
status_success if PLL is powered on successfully
Note
The PLL must be properly configured before powering on

◆ pllctl_pll_setup_spread_spectrum()

hpm_stat_t pllctl_pll_setup_spread_spectrum ( PLLCTL_Type ptr,
uint8_t  pll,
uint8_t  ss_range,
uint32_t  modulation_freq,
pllctl_ss_type  ss_type 
)

#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_pllctl_drv.h>

Configures spread spectrum settings for a specified PLL.

Parameters
[in]ptrBase address of the PLLCTL peripheral
[in]pllIndex of the PLL to configure
[in]ss_rangeSpread spectrum range (0.x%)
[in]modulation_freqDesired modulation frequency in Hertz
[in]ss_typeType of spread spectrum modulation
Returns
status_success if spread spectrum is configured successfully

◆ pllctl_pll_ss_disable()

static hpm_stat_t pllctl_pll_ss_disable ( PLLCTL_Type ptr,
uint8_t  pll 
)
inlinestatic

#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_pllctl_drv.h>

Disables spread spectrum mode for a specified PLL.

Parameters
[in]ptrBase address of the PLLCTL peripheral
[in]pllIndex of the PLL to configure
Returns
status_success if spread spectrum is disabled successfully
Note
Disabling spread spectrum may increase EMI

◆ pllctl_pll_ss_enable()

hpm_stat_t pllctl_pll_ss_enable ( PLLCTL_Type ptr,
uint8_t  pll,
uint8_t  spread,
uint8_t  div,
bool  down_spread 
)

#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_pllctl_drv.h>

Enables spread spectrum mode for a specified PLL.

Parameters
[in]ptrBase address of the PLLCTL peripheral
[in]pllIndex of the PLL to configure
[in]spreadSpread spectrum depth (0.x%)
[in]divSpread spectrum divider (1-63)
[in]down_spreadtrue for down-spread, false for center-spread
Returns
status_success if spread spectrum is enabled successfully

◆ pllctl_set_div()

static hpm_stat_t pllctl_set_div ( PLLCTL_Type ptr,
uint8_t  pll,
uint8_t  div_index,
uint16_t  div 
)
inlinestatic

#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_pllctl_drv.h>

Sets the divider value for a specified PLL divider.

Parameters
[in]ptrBase address of the PLLCTL peripheral
[in]pllIndex of the PLL to configure
[in]div_indexDivider index (0: DIV0, 1: DIV1)
[in]divDivider value (1-based)
Returns
status_success if divider is set successfully

◆ pllctl_set_fbdiv_frac()

static hpm_stat_t pllctl_set_fbdiv_frac ( PLLCTL_Type ptr,
uint8_t  pll,
uint16_t  fbdiv 
)
inlinestatic

#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_pllctl_drv.h>

Sets the feedback divider for PLL fraction mode.

Parameters
[in]ptrBase address of the PLLCTL peripheral
[in]pllIndex of the PLL to configure
[in]fbdivFeedback divider value (0x1~0x1000)
Returns
status_success if feedback divider is set successfully

◆ pllctl_set_fbdiv_int()

static hpm_stat_t pllctl_set_fbdiv_int ( PLLCTL_Type ptr,
uint8_t  pll,
uint16_t  fbdiv 
)
inlinestatic

#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_pllctl_drv.h>

Sets the feedback divider for PLL integer mode.

Parameters
[in]ptrBase address of the PLLCTL peripheral
[in]pllIndex of the PLL to configure
[in]fbdivFeedback divider value (0x1~0x1000)
Returns
status_success if feedback divider is set successfully
Note
Fout = Fref/refdiv * fbdiv / postdiv1

◆ pllctl_set_frac()

static hpm_stat_t pllctl_set_frac ( PLLCTL_Type ptr,
uint8_t  pll,
uint32_t  frac 
)
inlinestatic

#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_pllctl_drv.h>

Sets the fractional part for PLL fraction mode.

Parameters
[in]ptrBase address of the PLLCTL peripheral
[in]pllIndex of the PLL to configure
[in]frac24-bit fractional value (0-2^24-1)
Returns
status_success if fractional value is set successfully
Note
The PLL must be powered down before changing the fractional value

◆ pllctl_set_pll_work_mode()

hpm_stat_t pllctl_set_pll_work_mode ( PLLCTL_Type ptr,
uint8_t  pll,
bool  int_mode 
)

#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_pllctl_drv.h>

Sets the operating mode of a specified PLL.

Parameters
[in]ptrBase address of the PLLCTL peripheral
[in]pllIndex of the PLL to configure
[in]int_modetrue for integer mode, false for fractional mode
Returns
status_success if mode is set successfully
Note
This function will power cycle the PLL if mode change is required

◆ pllctl_set_postdiv1()

static hpm_stat_t pllctl_set_postdiv1 ( PLLCTL_Type ptr,
uint8_t  pll,
uint8_t  div 
)
inlinestatic

#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_pllctl_drv.h>

Sets the post-divider (postdiv1) for a specified PLL.

Parameters
[in]ptrBase address of the PLLCTL peripheral
[in]pllIndex of the PLL to configure
[in]divPost-divider value (1-7)
Returns
status_success if post-divider is set successfully
Note
The post-divider affects the PLL's output frequency

◆ pllctl_set_refdiv()

hpm_stat_t pllctl_set_refdiv ( PLLCTL_Type ptr,
uint8_t  pll,
uint8_t  div 
)

#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_pllctl_drv.h>

Sets the reference divider for a specified PLL.

Parameters
[in]ptrBase address of the PLLCTL peripheral
[in]pllIndex of the PLL to configure
[in]divReference divider value (1-63)
Returns
status_success if reference divider is set successfully
Note
Minimum reference frequency: 1MHz for integer mode, 10MHz for fractional mode

◆ pllctl_xtal_is_enabled()

static bool pllctl_xtal_is_enabled ( PLLCTL_Type ptr)
inlinestatic

#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_pllctl_drv.h>

Checks if the crystal oscillator is enabled.

Parameters
[in]ptrBase address of the PLLCTL peripheral
Returns
true if crystal oscillator is enabled, false otherwise

◆ pllctl_xtal_is_stable()

static bool pllctl_xtal_is_stable ( PLLCTL_Type ptr)
inlinestatic

#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_pllctl_drv.h>

Checks if the crystal oscillator has stabilized.

Parameters
[in]ptrBase address of the PLLCTL peripheral
Returns
true if crystal oscillator is stable, false otherwise

◆ pllctl_xtal_set_rampup_time()

static void pllctl_xtal_set_rampup_time ( PLLCTL_Type ptr,
uint32_t  cycles 
)
inlinestatic

#include </home/docs/checkouts/readthedocs.org/user_builds/hpm-sdk/checkouts/latest/drivers/inc/hpm_pllctl_drv.h>

Sets the ramp-up time for the crystal oscillator.

Parameters
[in]ptrBase address of the PLLCTL peripheral
[in]cyclesNumber of IRC24M clock cycles for ramp-up
Note
The ramp-up time affects crystal oscillator startup