Public functions of the OSC PRAL driver. More...
Functions | |
volatile uint16_t | p33c_OscFrc_DefaultInitialize (volatile enum CPU_SPEED_DEFAULTS_e cpu_speed) |
Initializes the major oscillator and the PLL module step by step by using clock switching in software. Each step is tested and verified. PLL settings here are pulled from pre-defined settings set for default CPU speeds from 40 MIPS to 100 MIPS. More... | |
volatile uint16_t | p33c_OscFrc_Initialize (volatile enum CLKDIV_FRCDIVN_e frc_div, volatile enum OSCTUN_TUN_e frc_tune) |
Initializes the internal RC oscillator divider and tuning register. More... | |
volatile uint16_t | p33c_OscAuxClk_Initialize (volatile struct AUXOSC_CONFIG_s aux_clock_config) |
Initializes the auxiliary clock and its PLL module step by step in software. Each step is tested and verified. More... | |
volatile uint16_t | p33c_OscAuxClk_DefaultInitialize (volatile enum AUX_PLL_DEFAULTS_e afpllo_frequency) |
Initializes the auxiliary clock and its PLL module step by step in software. Each step is tested and verified. More... | |
volatile uint16_t | p33c_Osc_GetFrequencies (volatile uint32_t main_osc_frequency) |
This routine reads all oscillator related SFRs recalculating the various frequencies across clock domains. These frequencies are broadcasted in the global data structure 'system_frequencies'. More... | |
Public functions of the OSC PRAL driver.
This is the detailed description of public functions of the OSC PRAL driver
uint16_t p33c_Osc_GetFrequencies | ( | volatile uint32_t | main_osc_frequency | ) |
This routine reads all oscillator related SFRs recalculating the various frequencies across clock domains. These frequencies are broadcasted in the global data structure 'system_frequencies'.
smpsOSC_GetFrequencies()
main_osc_frequency | Frequency of external oscillator frequency in [Hz] of type unsigned integer. Set to '0' if no external oscillator is used. |
Microchip's 16-Bit devices offer multiple clock sources to clock the CPU. This routine reads the most recent, oscillator related Special Function Registers (SFR) and determines the recently active main clock and its frequency and calculates the resulting clock frequencies of other clock domains.
The results are broadcasted through the 'system_frequencies' data structure which is globally accessible in user code and can be used to calculate other oscillator dependent settings such as timer periods or baud rates of communication interfaces
Please note: The contents of data structure 'system_frequencies' is NOT updated automatically. It is recommended to call the function 'osc_get_frequencies' in user code every time after clock settings have been modified.
Definition at line 418 of file p33c_osc.c.
uint16_t p33c_OscAuxClk_DefaultInitialize | ( | volatile enum AUX_PLL_DEFAULTS_e | afpllo_frequency | ) |
Initializes the auxiliary clock and its PLL module step by step in software. Each step is tested and verified.
afpllo_frequency | Auxiliary PLL output frequency of type enum AUX_PLL_DEFAULTS_e |
The auxiliary clock is generated by a separate PLL module, which is driven from one of the main clock signals or PLL outputs. This auxiliary clock can be used to drive ADCs, PWM, DACs and other peripherals. Each of them might have individual requirements. Please refer to the specific peripheral sections in the device data sheet to learn how to configure the auxiliary clock.
Definition at line 352 of file p33c_osc.c.
uint16_t p33c_OscAuxClk_Initialize | ( | volatile struct AUXOSC_CONFIG_s | aux_clock_config | ) |
Initializes the auxiliary clock and its PLL module step by step in software. Each step is tested and verified.
aux_clock_config | Auxiliary oscillator configuration of type struct AUXOSC_CONFIG_s |
The auxiliary clock is generated by a separate PLL module, which is driven from one of the main clock signals or PLL outputs. This auxiliary clock can be used to drive ADCs, PWM, DACs and other peripherals. Each of them might have individual requirements. Please refer to the specific peripheral sections in the device data sheet to learn how to configure the auxiliary clock.
Definition at line 301 of file p33c_osc.c.
uint16_t p33c_OscFrc_DefaultInitialize | ( | volatile enum CPU_SPEED_DEFAULTS_e | cpu_speed | ) |
Initializes the major oscillator and the PLL module step by step by using clock switching in software. Each step is tested and verified. PLL settings here are pulled from pre-defined settings set for default CPU speeds from 40 MIPS to 100 MIPS.
cpu_speed | CPU speed setting of type enum CPU_SPEED_DEFAULTS_e |
Microchip's 16-Bit devices offer a safe 2-step start-up mode, using the internal FRC during power up, followed by a user defined switch-over to the desired oscillator. Though this can also be done in hardware automatically, this software-version of the switch-over offers a better solution to verify each step and enables the user to implement some error handling in the case of failure. This function can be used to select a new oscillator at runtime. Each configuration step will be verified before the next step is performed.
Definition at line 62 of file p33c_osc.c.
uint16_t p33c_OscFrc_Initialize | ( | volatile enum CLKDIV_FRCDIVN_e | frc_div, |
volatile enum OSCTUN_TUN_e | frc_tune | ||
) |
Initializes the internal RC oscillator divider and tuning register.
frc_div | Internal RC Oscillator frequency divider of type enum CLKDIV_FRCDIVN_e |
frc_tune | Internal RC Oscillator tuning register value of type enum OSCTUN_TUN_e |
Microchip's 16-Bit devices offer a safe 2-step start-up mode, using the internal FRC during power up, followed by a user defined switch-over to the desired oscillator. Though this can also be done in hardware automatically, this software-version of the switch-over offers a better solution to verify each step and enables the user to implement some error handling in the case of failure. This function can be used to select a new oscillator at runtime. Each configuration step will be verified before the next step is performed.
Definition at line 138 of file p33c_osc.c.