File tree Expand file tree Collapse file tree 4 files changed +18
-12
lines changed
app.X/mcc_generated_files
boot.X/mcc_generated_files Expand file tree Collapse file tree 4 files changed +18
-12
lines changed Original file line number Diff line number Diff line change @@ -62,8 +62,8 @@ void CLOCK_Initialize(void)
6262 APLLFBD1 = 0x96 ;
6363 // APOST1DIV 1:4; APOST2DIV 1:1; AVCODIV FVCO/4;
6464 APLLDIV1 = 0x41 ;
65- // CANCLKEN enabled; CANCLKSEL AFVCO/4 ; CANCLKDIV Divide by 15;
66- CANCLKCON = 0x8A0E ;
65+ // CANCLKEN enabled; CANCLKSEL FPLLO ; CANCLKDIV Divide by 15;
66+ CANCLKCON = 0x820E ;
6767 // ROEN disabled; ROSWEN disabled; ROSLP disabled; ROSEL FOSC; ROOUT disabled; ROSIDL disabled;
6868 REFOCONL = 0x00 ;
6969 // RODIV 0;
@@ -90,7 +90,10 @@ void CLOCK_Initialize(void)
9090 PMD8 = 0x00 ;
9191 // CF no clock failure; NOSC PRIPLL; CLKLOCK unlocked; OSWEN Switch is Complete;
9292 __builtin_write_OSCCONH ((uint8_t ) (0x03 ));
93- __builtin_write_OSCCONL ((uint8_t ) (0x00 ));
93+ __builtin_write_OSCCONL ((uint8_t ) (0x01 ));
94+ // Wait for Clock switch to occur
95+ while (OSCCONbits .OSWEN != 0 );
96+ while (OSCCONbits .LOCK != 1 );
9497}
9598
9699bool CLOCK_AuxPllLockStatusGet ()
Original file line number Diff line number Diff line change 5858#pragma config BSLIM = 8191 //Boot Segment Flash Page Address Limit bits->8191
5959
6060// FOSCSEL
61- #pragma config FNOSC = PRIPLL //Oscillator Source Selection->Primary Oscillator with PLL module (XT + PLL, HS + PLL, EC + PLL)
62- #pragma config IESO = ON //Two-speed Oscillator Start-up Enable bit->Start up device with FRC, then switch to user-selected oscillator source
61+ #pragma config FNOSC = FRC //Oscillator Source Selection->FRC
62+ #pragma config IESO = OFF //Two-speed Oscillator Start-up Enable bit->Start up with user-selected oscillator source
6363
6464// FOSC
6565#pragma config POSCMD = XT //Primary Oscillator Mode Select bits->XT Crystal Oscillator Mode
6666#pragma config OSCIOFNC = ON //OSC2 Pin Function bit->OSC2 is general purpose digital I/O pin
67- #pragma config FCKSM = CSDCMD //Clock Switching Mode bits->Both Clock switching and Fail-safe Clock Monitor are disabled
67+ #pragma config FCKSM = CSECMD //Clock Switching Mode bits->Clock switching is enabled, Fail-safe Clock Monitor is disabled
6868#pragma config PLLKEN = ON //PLL Lock Status Control->PLL lock signal will be used to disable PLL clock output if lock is lost
6969#pragma config XTCFG = G1 //XT Config->8-16 MHz crystals
7070#pragma config XTBST = ENABLE //XT Boost->Boost the kick-start
Original file line number Diff line number Diff line change @@ -62,8 +62,8 @@ void CLOCK_Initialize(void)
6262 APLLFBD1 = 0x96 ;
6363 // APOST1DIV 1:4; APOST2DIV 1:1; AVCODIV FVCO/4;
6464 APLLDIV1 = 0x41 ;
65- // CANCLKEN enabled; CANCLKSEL AFVCO/4 ; CANCLKDIV Divide by 15;
66- CANCLKCON = 0x8A0E ;
65+ // CANCLKEN enabled; CANCLKSEL FPLLO ; CANCLKDIV Divide by 15;
66+ CANCLKCON = 0x820E ;
6767 // ROEN disabled; ROSWEN disabled; ROSLP disabled; ROSEL FOSC; ROOUT disabled; ROSIDL disabled;
6868 REFOCONL = 0x00 ;
6969 // RODIV 0;
@@ -90,7 +90,10 @@ void CLOCK_Initialize(void)
9090 PMD8 = 0x00 ;
9191 // CF no clock failure; NOSC PRIPLL; CLKLOCK unlocked; OSWEN Switch is Complete;
9292 __builtin_write_OSCCONH ((uint8_t ) (0x03 ));
93- __builtin_write_OSCCONL ((uint8_t ) (0x00 ));
93+ __builtin_write_OSCCONL ((uint8_t ) (0x01 ));
94+ // Wait for Clock switch to occur
95+ while (OSCCONbits .OSWEN != 0 );
96+ while (OSCCONbits .LOCK != 1 );
9497}
9598
9699bool CLOCK_AuxPllLockStatusGet ()
Original file line number Diff line number Diff line change 5858#pragma config BSLIM = 8191 //Boot Segment Flash Page Address Limit bits->8191
5959
6060// FOSCSEL
61- #pragma config FNOSC = PRIPLL //Oscillator Source Selection->Primary Oscillator with PLL module (XT + PLL, HS + PLL, EC + PLL)
62- #pragma config IESO = ON //Two-speed Oscillator Start-up Enable bit->Start up device with FRC, then switch to user-selected oscillator source
61+ #pragma config FNOSC = FRC //Oscillator Source Selection->FRC
62+ #pragma config IESO = OFF //Two-speed Oscillator Start-up Enable bit->Start up with user-selected oscillator source
6363
6464// FOSC
6565#pragma config POSCMD = XT //Primary Oscillator Mode Select bits->XT Crystal Oscillator Mode
6666#pragma config OSCIOFNC = ON //OSC2 Pin Function bit->OSC2 is general purpose digital I/O pin
67- #pragma config FCKSM = CSDCMD //Clock Switching Mode bits->Both Clock switching and Fail-safe Clock Monitor are disabled
67+ #pragma config FCKSM = CSECMD //Clock Switching Mode bits->Clock switching is enabled, Fail-safe Clock Monitor is disabled
6868#pragma config PLLKEN = ON //PLL Lock Status Control->PLL lock signal will be used to disable PLL clock output if lock is lost
6969#pragma config XTCFG = G1 //XT Config->8-16 MHz crystals
7070#pragma config XTBST = ENABLE //XT Boost->Boost the kick-start
You can’t perform that action at this time.
0 commit comments