mirror of
https://github.com/travisgoodspeed/goodwatch
synced 2024-11-21 23:58:31 +00:00
Attempts to lock the crystal more than once. Sometimes helps on startup fault.
This commit is contained in:
parent
aea5c3d570
commit
61b53446bd
@ -24,11 +24,18 @@ void ucs_slow(){
|
||||
|
||||
//! Initialize the XT1 crystal, and stabilize it.
|
||||
void ucs_init(){
|
||||
P5SEL |= BIT0 + BIT1; // Select XT1
|
||||
UCSCTL6 |= XCAP_1; // Internal load cap
|
||||
uint16_t i=0;
|
||||
|
||||
|
||||
// Loop until XT1 & DCO stabilizes
|
||||
do{
|
||||
if(i++==0){
|
||||
UCSCTL6 |= XT1DRIVE_3; // Higher drive strength.
|
||||
P5SEL |= BIT0 + BIT1; // Select XT1
|
||||
UCSCTL6 |= XCAP_1; // Internal load cap
|
||||
}
|
||||
|
||||
|
||||
UCSCTL7 &= ~(XT1LFOFFG + DCOFFG);
|
||||
// Clear LFXT1,DCO fault flags
|
||||
SFRIFG1 &= ~OFIFG; // Clear fault flags
|
||||
|
Loading…
Reference in New Issue
Block a user