Jump to content


Read analog with 12bit resolution

acadia analog 12 bit

  • Please log in to reply
4 replies to this topic

#1 kactus



  • Members
  • Pip
  • 4 posts

Posted 16 March 2016 - 09:46 AM

Hi, On the specification page for the Acadia, it lists 4 * 12 bit pins and 2 * 6bit pins


I'm trying to read the pins 3-6 with 12 bit precision with c, but using the core analogRead function returns a value between 0 and 1023 (10 bit instead) and looking into wiring_analog.c it seem to be reading this via SPI?


I have tried to use the old file locations but they do no longer seem to exist


root@Acadia:~# lsmod
Module                  Size  Used by
vivante                  943  1
drm                   137567  2 vivante
rt5370sta             631392  0
imx_scratchkey          2267  0
imx_gpio                5099  0
imx_irkeypad            2834  0
imx_pwm                 3142  0
imx_led                  571  0
imx_swirq               1971  0
ov5640_camera          17009  0
ov5642_camera          74086  0
imx_spidev              4554  0
ov5640_camera_mipi     19730  0
camera_sensor_clock      765  3 ov5640_camera,ov5642_camera,ov5640_camera_mipi
ft5x_ts                62081  0
root@Acadia:~# modprobe adc
FATAL: Module adc not found.
root@Acadia:~# cat /proc/adc0
cat: /proc/adc0: No such file or directory
This is with Acadia image 07-05-2015
All help is greatly appreciated
Thank you

#2 youkee


    Advanced Member

  • Administrators
  • 237 posts

Posted 20 March 2016 - 06:49 AM

Is there an operation with mask for ADC value and only take 10 bits? 

#3 kactus



  • Members
  • Pip
  • 4 posts

Posted 03 May 2016 - 06:58 AM

Is there an operation with mask for ADC value and only take 10 bits? 

This is simply by trying to run ADC_test from the examples directory (direct call to analogRead)


I have been trying o replicate in C++ put only get value 1023 across all ADC pins. Can you please link me to working code to read ADC pins?


Thank you

#4 FIRST 2973

FIRST 2973


  • Members
  • Pip
  • 4 posts

Posted 09 August 2016 - 02:01 PM



I have the same problem with my ADC0-5. I noticed that I do not have a kernel file called adc.ko in my /lib/modules/XXX folder. I think we need this so the /proc/adc0 is placed in the folder by the kernel.


I can pull adc.ko off of my PCDuino 3 but I don't think it will work.


Does anyone have their adc working on the Acadia?

#5 FIRST 2973

FIRST 2973


  • Members
  • Pip
  • 4 posts

Posted 07 October 2016 - 04:42 PM

I have some new information on this topic. I can get the first 4 ADCs working (ADC0-3) 0-1023 counts. The last two channels are not working properly. It appears that the last two channels share the I2C2 bus which are pulled up. This means that the ADC 4 and 5 cannot be used because the I2C is pulled up. Thanks designers!


The schematics that most venders put on there web site is for V1.0 and is not close to new Acadia versions with respect to ADC inputs. You can see the ADC chip on the Acadia back. It is an 8 channel SPI ADC but the kernel only uses 6 channels because there are only 6 channels brought out to the Arduino header.


I checked the SPI clock and data lines using my and everything looks good on the input side of the ADC chip. The output does not because I see the Acadia internally pulled up the I2C Clock (tied to ADC4) and I2C Data (tied to ADC4).


Anybody have any ideas on using the last two ADC channels ADC4 and ADC5?

Also tagged with one or more of these keywords: acadia, analog, 12 bit

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users