iMX7 ADC continuous sampling

Is it possible to use the internal ADC for continuous measurement? There is some documentation that the VFxx modules support ‘Continuous Sampling’ but i cannot find something similar for the iMX7. I need to measure the input voltage at equidistant times (frequency). Regards

hi @qojote

Is it possible to use the internal ADC for continuous measurement?
What do you mean with continuous measurement? What is your application?

There is some documentation that the VFxx modules support ‘Continuous Sampling’ but i cannot find something similar for the iMX7.
Where did you find the Documentation about VFxx? Could you provide a Link?

I need to measure the input voltage at equidistant times (frequency). Regards
Which value for the frequency do you want to have? For measuring with a stable frequency’s value, you should use the rt patch for Linux kernel or use directly freeRTOS.

Continuous measurement means that i want to read out the ADC at a fixed interval (equidistant times). I thought maybe there is something available like described here link text. I think i will implement this measurement on the M4 core. Thanks for your help.

You are welcome. As described at the link you provided you can use also the software triggering if your sample frequency is not high or you can write a kernel driver using hardware Interrupts for sampling.

Depending on what you want to do with the sampled data, it may be easier to implement this on m4.

There is no sysfs entry for /sys/bus/iio/devices/iio_sysfs_trigger and /sys/bus/iio/devices/iio:device0/buffer so i think this documentation only applies for VFxx and not iMX7.

Sorry, you are right, this feature is only implemented for vybrid. The adc driver used for vybrid is the following: drivers/iio/adc/vf610_adc.c. Maybe you can add this feature to the adc driver of imx7: drivers/iio/adc//imx7d_adc.c. Further check also the Reference manual of the Imx7 to know the capabilities of the ADC Hardware of iMX7.

Thanks for your help. Can you please set this question to resolved.

You are welcome. Will you write a driver for iMx7 for linux or are you going to implement this on m4?

Ok, perfect. On our site, we will implement the continuous adc sampling feature for imx7 and imx6ul in future, but it is not planned yet.
You can check our Bsp Release site to get further Information.

I will implement it on the m4 (should be the faster solution).

hi @qojote:
Did you implement the driver on m4? If yes, is it possible to share it?
Do you still need the driver for the A7 core?

Hi @jaski.tx
I haven’t written a “driver” but i am using the M4 to readout the ADC continuously. However as you might see here i am facing a lot of problems to get samples at a fixed rate without loosing samples. In fact i am wondering if the iMX7 with its integrated M4 is really a good choice for embedded applications with realtime requirements. I need to guarantee (hard) RT behavior, no matter if the Linux OS is accessing other peripherals. To answer your second question, no, right now i do not need a driver for the A7 because I do not believe that a Linux driver would perform better then using the M4. Thanks for your further inquiry.

Thanks for the answer. Yeah, I have see your question. Andy is currently working on this.

I really do appriciate your support.

you are welcome.

Hello, it looks like from the Linux BSP Release that continuous sampling for the imx7 and imx6ull is not yet done. As this thread is more than one year old, I was wondering if this is planned or if anybody implemented it. I am very much looking for it.

HI @dnic and Welcome to the Toradex Community!

Regarding the continuous ADC sampling, this feature is not planned currently and won’t be done. For iMX7, you can use M4 for continuous sampling and for iMX6ULL you would need to implement the feature by yourself.

Best regards,
Jaski

Thank you Jaski for your prompt answer.

You are welcome.