ADC on Odroid XU4

Post Reply
sumanth
Posts: 11
Joined: Wed Dec 02, 2015 8:39 pm
languages_spoken: english
ODROIDs: OdoroidXU4 and XU3
Has thanked: 0
Been thanked: 0
Contact:

ADC on Odroid XU4

Post by sumanth »

Hello,

I want use the exposed analog inputs (ADC_0.AIN0 and ADC_0.AIN3) available on the odroidXU4.
But I only see examples of accessing the ADC on odroid using sysfs, But this will significantly reduce the ADC sampling rate because of limited file IO speed.

So I want to know if we can directly read the ADC data from the registers directly.? (similar to this gpio example http://odroid.com/dokuwiki/doku.php?id= ... o_register)
Is this possible..?

any insights are grateful.

Many thanks in advance.

User avatar
odroid
Site Admin
Posts: 34667
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 829 times
Been thanked: 716 times
Contact:

Re: ADC on Odroid XU4

Post by odroid »

We will make a WiKi page with an example test code.
Give us a week.

sumanth
Posts: 11
Joined: Wed Dec 02, 2015 8:39 pm
languages_spoken: english
ODROIDs: OdoroidXU4 and XU3
Has thanked: 0
Been thanked: 0
Contact:

Re: ADC on Odroid XU4

Post by sumanth »

Thank you.

User avatar
odroid
Site Admin
Posts: 34667
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 829 times
Been thanked: 716 times
Contact:

Re: ADC on Odroid XU4

Post by odroid »

We've added a mmap driven ADC example code with a few register maps.
https://wiki.odroid.com/odroid-xu4/appl ... e/gpio/adc

Try it and let us know the improved ADC reading rate.

sumanth
Posts: 11
Joined: Wed Dec 02, 2015 8:39 pm
languages_spoken: english
ODROIDs: OdoroidXU4 and XU3
Has thanked: 0
Been thanked: 0
Contact:

Re: ADC on Odroid XU4

Post by sumanth »

Looks nice, I will try this and update the outcome.

sumanth
Posts: 11
Joined: Wed Dec 02, 2015 8:39 pm
languages_spoken: english
ODROIDs: OdoroidXU4 and XU3
Has thanked: 0
Been thanked: 0
Contact:

Re: ADC on Odroid XU4

Post by sumanth »

the maximum value that the ADC can convert is 1.8V.
and this ADC on Odroid id 10-bit ADC. (If I am not wrong).

So the step size of ADC is

1.8/(2^10) = 1.757mV

This means each bit of ADC corresponds to 1.757mV.

Is this correct..?

User avatar
odroid
Site Admin
Posts: 34667
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 829 times
Been thanked: 716 times
Contact:

Re: ADC on Odroid XU4

Post by odroid »

The ADC has 12bit resolution as described in the WiKi.
So 1-bit step should be 0.439mV.

sumanth
Posts: 11
Joined: Wed Dec 02, 2015 8:39 pm
languages_spoken: english
ODROIDs: OdoroidXU4 and XU3
Has thanked: 0
Been thanked: 0
Contact:

Re: ADC on Odroid XU4

Post by sumanth »

Ok thanks for the correction
so with 12 bit resolution --> 1.8/4095 = 0.43956044mv

sumanth
Posts: 11
Joined: Wed Dec 02, 2015 8:39 pm
languages_spoken: english
ODROIDs: OdoroidXU4 and XU3
Has thanked: 0
Been thanked: 0
Contact:

Re: ADC on Odroid XU4

Post by sumanth »

I have problem with the resolution.

I have driven one of the GPIO on OdroidXU4 HIGH and connected this to ADC input. (so ADC should read the voltage on this GPIO)
The pin which is driven HIGH is measuring 1.84V.

If I use bit resolution of 0.43956044mv (assuming ADC is 12-bit with 1.8V Vref), then the voltage measured by ADC is ~1799.68mV
If I use bit resolution of 0.44932844mv (assuming ADC is 12-bit with 1.84V Vref), then the voltage measured by ADC is 1838.2027mV - 1840.0000 mV (perfectly accurate..!)

So the question is whats the real Vref of the ADC..? and how stable is this Vref..?

User avatar
odroid
Site Admin
Posts: 34667
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 829 times
Been thanked: 716 times
Contact:

Re: ADC on Odroid XU4

Post by odroid »

The AVDD18 is shared with internal VREF. The AVDD18 is connected to the 1.8Volt output of the PMIC.

The PMIC output tolerance is quite poor. It is 5%. :(
Range(1.71V to 1.89V) is too wide.

fret_saw
Posts: 1
Joined: Sat Aug 24, 2019 3:41 am
languages_spoken: english,russian
ODROIDs: C2, XU4
Has thanked: 0
Been thanked: 0
Contact:

Re: ADC on Odroid XU4

Post by fret_saw »

odroid wrote:
Fri Jan 22, 2016 10:53 am
We've added a mmap driven ADC example code with a few register maps.
https://wiki.odroid.com/odroid-xu4/appl ... e/gpio/adc

Try it and let us know the improved ADC reading rate.
Sorry for (maybe) necroposting, but

I have tried mmap driven ADC example code, and after removal of sleep(1) and printf instructions it achieves about 46K pairs of samples per second.
Is there any modifications which can be made to this code to approach 600 KSPS mentioned in the HIGHF bits description?

Thanks in advance

User avatar
odroid
Site Admin
Posts: 34667
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 829 times
Been thanked: 716 times
Contact:

Re: ADC on Odroid XU4

Post by odroid »

What is the sample rate if your choose single channel mode?

Post Reply

Return to “Hardware and peripherals”

Who is online

Users browsing this forum: No registered users and 4 guests