AD4112 4-20mA driver

Hi Toradex,

I need to integrate 4-20mA input to my am62/ mallow board.

I have 4 adc input available where I placed 4 resistor of 82.5ohm 0.1% to convert the 4-20mA current into voltage.

But I’m afraid that it is a bit light in term of protection with emc etc that’s why I would like to use a dedicated IC like the AD4112 that allow to have 8x 0-10V input + 4 x 4-20mA input.

I’m not sure that a linux driver existe ( i have checked in adc folder here but seems to not exist : linux/drivers/iio/adc at main · analogdevicesinc/linux · GitHub ).

It seems that this driver should be in common with ad717x family:
https://wiki.analog.com/resources/tools-software/uc-drivers/ad717x

And recently, it seems that a kernel patch will be released in the next kernel version:
https://lore.kernel.org/lkml/20240401-ad4111-v1-0-34618a9cc502@analog.com/T/

This device communicate in SPI.
I already have a SPI Lora module and my mallow board have only one SPI .

I checked the hardware but i don’t think it is possible to have a second SPI on am62/mallow board.
So solution would be to use a second CS for SPI0.
How would use proceed please ?

Thanks a lot !

Hello @FloSolio,

how many 4-20mA inputs do you need ?
Depending on the application I would not use the ADC inputs of the SOM and also galvanically isolate those inputs. There are some solutions based on I2C interface as well.
Do you have a certain speed requirement to read out the sensors?

Best Regrads,

Matthias

1 Like

Hi Matthias,

I would say 4 minimum.
I agree to not use diretly the adc pinput of the SoM, that’s why AD4119 seems to be a good candidate.

I have to admit that i2c solution would be better to avoid to interrupt Lora spi module when need to read to sensors.

There absolutly no need to read fast , i just need to monitor some water tank leval and outdoor temperature so really slow equipement.

May be the MCP3422 can be a solution , if it is already in the kernel of the toradex image ?

No, the MCP3422 driver is not included by default in our pre-built images. However, the driver’s source code is available in our Linux tree. You can easily include it in your custom image by enabling it in the Linux configuration. Simply set CONFIG_MCP3422=y in the kernel configuration (config ) file to activate the driver. Additionally, you will need to adjust the device tree to match how the MCP3422 is connected to the module.

OK OK let’s do that then, i will keep you up to date once all is working :slight_smile:

Thanks a lot !

Hi @alex.tx ,

Just a quick question, my mallow /am62 board has 4 I2c, but some seems to be associated to dedicated feature like dsi, csi, hdmi.

As HDMI is not usable with am62, can i use this i2c channel to control my adc mcp3428 please?
The first general purpose i2c 1 is already used for another device (my gpio expander).


p

Certainly, you can utilize I2C_3 (HDMI), as well as I2C_2, and I2C_4; all are accessible on the X10 header of the Mallow board. Since your ADC readings do not require high frequency, you can also use the I2C_1 channel. The presence of your GPIO expander should not pose any issues with this configuration.