How use AIN1 from ADC ?

Jorge
Anyone know how can i use AIN1 from ADC?

dvferlemann
I tried modify mini2440-adc.c driver. a line I recall "xxxx.dev = 0" I
changed to "xxxx.dev = 1" and that's suppose to do the work, but it
disabled touchscreen function... 

I also tried to change a header file for ADC register address. It had the
same effect.

There's a tutorial teach you to add /dev/adc1, I tried that. But it
requires modify Makefiles in /driver/char/ directory, and other places. I
couldn't even compile the kernel after doing that. 

Even if you enable AIN1, you will still need to have a 3.3V reference
voltage. And remember, pull resistor! you will need it.

If you are lucky to figure it out, please share your solution.

Jorge
nothing, other idea?

ocikgel
hello,
I also need this answer of this question 
because I have project that is related the ADC. In my project , I have
sensors  and I will connect this sensors on ADC (4 Chanel A/D, AIN0 was
linked to W1, AIN1, AIN2, AIN3 was linked to Pin27, PIN28, Pin29 of the
CON6(refer to chapter 2.19), it can be configure 10/12 bit.) . I need
register addresses that are related ADC and example code(how to use,read 
ADC and their registers) in c. 

Who know anything else ?

ocikgel
:) my machine mini 6410 cpu = samsung s3c6410  platform linux

Jorge
We need help . Anyone know how use ?

linuxsupport@vectorindia.org
Hi
For the 2440 , please post the kernel version that you are using.

Regards
linuxsupport@vectorindia.org
http://www.vectorindia.org

Jorge
linux-2.6.32.2

ocikgel
anybody will give me solution of my problem or say anything ?

linux_support
Attachment: adc_patch (510 Byte)
Hi
In line no. 120 of mini2440_adc.c , in function s3c2410_adc_open change the
value of adcdev.channel to 1. I am also attaching a patch file if you have
problem in locating the file. The file mini2440_adc.c is in drivers/char
folder. Change this value and recompile the kernel , and from your
application open /dev/adc . Now you should be able to read AIN1.

Regards
linuxsupport@vectorindia.org
http://www.vectorindia.org

ocikgel
what about for  mini 6410 ?

linux_support
we donot have the mini 6410 board, but still i can try. which kernel
version you are using ??

Regards
linuxsupport@vectorindia.org
http://www.vectorindia.org

ocikgel
platform : mini6410 - linux 2.6.28.6

Also I need sample c/c++ code 

best regards 
:)

linux_support
Attachment: patch_adc (510 Byte)
Hi
The same reply for you also.
In line no. 120 of mini6410_adc.c , in function s3c2410_adc_open change the
value of adcdev.channel to 1. I am also attaching a patch file if you have
problem in locating the file. The file mini6410_adc.c is in drivers/char
folder. Change this value and recompile the kernel , and from your
application open /dev/adc . Now you should be able to read AIN1. For
reading other channels you can make separate drivers for them.
For reading the adc channels from C , normally we use open system call to
open the device and then use the read system call to read the values from
the device. 

Regards
linuxsupport@vectorindia.org
http://www.vectorindia.org

ocikgel
ok 
but I dont have mini6410_adc.c  and drivers/char and /dev/adc  folder 


????


plesae help  :)

linux_support
:( 
you said you are having 2.6.28.6 so i downloaded it from
http://v3.netyxia.net/~mobyfab/mini6410/linux-2.6.28.6-20100917.tar.gz

And this one is having the files i mentioned. 
Can you give me a link from where i can download the version of kernel that
you are running.

Regards
linuxsupport@vectorindia.org
http://www.vectorindia.org

ocikgel
I have not downloaded , my mini 6410 is ready for use and everything
already has set up when I bought 


so ,What do you suggest to me ???

I think AIN1 and AIN2 has specific register address if  I know this
addresses,I will read dynamically when my application is running,won't I ? 

if you know register addresses(AIN1-AIN2(linked to PIN27 - PIN28 com6))
will you tell me ? And also if you know that how invoke or start adc in c 
will you tell me ? 

:) best regards

