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

SAADC offset calibration for each input?

Some questions regarding offset calibration when doing single samples (or burst mode) from multiple input pins:

  1. Can SAADC offset calibration be performed after SAADC initialization (nrf_drv_saadc_init), but prior to channel initialization (nrf_drv_saadc_channel_init)? My hunch is no, since offset calibration time is dependent on the acquisition time, which is a channel-specific parameter.

  2. Must the acquisition time used for offset calibration match the acq time used for the channel (or can I shorten during cal)? What are the implications of different times?

  3. Does SAADC offset calibration need to be performed for each input (AINx), or does the offset apply to all input pins? i.e. If I intend to use multiple AIN inputs (AIN1, AIN2, etc), do I need to call nrf_drv_saadc_calibrate_offset for each input (after each channel initialization)?

I would like to do infrequent sampling of multiple analog inputs. I'm using one SAADC channel, and reconfiguring it with each input prior to the sample. Can I do this:

  • Init SAADC (nrf_drv_saadc_init)
  • Set up a bogus channel using the desired acq time for offfset cal
  • Calibrate offset (nrf_drv_saadc_calibrate_offset)
  • Init Channel 1 with AIN1 (nrf_drv_saadc_channel_init)
  • Sample Channel 1 (nrf_drv_saadc_sample)
  • Uninit Channel 1
  • Init Channel 1 with AIN2 (nrf_drv_saadc_channel_init)
  • Uninit Channel 1
  • ...Repeat for remaining AINx...
  • Uninit SAADC (nrf_drv_saadc_uninit)
  • Sleep until next interval

Or do I need to rerun calibrate offset with each new AINx?

Parents
  • Hi,

    I will answer all your three questions in one, as they float a bit into each other. SAADC offset calibration can be run before any channels are initialized. The nRF52 does only have one ADC, with 8 multiplexed analog inputs. The offset calibration is applied to the ADC, and will be the same for all channels. Offset calibration time is not directly dependent on the acquisition time, but the calibration task will not set any specific acquisition time, but will use the previously set or default config. The calibration task will sample GND and use an algorithm to find the ideal offset value. The required acquisition time is dependent on source resistance, but this should not be relevant for sampling of GND. For the sampling, channel 0 is used, so if you have configured any acquisition time on this channel it will affect the calibration time. If you change other channels config it should not affect the time. You can easily test this yourself, by setting different configs for different channels and run offset calibration. 

    So to sum it up, you should only need to run offset calibration on startup and on regular intervals or temperature changes.

    Best regards,

    Jørgen

Reply
  • Hi,

    I will answer all your three questions in one, as they float a bit into each other. SAADC offset calibration can be run before any channels are initialized. The nRF52 does only have one ADC, with 8 multiplexed analog inputs. The offset calibration is applied to the ADC, and will be the same for all channels. Offset calibration time is not directly dependent on the acquisition time, but the calibration task will not set any specific acquisition time, but will use the previously set or default config. The calibration task will sample GND and use an algorithm to find the ideal offset value. The required acquisition time is dependent on source resistance, but this should not be relevant for sampling of GND. For the sampling, channel 0 is used, so if you have configured any acquisition time on this channel it will affect the calibration time. If you change other channels config it should not affect the time. You can easily test this yourself, by setting different configs for different channels and run offset calibration. 

    So to sum it up, you should only need to run offset calibration on startup and on regular intervals or temperature changes.

    Best regards,

    Jørgen

Children
No Data
Related