Digital Power Starter Kit 3 Firmware
dsPIC33C Buck Converter Voltage Mode Control Example
init_fosc.c
1 /*
2  * File: init_fosc.c
3  * Author: M91406
4  *
5  * Created on July 8, 2019, 1:55 PM
6  */
7 
8 
9 #include <xc.h>
10 #include <stdint.h>
11 #include <stdbool.h>
12 
13 #include "config/init/init_fosc.h"
14 #include "p33c_osc.h"
15 
16 #define TIMEOUT_LIMIT 5000 // timeout counter maximum
17 
18 
32 volatile uint16_t sysFosc_Initialize(void)
33 {
34  volatile uint16_t retval=1;
35 
36  retval = p33c_OscFrc_DefaultInitialize(CPU_SPEED_100_MIPS);
37 
38  return(retval);
39 
40 }
41 
42 
55 volatile uint16_t sysAclk_Initialize(void) {
56 
57  volatile uint16_t retval=1;
58 
59  retval &= p33c_OscAuxClk_DefaultInitialize(AFPLLO_500_MHZ);
60 
61  return(retval);
62 }
63 
64 // end of file
65 
p33c_OscFrc_DefaultInitialize
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...
Definition: p33c_osc.c:62
sysAclk_Initialize
volatile uint16_t sysAclk_Initialize(void)
Initializes the auxiliary clock of the device.
Definition: init_fosc.c:55
p33c_OscAuxClk_DefaultInitialize
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 ...
Definition: p33c_osc.c:352
sysFosc_Initialize
volatile uint16_t sysFosc_Initialize(void)
System oscillator initialization.
Definition: init_fosc.c:32