linux_support
Hi
The files and folder that i mentioned are in the kernel source , you will
not find them in the filesystem of your mini6410. You have to apply the
patch to the kernel source , compile it and then load that to your
mini6410. 
You can not directly access the hardware from your application program
unless you have a driver for that device. And the only driver that you have
in your mini6410 is the driver for AIN0. You either have to compile the
kernel with your new drivers or you have to make them as modules and load
them separately and then you can access these ADC pins from your
application. 
The patch file i gave just modifies the exiting ADC driver to make it use
AIN1.

Regards
Vector Institute
linuxsupport@vectorindia.org
http://www.vectorindia.org

tej
Do we know where is the tutorial which teach to add /dev/adc1

Sushant
Hello,

My ADC driver work properly but my Qt app use touch screen adc read -1..
External mouse is connected it properly work

Samyukta Ramnath
Hello,
We tried this method where we just modified the driver for adc0, making the
0 into 1 or 2 wherever needed, and we were able to compile the kernel and
make a zImage without any errors. The zImage was of an appropriate size
too, we checked. But, I think that there is an issue witht he way we
compiled the kernel itself because when we dumped the zImage onto the
board, the LCD screen became white when we went into NAND mode. WE had to
use another zImage given to us by someone else.
Is there a way to use and modify these drivers on the board iteslf, because
the zImage that we have on the board is correct and it will work ,I feel,
but the kernel that we have on our host is lacking somehow.
Thanks and warm regards

dave
I have never heard of any method for modifying a zImage or uImage on the
machine.

You need to use a remote terminal running minicom or similar and look at
the boot messages.  Then you stand a chance at finding out what is going
wrong.

Post your whole boot message for others to look through.

sundeep
Hi@Samyuktha

I image in which i provided its already include the other 3 pins adc
drivers, u can use straight away

Samyukta Ramnath
Hello,
How would I then access the drivers? in /dev/, there is only adc and no
adc1 or something like that. Which file should I open to use the adc pins?

Samyukta Ramnath
Hi!
For reading the potentiometer values from AIN1 pin, I tried the following:
1) Made a copy of mini2440_adc.c file in /drivers/char at the same location
and named it as mini2440_adc1.c
Then I changed the adcdev.channel to 1, and made the respective changes at
other places(e.g adc to adc1, ADC_LOCK to ADC_LOCK1 etc)

2)I changed the Makefile in the char directory and added a line:
obj-$ (CONFIG_MINI2440_ADC) += mini2440_adc1.o

3)Then I recompiled the kernel and reloaded the zImage on the board. I can
see now "adc1" in my /dev on the board.

4)I tried the adc-test code by just changing adc to adc1.
(I believe this is a common procedure followed)

However, I get random values on the LCD screen. They seem to change greatly
and abruptly even when the POT is not moved. 

Am I missing something in the procedure to use the ADC pins? Are we
required to change any register values or modify something called
"S3C_device_hwmon"  platform file?

davef
Are you placing a known voltage on ADC1?  If the pin is left floating you
will get random values.

Search for a thread topic "wants to use other AIN pin".  It mentions in
there that the Pengutronix BSP enables some of the other ADC pins.  Might
be worth having a look at their source code and patches.

Samyukta Ramnath
Yeah..I am placing a known voltage value on the ADC.(checked with a
multimeter - value between 0 to 3.3v)
I will surely look into the Pengutronix BSP patches. Thanks!

davef
Quoting from the QuickStart Guide 8.14:

By doing the following:

   cat /sys/devices/platform/s3c24xx-adc/s3c-hwmon/in0_input and tweaking
the pot you should see it change (pot is on ADC0).  ADC4, 5, 6 and 7 are
the touchscreen.

So, cat /sys/devices/platform/s3c24xx-adc/s3c-hwmon/in1_input  should work

Perhaps cat /dev/adc1 .... should work also, but I have NOT got access to
my mini2440s at the moment.

Samyukta Ramnath
Hello,
We got our mistake, it was a small mistake in code (printing %f instead of
%d for an int value) and taking the wrong pin in potentiometer as ground.

davef, Thank you for the file idea, will prove useful to us in our
following projects!
regards

r@wboom
hello there,
i am working on mini6410 for 1 months.i just want to know which pin is adc
0 pin 
because i seen in the mini 6410 manual but didn't find.
so if anybody help me 
thanks

maysamsarikhani@gmail.com
Hello guys,
how about tiny 4412?
in tiny_4412_adc1.c what words do i have to change?any one has this code?
thank you

wiztech
http://www.automationtraining.info/