Skip to content

Configuration

The compile-time defaults of the driver: what each CONFIG_ADS9324_* macro changes and how to set it.

Run-time settings (range, input type, bandwidth, offset, gain, data format) are method calls; the API guide covers them. The macros below only change the values the driver starts with. They are read in inc/ads9324_config.hpp into the ADS9324_CFG namespace.

Defaults

Each macro below is CONFIG_ADS9324_ followed by the name in the first column.

Name Effect; default without it
RANGE_12V5, RANGE_10V, RANGE_6V25, RANGE_2V5 Range written to every channel at initialisation, DEFAULT_RANGE; ±5 V
SINGLE_ENDED Input type written to every channel, DEFAULT_INPUT_TYPE; differential
PGA_WIDE Filter written to every channel, DEFAULT_BANDWIDTH; low bandwidth
OFFSET_BINARY Data format written to GEN_CFG3 at initialisation, DEFAULT_FORMAT; two's complement
SKIP_DEVICE_ID_CHECK EnsureInitialized() stops requiring DEVICE_ID = 0x0004; check on
POWER_ON_DELAY_MS Wait before the first frame, in ms; 30 (tPU)
RESET_DELAY_MS Wait after the software reset, in ms; 1
RESET_PULSE_US How long HardwareReset() holds RESET low, in µs; 10 (the datasheet gives no minimum)
DRDY_TIMEOUT_US DRDY poll budget after CONVST, in 1 µs steps, times N with internal-clock oversampling; 1000
ADC_CAL_WAIT_MS Wait after triggering RunAdcCalibration() before checking CALIB_BUSY, in ms; 125 (TWAIT, Table 7-7)
ADC_CAL_TIMEOUT_MS Further CALIB_BUSY poll budget, in 1 ms steps; 125
CONV_FALLBACK_US Wait after CONVST when HasDrdy() is false, in µs, times N with internal-clock oversampling; 10

EnsureInitialized() and SoftwareReset() write the range, input type and bandwidth defaults to all 16 channels (the PGA_CONFIG and PGA_BW_SEL registers of both channel banks) and to the driver's cache, so the chip and the voltage conversion agree without a ConfigureAllChannels() call. ADS9324<...>::DefaultChannelConfig() returns the resulting ChannelConfig.

Do not lower POWER_ON_DELAY_MS below 30 unless your REFCAP capacitor is smaller than the datasheet's 1 µF, and keep CONV_FALLBACK_US above the conversion time (1.25 µs without oversampling).

Set them

target_compile_definitions(my_app PRIVATE
  CONFIG_ADS9324_RANGE_10V
  CONFIG_ADS9324_DRDY_TIMEOUT_US=200)
# main/CMakeLists.txt, after idf_component_register()
target_compile_definitions(${COMPONENT_LIB} PRIVATE
  CONFIG_ADS9324_RANGE_10V
  CONFIG_ADS9324_DRDY_TIMEOUT_US=200)

Define the macros for every translation unit that includes ads9324.hpp: the driver is a template, so each one compiles its own copy, and different values in different files break the one-definition rule.

Fixed settings

These are constants, not macros: DEFAULT_LANES (DoutLaneMode::Lane1), DEFAULT_LENGTH (DoutLength::Bits16) and DEFAULT_DATA_ON_SDOUT (true) give GEN_CFG3 = 0x0032. Change them at run time with SetDigitalInterface().