An Analog-to-Digital Converter (ADC) is a device that translates an analog voltage to a digital value that a microprocessor can understand.

The NXP system-on-module has one ADC controller with 8 internal and 8 externally available channels with 12-bit resolution.

Available ADC pins

On the ConnectCore 95:

  • ADC_IN0 to ADC_IN3 channels are available at the LGA pads. Check the Hardware reference manuals for information about pads and ADC channels.

On the ConnectCore 95 Development Kit:

  • All ADC channels are accessible on the expansion connector J44:

    • ADC_IN0 (ADC1 channel 0)

    • ADC_IN1 (ADC1 channel 1)

    • ADC_IN2 (ADC1 channel 2)

    • ADC_IN3 (ADC1 channel 3)

    • ADC_IN4 (ADC1 channel 4)

    • ADC_IN5 (ADC1 channel 5)

    • ADC_IN6 (ADC1 channel 6)

    • ADC_IN7 (ADC1 channel 7)

Kernel configuration

You can manage the i.MX95 ADC driver support through the following kernel configuration option:

  • IMX93 ADC driver (CONFIG_IMX93_ADC)

This option is enabled as built-in on the default ConnectCore 95 kernel configuration file.

Kernel driver

The ADC driver is located at:

File Description

drivers/iio/adc/imx93_adc.c

i.MX95 IMX93 ADC driver

Device tree bindings and customization

i.MX95 ADC interface

i.MX95 device tree
adc1: adc@44530000 {
	compatible = "nxp,imx93-adc";
	reg = <0x44530000 0x10000>;

	interrupts = <GIC_SPI 199 IRQ_TYPE_LEVEL_HIGH>,
			<GIC_SPI 200 IRQ_TYPE_LEVEL_HIGH>,
			<GIC_SPI 201 IRQ_TYPE_LEVEL_HIGH>;
	clocks = <&scmi_clk IMX95_CLK_ADC>;
	clock-names = "ipg";
	status = "disabled";
};

On the ConnectCore 95 Development Kit.

ConnectCore 95 Development Kit device tree
/* ADC - {channel-num} channels available on expansion connector */
&adc1 {
	vref-supply = <&reg_vdd_1v8_dummy>;
	status = "okay";
};

Voltage reference

The ADC controller uses an internal 1.8V.

Formula

The value read on the ADC inputs responds to the formula:

\$V_(READ) = (V_(IN) * 4095) / V_(REF)\$

where:

  • VREAD is the digital value read

  • VIN is the analog input voltage

  • VREF is the ADC voltage reference

Using the ADCs

The ADC driver is designed as standard Industrial I/O (IIO) device drivers that can be accessed from the sysfs or from user applications.

Sysfs access

The ADC driver creates the corresponding device entries in the IIO sysfs directory (/sys/bus/iio/devices). You can access the ADC values through the sys file system:

Reading an ADC through the sysfs
# cat /sys/bus/iio/devices/iio\:device0/in_voltage1_raw
37

The returned value is a decimal number with the result of the conversion. In the example for the i.MX95 ADC:

\$V_(READ) = (V_(IN) * 4095) / V_(REF) -> V_(IN) = (V_(READ) * V_(REF)) / 4095 -> V_(IN) = (37 * 1.8) / 4095 = 0.016 V\$

To help with the calculation, multiply the read value by the value contained in the in_voltage_scale descriptor:

Reading voltage scale through the sysfs
# cat /sys/bus/iio/devices/iio\:device0/in_voltage_scale
0.439453125

\$V_(IN) = V_(READ) * "<in_voltage_scale>" = 37 * 0.439453125 = 16.259 mV = 0.016 V\$

Sample application

An example application called apix-adc-example is included in the dey-examples-digiapix recipe (part of dey-examples package) of the meta-digi layer. This application shows how to access the ADCs using Digi APIx library on the ConnectCore 95 platform.

Go to GitHub to see the application instructions and source code.

See ADC API for more information about the ADC APIx.