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

Gain setting change on the fly

On the nRF52810 is it posible to change the gain setting for the SAADC on demand? For example the SAADC is reaching its cap and then the gain is increased so it is posible to read higher values on the ADC but at the lower values have increased accuracy.

Parents
  • You should be able to use the limits events for this, that should allow you to react, provided you have time between sample events. Note the gain error is slightly different between gain settings, so you will experience slight discontinuities between samples for two different gain settings. One way to fix that would be to sample a known input with all gain settings, and store the relative error. 

    Note the gain settings are applied immediately, so you don’t need to stop the adc for the gain to change.

    Another option could be to sample the input with scan and different gain settings, then you could just pick the right one afterwards. But there will be tconv+tacq time between scan samples, so if you care about us timing jitter it might be better to change the gain setting between samples.

Reply
  • You should be able to use the limits events for this, that should allow you to react, provided you have time between sample events. Note the gain error is slightly different between gain settings, so you will experience slight discontinuities between samples for two different gain settings. One way to fix that would be to sample a known input with all gain settings, and store the relative error. 

    Note the gain settings are applied immediately, so you don’t need to stop the adc for the gain to change.

    Another option could be to sample the input with scan and different gain settings, then you could just pick the right one afterwards. But there will be tconv+tacq time between scan samples, so if you care about us timing jitter it might be better to change the gain setting between samples.

Children
No Data
Related