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

Clock source used by SAADC and UART ?

Hi,

I am currently working on the development of a product based around a nRF52832 (inside a Laird BL-652 module).

I am trying to understand how the different clocks are used in the system.

I have configured the LFCLK source to 0 (RC oscillator) and calibration is enabled (CTIV = 16, TEMP_CTIV = 2)

From my understanding :

  • The system starts with LFCLK set to LFRC and HFCLK set to HFINT
  • The Softdevice (S112 v6) starts and request the start of HFXO.
  • Once HFXO is started, it is used as base for HFCLK

Here are my questions :

  1. Can you confirm that my assumptions are correct regarding the previous points ?
  2. I start the nrf_log module with UART as backend (baudrate 115200). I guess HFCLK is used : but which signal is actually used by the UART peripheral ? PCLK1M ? PCLK16M ?
  3. I am using the SAADC to read manually a couple of analog values. low_power_mode is set to false and no oversampling is done. Could you tell me which clock signal is used to control the SAADC ? The documentation says either RTC or TIMER (1 or 16 MHz)...
  4. I have a PWM signal configured with base_clock to NRF_PWM_CLK_16MHz, so I guess this one is pretty clear that it is using PCLK16M (just checking if I'm right there)

Thanks.

Parents
    1. Yes, you are correct.

    2. I believe it's PCLK16M. Both PCLK16M and 1M are just clock divisions from HFCLK.

    3. The RTC uses the LFCLK, the TIMER uses PCLK16M. Any EVENT from any peripheral can be used to trigger the SAADC's SAMPLE TASK, not just the timers/counters. For best SAADC results it's recommended to use the TIMER with HFXO running. 

    4. Yup! 
  • Thanks for your answers.

    Regarding the point 3, this is what I use to configure and start the SAADC :

      static const nrf_drv_saadc_config_t config = {
        .resolution = NRF_SAADC_RESOLUTION_12BIT,
        .oversample = NRF_SAADC_OVERSAMPLE_DISABLED,
        .interrupt_priority = APP_SAADC_IRQ_PRIORITY,
        .low_power_mode = false,
      };
      
      ...
      
      nrf_saadc_channel_config_t channel_config = NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(SAADC_INPUT_BATT);
      err_code = nrf_drv_saadc_channel_init(SAADC_CHANNEL_BATT, &channel_config);
      
      ...
      
      nrf_drv_saadc_sample();

    I guess it's TIMER with PCLK26M that's used in this case by the SAADC (for sampling I mean not for triggering the conversion) ?

  • No, you're just manually triggering the SAMPLE TASK from CPU once by calling nrf_drv_saadc_sample(). 

    You need to set-up a TIMER with a COMPARE EVENT connected to the SAADC's SAMPLE TASK to continuously trigger sample the SAADC. 

    Remember to set an acquisition time relative to your source impedance, according to the SAADC spec. See the Acquisition time chapter for details. 

  • The sample() function is already called periodically through the use of the app_timer module in my code.

    I was actually wondering what clock was used to handle the acquisition time and to make the SAADC actualy work (for a single sample).

Reply Children
Related