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

Can Internal RC be used for BLE comms?

MS76SF2_SCH_V12.pdfHi, I am using SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_SYNTH_250_PPM, NULL); for ble_Stack_init() because the off the shelf board (not from Nordic) goes into a never ending loop when SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, NULL) is used. The external crystal does produce clock signals, but I think the loading capacitors are not right. Anyway, if I use NRF_CLOCK_LFCLKSRC_SYNTH_250_PPM, will this RC clock be accurate enough to keep the BLE connection (I am basically using ble_app_uart as base) going? Another question is, will the EMC testing pass with NRF_CLOCK_LFCLKSRC_SYNTH_250_PPM as clock source? Thanks.

  • I have manually started the external HF clock using the following: NRF_CLOCK->EVENTS_HFCLKSTARTED = 0; NRF_CLOCK->TASKS_HFCLKSTART = 1;

    	while(NRF_CLOCK->EVENTS_HFCLKSTARTED == 0)
    	{
    	}    
    

    At this stage, using the peripherals/system viewer/clock tool in Keil, I am able to see that: EVENTS_HFCLKSTARTED = 1; HFCLKRUN: STATUS=1 : Triggered = Task HFCLKSTART has been triggered; HFCLKSTAT:0x00010001: SRC: 1: Xtal= External 16MHz/32MHz crystal oscillator running and generating the HFCLK. State: 1: Running = HFCLK clock running; XTALFREQ: 0xFFFFFFFF; XTALFREQ = 0xFF (meaning 16MHz clock according to nRF51 reference manual). So, Now, I know that the external 16MHz clock has been started. Also I checked the pin 37 and 38 of the nrf51 and I can see ~16.2MHz clock. BUt, now when I call the following: SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, NULL); The program flow never comes back.. Any ideas as how to debug?

  • Hi, RK, thanks for your reply. Sorry, I have troubles understanding your previous answer. According to the nrf51 reference manual, LFCLKSRC can be one of the following: 0: Internal 32KHz RC oscillator; 1: External 32KHz crystal; 2: Internal 32KHz synthesiser from HFCLK system clock. And I am left with (I use SDK 10.0 and s110) only one of the following options to be used in SOFTDEVICE_HANDLER_INIT. All the following options are LF. If I want to use LF external crystal, then, I need 32KHz connected across XL1 and XL2, right? Or, I could use 16MHz (which is the external crystal connected across XC1 and XC2) and use this as my HFCLK and use internal 32HZ synthesiser to synthesise the LF clock needed for SOFTDEVICE_HANDLER_INIT from external crystal, 16MHz, right? In other words, how can I use 16MHz external crystal to feed the required LF crystal clock (as needed by SOFTDEVICE_HANDLER_INIT)?:

    /@brief Possible lfclk oscillator sources. */ enum NRF_CLOCK_LFCLKSRCS { NRF_CLOCK_LFCLKSRC_SYNTH_250_PPM, /< LFCLK Synthesized from HFCLK. */

    NRF_CLOCK_LFCLKSRC_XTAL_500_PPM, /**< LFCLK crystal oscillator 500 PPM accuracy. */

    NRF_CLOCK_LFCLKSRC_XTAL_250_PPM, /**< LFCLK crystal oscillator 250 PPM accuracy. */

    NRF_CLOCK_LFCLKSRC_XTAL_150_PPM, /**< LFCLK crystal oscillator 150 PPM accuracy. */

    NRF_CLOCK_LFCLKSRC_XTAL_100_PPM, /**< LFCLK crystal oscillator 100 PPM accuracy. */

    NRF_CLOCK_LFCLKSRC_XTAL_75_PPM, /**< LFCLK crystal oscillator 75 PPM accuracy. */

    NRF_CLOCK_LFCLKSRC_XTAL_50_PPM, /**< LFCLK crystal oscillator 50 PPM accuracy. */

    NRF_CLOCK_LFCLKSRC_XTAL_30_PPM, /**< LFCLK crystal oscillator 30 PPM accuracy. */

    NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, /**< LFCLK crystal oscillator 20 PPM accuracy. */

    NRF_CLOCK_LFCLKSRC_RC_250_PPM_250MS_CALIBRATION, /**< LFCLK RC oscillator, 250ms calibration interval.*/

    NRF_CLOCK_LFCLKSRC_RC_250_PPM_500MS_CALIBRATION, /**< LFCLK RC oscillator, 500ms calibration interval.*/

    NRF_CLOCK_LFCLKSRC_RC_250_PPM_1000MS_CALIBRATION, /**< LFCLK RC oscillator, 1000ms calibration interval.*/

    NRF_CLOCK_LFCLKSRC_RC_250_PPM_2000MS_CALIBRATION, /**< LFCLK RC oscillator, 2000ms calibration interval.*/

    NRF_CLOCK_LFCLKSRC_RC_250_PPM_4000MS_CALIBRATION, /**< LFCLK RC oscillator, 4000ms calibration interval.*/

    NRF_CLOCK_LFCLKSRC_RC_250_PPM_8000MS_CALIBRATION, /**< LFCLK RC oscillator, 8000ms calibration interval.*/

    NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_1000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 1000ms, if changed above a threshold, a calibration is done.*/

    NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_2000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 2000ms, if changed above a threshold, a calibration is done.*/

    NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_4000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 4000ms, if changed above a threshold, a calibration is done.*/

    NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_8000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 8000ms, if changed above a threshold, a calibration is done.*/

    NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_16000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 16000ms, if changed above a threshold, a calibration is done.*/

    };

  • Hi RK, To give you an update, this is what happens when I call "SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, NULL);" in s110, SDK10.0 version the program flow never returns back. When I hit the halt button and see under Peripherals, System Viewer, clock (in keil), I see the following: LFCLKRUN: STATUS: 1: Triggered = Task LFCLKSTART has been triggered; LFCLKSTAT: 0x00010000: SRC: 0: RC = Internal 32KHz RC Oscillator running and generating the LFCLK clock (THIS NEEDS TO BE 1: XTAL - EXTERNAL 32KHZ XTAL OSCILLATOR RUNNING, right?); STATE: 1: Running = LFCLK clock running; LFCLKSRCCOPY = 0x00000001: SRC: 1: Xtal = External 32KHz crystal. LFCLKSRC: 0x00000001: SRC = 1: Xta; = External 32KHz crystal; XTALFREQ = 0xFFFFFFFF

  • Hi RK, as you can see in the attached schematics from the 3rd party manufacturer, there is no external 32KHz oscillator. There is only 16MHz oscillator. Will this be the reason why "SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, NULL);" never returns back - because there is no LF Xtal oscillator(32KHz)? In this case, would this : "SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_RC_250_PPM_250MS_CALIBRATION, NULL);" be the best option to use? (Since you do not recommend starting 16MHZ xtal oscillator first - use this as HF clock and then use SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_SYNTH_250_PPM, NULL);)

  • Hi RK, thanks for the response. If there is no LFCLK crystal connected in the board, then, we are left with only one option, which is, using internal RC oscillator. right?

Related