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

After configured internal low frequency clock source,advertising stop but saadc still working

The program flow of the slave is to sample the analog signal source through the saadc and then send it to the host through the nus.
When debugging on nrf52dk, configure the chip to xtal mode and the program can run smoothly. But when the chip is configured as a 32.768k internal low-frequency clock source RC, after each reset, the broadcast signal appears for a while and disappears, but the saadc sampling continues to run. Why?
The strange thing is that the first run after programming the program is normal.

  • Hi

    How did you configure your application to use the internal RC clock? It's recommended to do so by editing the following defines in the sdk_config.h header file to these values:

    // <h> Clock - SoftDevice clock configuration
    
    //==========================================================
    // <o> NRF_SDH_CLOCK_LF_SRC  - SoftDevice clock source.
     
    // <0=> NRF_CLOCK_LF_SRC_RC 
    // <1=> NRF_CLOCK_LF_SRC_XTAL 
    // <2=> NRF_CLOCK_LF_SRC_SYNTH 
    
    #ifndef NRF_SDH_CLOCK_LF_SRC
    #define NRF_SDH_CLOCK_LF_SRC 0
    #endif
    
    // <o> NRF_SDH_CLOCK_LF_RC_CTIV - SoftDevice calibration timer interval. 
    #ifndef NRF_SDH_CLOCK_LF_RC_CTIV
    #define NRF_SDH_CLOCK_LF_RC_CTIV 16
    #endif
    
    // <o> NRF_SDH_CLOCK_LF_RC_TEMP_CTIV - SoftDevice calibration timer interval under constant temperature. 
    // <i> How often (in number of calibration intervals) the RC oscillator shall be calibrated
    // <i>  if the temperature has not changed.
    
    #ifndef NRF_SDH_CLOCK_LF_RC_TEMP_CTIV
    #define NRF_SDH_CLOCK_LF_RC_TEMP_CTIV 2
    #endif
    
    // <o> NRF_SDH_CLOCK_LF_ACCURACY  - External clock accuracy used in the LL to compute timing.
     
    // <0=> NRF_CLOCK_LF_ACCURACY_250_PPM 
    // <1=> NRF_CLOCK_LF_ACCURACY_500_PPM 
    // <2=> NRF_CLOCK_LF_ACCURACY_150_PPM 
    // <3=> NRF_CLOCK_LF_ACCURACY_100_PPM 
    // <4=> NRF_CLOCK_LF_ACCURACY_75_PPM 
    // <5=> NRF_CLOCK_LF_ACCURACY_50_PPM 
    // <6=> NRF_CLOCK_LF_ACCURACY_30_PPM 
    // <7=> NRF_CLOCK_LF_ACCURACY_20_PPM 
    // <8=> NRF_CLOCK_LF_ACCURACY_10_PPM 
    // <9=> NRF_CLOCK_LF_ACCURACY_5_PPM 
    // <10=> NRF_CLOCK_LF_ACCURACY_2_PPM 
    // <11=> NRF_CLOCK_LF_ACCURACY_1_PPM 
    
    #ifndef NRF_SDH_CLOCK_LF_ACCURACY
    #define NRF_SDH_CLOCK_LF_ACCURACY 1
    #endif

    Can you provide some more information on what you mean abot that the signal appears for "a while? How long is this? Have you tried to broadcast without running the SAADC sampling?

    Best regards,

    Simon

  • Thanks for your answer.

    I am sure that I have confugured my application to use internal RC cloock, and the parameter values are the same as you provide above.And without running the SAADC sanmpling, the broadcast function can work smoothly.

    But after adding the saadc function, burn the program and debug it in keil , press the run button, the program will broadcast normally, and start sampling after 0.5 seconds. But when entering the second timer callback function, that is, when the second data sampling is performed, the sampling fails, and the APP_ERROR_CHECK function terminates the program.

    In the second situation,when I download the program to chip directly, after each reset, the program only broadcast for 0.5 seconds. But the saadc sampling continues to run normally, and never stop. 

    Look forward to your reply. Thank you again.

  • Hi

    What pins are you using for SAADC sampling in your application? Please note that the following GPIOs mentioned here are recommended to be used at low drive, low frequency only as they're located close to the radio, and will affect the radio's performance if used for high freq. operations (>10 kHz) while the radio is running.

    Best regards,

    Simon

  • Hi

    I used p0.03/AIN1 pin for SAADC sampling, it isn't in the table of GPIO mentioned you mean.

  • Hi

    Can you provide some information as to what error code you're seeing when the APP_ERROR_CHECK function terminates the program, as I think that will give us a pointer as to what's causing this. It seems very strange that the ADC should have any effect on the RC oscillator.

    Best regards,

    Simon

Related