rp-hal icon indicating copy to clipboard operation
rp-hal copied to clipboard

Add other ADC modes: free-running, FIFO

Open 9names opened this issue 3 years ago • 3 comments

The current ADC implementation in the HAL only provides support for blocking one-shot samples.

Tasks:

  • Provide an API to configure the ADC into free-running mode.
  • Provide an API to configure the ADC sample FIFO, pacing timer, round-robin sampling and right shift options.
  • Add an example showing off each mode added

9names avatar Apr 02 '22 23:04 9names

There is no example in the C SDK for capturing multiple channels or handling the samples in the interrupt handler, though they do have one that uses DMA to capture the data

9names avatar Apr 02 '22 23:04 9names

Free-running mode support would be fantastic! Very much looking forward to this feature.

For reference, "the plan" is to hook up an analog multiplexer to a single analog pin on the RP2040 and then hook up additional multiplexers to each channel of the one that's connected to the RP2040 (i.e. multiplexers through a multiplexer). In free-running mode (without round-robin) this should--in theory--allow one to effectively bypass the RP2040's internal ADC MUX and replace it with an external one with the fastest performance possible... No need to issue blocking calls that tell the RP2040 which ADC pin to read from and enable non-blocking reads (well, reads that don't require 96 cycles).

Hopefully that'll be possible :smile:

riskable avatar Apr 04 '22 15:04 riskable

Resolved by #626 and #636

9names avatar Jul 12 '23 10:07 9names