AD7124-8
Recommended for New Designs
The AD7124-8 is a low power, low noise, completely integrated
analog front end for high precision measurement applications. The
AD7124-8 W grade is AEC...
Datasheet
AD7124-8 on Analog.com
Kuiper linux downloaded from here (2022_r2) swdownloads.analog.com/.../image_2023-12-13-ADI-Kuiper-full.zip and use it on Raspberry Pi Model B.
I am using eval-ad7124-8sdz board using SPI connection following wiki.analog.com/.../precision_adc_toolbox.
Strangely under /boot/overlays, it only has rpi-ad7124-8-all-diff.dtbo, and does not have rpi-ad7124-8-all-diff-cs0-int25-overlay.dtbo. So in order to use the interruption line GPIO 25, I downloaded https://github.com/analogdevicesinc/linux/blob/rpi-5.4.y/arch/arm/boot/dts/overlays/rpi-ad7124-8-all-diff-cs0-int25-overlay.dts
and compiled using
sudo bash -c 'dtc -I dts -O dtb /home/analog/Downloads/rpi-ad7124-8-all-diff-cs0-int25-overlay.dts > /boot/overlays/rpi-ad7124-8-all-diff-cs0-int25-overlay.dtbo'
When I run https://github.com/mthoren-adi/precision_adc_toolbox/blob/master/ad7124_simple_capture.py, the data returned by rx() is a constant array, instead of a sin function that I used as input.
When I tune the input to a constant DC voltage, rx() indeed returns (roughly) that voltage, repeated 1024 times (as rx_buffer_size = 1024). Therefore I believe the rx() function is only reading once, instead of continuously reading 1024 times.
Since the Kuiper linux does not contain rpi-ad7124-8-all-diff-cs0-int25-overlay.dtbo and I have to recompile it from scratch, my guess is the Kuiper linux that I am using is incorrect. Could you confirm what is the correct Kuiper linux download link that contains the correct code for ad7124-8, and also why rx() is returning a constant instead of a continuous read?
Bowei - Moved from Software Interface Tools to Precision ADCs. Post date updated from Monday, March 11, 2024 3:03 AM UTC to Monday, March 11, 2024 3:10 AM UTC to reflect the move.
JEstayo - Moved from Precision ADCs to Linux Software Drivers. Post date updated from Monday, March 11, 2024 3:10 AM UTC to Wednesday, March 13, 2024 2:11 AM UTC to reflect the move.
Hi Bowei , the link you have provided is correct. The move to change rpi-ad7124-8-all-diff-cs0-int25-overlay.dtbo to rpi-ad7124-8-all-diff.dtbo was to make the cs and interrupt pins reconfigurable at boot time via device tree overlay parameters. This way, we could use either of the 2 SPI ports of PMD-RPI-INTZ Evaluation Board | Analog Devices without the need to recompile the device tree.
To obtain the same configuration as rpi-ad7124-8-all-diff-cs0-int25-overlay.dtbo, we could use this in the /boot/config.txt instead:
dtoverlay=rpi-ad7124-8-all-diff,cs_pin=0,irq_gpio=25
As for the rx() being constant, there is an existing driver issue present in branch rpi-5.15.y (2022_r2) that is being looked upon. This might be the cause of rx() readings being constant.
(+) Inconsistent channel position in a libiio buffer - Q&A - Linux Software Drivers - EngineerZone (analog.com)
Sorry Bowei unfortunately, I don't have an eval-ad7124-8sdz I could use right now. The issue on the libiio buffer was communicated to the developers and looks like it affects any device using the ad7124 driver (cn0554, eval-ad7124-8-pmdz, cn0508). I believe there is a fix in rpi-6.1.y branch (analogdevicesinc/linux at rpi-6.1.y (github.com) which will be part of 2023_R2 (not yet released). I'm still trying this myself and would love to update you on the result
I see. Do I need to build the rpi-6.1.y branch linux driver according to https://wiki.analog.com/resources/tools-software/linux-build/generic/raspberrypi or is there a prebuilt version available for download?
Yes, there are pre-built files from the latest build of rpi-6.1.y.
Download them from:
https://swdownloads.analog.com/cse/linux_rpi/rpi-6.1.y/rpi_latest_boot.tar.gz (should be extracted in /boot)
https://swdownloads.analog.com/cse/linux_rpi/rpi-6.1.y/rpi_modules.tar.gz (should be extracted in /lib/modules)
Unfortunately, there is no rootfs yet for 2023_R2 but we could try the above files on an existing 2022_R2 image, though it is not guaranteed to work yet.
Thank you so much for the links! I am not very familiar with the Linux file structure. Right now on my Raspberry Pi, which has 2022_R2 Kuiper Linux installed, shall I delete the contents of /boot and /lib/modules directories, and put the files in your links into the respective directories? The rpi_modules link has 3 folders, which one should I use?
No need to delete, I just usually overwrite (/boot and /lib/modules) by copying all files as it is.
Its fine to copy all the 3 folders under rpi_modules to /lib/modules but if you are constrained with storage, you could just copy the folder that corresponds to your RPI variant,
ex. RPI4 -> 6.1.54-v7l+, RPI3 -> 6.1.54-v7+
Hi Kimpaller, I extracted the files as you said, but now when I use iio_info command, it can not find the ad7124 device. I also don't see an error loading the device tree overlay, so I guess the new kernel is not loading the device tree. Could you get the kernel to work properly for rpi-6.1.y?
Hi Kimpaller, I extracted the files as you said, but now when I use iio_info command, it can not find the ad7124 device. I also don't see an error loading the device tree overlay, so I guess the new kernel is not loading the device tree. Could you get the kernel to work properly for rpi-6.1.y?