Jump to content
Sign in to follow this  
kactus

Read analog with 12bit resolution

Recommended Posts

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Kactus,

 

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?

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×