nRF52832 Multiple ADC with different rates

I need to use both AIN0 and AIN1 of nRF52832. AIN0 is measuring once per minute and AIN1 is measuring once per second. What would be the best approach for this? Thanks

Parents
  • This depends a bit I guess on wheter you are using nRF5 SDK or nRF Connect SDK. but for the nRF5 SDK you for instance use an app_timer without timeout of 1second, then in the timeout handler you increment a counter, and then start the ADC sampling of AIN1, and shortly after in the ADC callback handler you have the AIN1 sample value available. You can in the ADC callback handler also check the counter, and if(counter%60) you can also trigger sampling of AIN0, wait for yet another ADC callback handler for the AIN0 sample value.

    Best regards,
    Kenneth

  • If I use 2 separate timers to trigger sampling, what happens if AIN1 sampling begins while AIN0 sampling is still in process? Also in the ADC callback handler, is there a way to distinguish which channel the conversion result is from? Thanks

Reply Children
Related