This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

external XTAL and internal oscillator

Is it possible to completely disable the internal oscillator and only use an external LF XTAL?

Parents
  • If you're talking about the LFRC, then yes. If you've configured the device to use an LF XTAL then the LF RC is automatically disabled. 

  • Interesting.   I believe I have done that in this section of code, however, I never seem to get past the while statement, and if I comment out the while loop, the k_sleep never returns.  Is there something I'm missing here?

     // Make sure we are using the external 32.768 kHz crystal osciallator (LFXO)
    	NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos)|(CLOCK_LFCLKSRC_BYPASS_Enabled << CLOCK_LFCLKSRC_BYPASS_Pos ) |
    		(CLOCK_LFCLKSRC_EXTERNAL_Enabled << CLOCK_LFCLKSRC_EXTERNAL_Pos);
    
    
    	NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
    	NRF_CLOCK->TASKS_LFCLKSTART = 1;
    
    		while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0) {
    			// Do Nothing
    		}
    
        start_time = k_cycle_get_32();
        
        k_sleep(1000);
        

Reply
  • Interesting.   I believe I have done that in this section of code, however, I never seem to get past the while statement, and if I comment out the while loop, the k_sleep never returns.  Is there something I'm missing here?

     // Make sure we are using the external 32.768 kHz crystal osciallator (LFXO)
    	NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos)|(CLOCK_LFCLKSRC_BYPASS_Enabled << CLOCK_LFCLKSRC_BYPASS_Pos ) |
    		(CLOCK_LFCLKSRC_EXTERNAL_Enabled << CLOCK_LFCLKSRC_EXTERNAL_Pos);
    
    
    	NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
    	NRF_CLOCK->TASKS_LFCLKSTART = 1;
    
    		while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0) {
    			// Do Nothing
    		}
    
        start_time = k_cycle_get_32();
        
        k_sleep(1000);
        

Children
Related