Mini 2440 Qtopia , How to access AIN1

desperado_43
Hi  My friends , 
I hava done an application for Qtopia using QT . I can control pot on mini
2440 which is conntected to AIN0 . Value appears on screnn . İt is
okey . But ı can't access to AIN1 pin . How to access AIN1 . May
anyone help me please ...

davef
Which kernel are you using?

desperado_43
Qtopia Version 2.2.0 , Z35 image used . How to learn kernel version . I am
newbie about mini 2440 and linux

desperado_43
Sorrry not Z35 , it is T35

davef
If the kernel (2.6.32.2) has been downloaded from here, as far as I am
aware the other ADC channels are not enabled. 

You either have to patch the kernel or use a kernel that already the ADC
(and GPIO and SPI already enabled).

What are your learning or project objectives?  Build from scratch or just
develop applications?

desperado_43
I am trying to take analog value and grapt on screan . I have 3.5 inc mini
2440

davef
Unless you find a tutorial that specifically does what you want I think you
are in for quite a bit of work. 

Try this website:

http://www.sereno-labs.com/what_happened_to_sereno-online

Paolo does a graphing example using QT.  You will have quite a bit work
getting up to speed on QT.  Then getting it running on the mini2440 is a
fairly difficult task.

Search for "mini2440vietnam" he has done some good tutorials.

If I had to do this I would suggest starting with the Pengutronix BSP for
this dev board (ADC and GPIO enabled) and go visit:

http://wingston.workshopindia.com/wingz/embedded-programming-on-the-mini...

Good luck!

desperado_43
Thank you davef , I can't understand topic at last link . I have qtopia on
Mini 2440 , MY problem is  not accessin AIN1 pin on GPIO. Now I have to
solve this problem . I compile linux kernel , I load it to mini2440 but
/sys/devices/platform/s3c24xx-adc/s3c-hwmon/in0_input is missing . I am
very confused :(

Juergen Beisert
Providing the "/sys/devices/platform/s3c24xx-adc/s3c-hwmon/*" is the job of
the kernel. Search for how to enable the corresponding drivers in the
kernel and how to register them in the board-file to make them occur at
run-time.

desperado_43
Thanks Juergen , There is a many involution about this situation . I am
newbie about linux and mini 2440 . How to search about what you say.I am
confused .

Dave Festing
Attachment: ADC.zip (527.97 KB)
Here are all my ADC notes.

desperado_43
Thanks dave , I have solved problem . I update  adc.c in 2.6.32.2 kernel
and compile the kernel . That is OK

nicky jack
hi......... i am also using the same pengutranix BSP i for qtopia i need to
interface the External 24 bit ADC is it possible please help me....


if possible please refer some websites 

thanks in advance 


Nicky

Dave McLaughlin
Hi Nicky, 

There are a number of 24 bit ADC's out there and choice of interface too. I
have used both SPI and I2C. SPI gives the fastest sampling time.

How many channels do you need?

You are going to have to develop something for this as there won't be
anything ready to use with the Mini series of boards.

I recently got a 16/18 bit ADC with 4 channels to work with Android and a
Mini6410 board using I2C so it is possible. I designed my own PCB for this
to include power and the I2C bus connection. It works very well and is
stable.

Another option you can consider is a 24 bit ADC with a small
microcontroller with a serial port output. It all depends on how fast you
want to sample the data at. 

Good luck.
Dave...

nicky jack
Hi dave 
i need to interface only one channel from that i need to connect one
sensor...

otherwise please refer me how can i interface the onboard ADC and DAC?

Thanks ==reg
jack

davef
Dave is a common name in this thread!

What kind of DAC?  I am currently building a break-out board with a SPI
controlled 6 channel DAC on it.

To drive the DAC you can patch the kernel for spidev, and then talk to the
DAC with file write calls.  There are several other more complex ways to do
this.  

I can give you a spidev patch for 3.1 from Pengutronix and an example that
is built in the local_src folder.  The example drives a Mitsubishi M62354 6
channel DAC which has an unusual addressing structure, so may not be of a
lot of use to you.  It is untested.

The Pengutronix BSP gives you access to AIN1, 2 and 3 out of the box.

So, try building a kernel module example in local_src, there is already an
example that comes in the template.  Then, when you have got that going I
could send the patch and example.  Maybe, I will have it tested by then.

davef

davef
Keyword is:

ptxdist newpackage src-linux-driver, type in ptxdist newpackage -help

nicky jack
Than you dave 

 dac i am going to use Binary Weighted Ladder...

But anyhow i am new to this pengutronix so, can you refer some good books
or tutorials or website to develop...... i have already studied that
oselas.BSP... file.........

Regard
Jack

Dave Festing
The Quickstart guide is quite comprehensive.  They have another publication
which covers the generic PTXdist development process.

Have you picked a specific DAC, binary weighted is the implementation type.

TheRegnirps
The test pot is a thru hole device. I take a soldering iron and remove it.
Solder wires into the two holes for input and ground. It is the easiest way
to get an analog input wired up.

nicky jack
hi Dave ,
please help me i know how to read the AIN0 using Penguttonix BSP, but now i
need to interface one displacement sensor, in that i need to create on
table that if ADC reads 2.7v it should show 0mm , 2.81-1mm,3.01v-2mm like
that it will go,please help me to create like this

Thanks in advance
Regards
Nicky jack

nicky jack
interface in AIN1 or 2 or 3

davef
AIN1, 2 and 3 should be done the same way as AIN0.

Are you asking me to write a C application to convert those values into
something you can display on the screen using Qt or record these values in
rrdtool or ?

nicky jack
Hi dave ,
I duno about rrdtool but my concept is even if my value is lies between
1.1mm or 1.2 or 1.3 mm ,1.5..... it should show... is it possible???

Thanks in advance
Regards
Nicky

davef
Work out the resolution of a 10 bit ADC running off 3.3Volts and you find
out how fine the steps could be.  3.3V/1014 bits = about 3mV increments. 
At 20mV/mm that tells me you will not be able to see a 0.1mm change.

Maybe, 0.2mm.  An op-amp with a 2.7Volt offset and some gain NIGHT get you
better resolution.  There will be a number of tolerance and drift issues to
work through to determine if you will have the required accuracy. 

I think it is possible.

nicky jack
hi davef ,
That is correct but i going to use 24bit adc or 32 bit only 

suppose my sensor o/p is like this 
voltage displcement
2.5    1mm
2.71    2
2.81    3
3.01    4
3.50    5
4.10    6  


if suppose my sensor reads 2.61,2.62,2.65,2.68,2.70volts

it should show the corresponding intermediate between 1 and 2 mm ok,
but i am not going to define the o/p volt in between the 1mm ,2mm,3mm etc,

i just want to create one table and that should automatically generate the
displacement in between that is it possible?
Thanks in advance 
Regards
Nicky

davef
1 to 2mm is a 0.21 V step
2 to 3mm is a 0.1 V step
3 to 4mm is a 0.2 V step
4 to 5mm is a 0.49 V step
5 to 6mm is a 0.6 V step

This does not look a very nice "curve" to try and fit a formulae to!

Maybe, take smaller chunks and just do a linear interpolation between them
until you get the results you want.

I did some dual regression analysis years ago, but the "curves" were nicer
than yours.  Perhaps there are some newer or more relevant techniques for
your job.

Good luck!

davef
Ah, you only want between 1 and 2mm, then fit a curve to it, ie dual
regression analysis

nicky jack
ok thank you dave,

will be able to develop using qt creator?

davef
Have a look at sereno-on-line for a Qt example of a datalogger.

If you want to display real-time graphs of what is happening than rrdtool
might be useful.

nicky jack
step difference v                voltage 
-0.256739854812620    3.262603044509890     1mm 
-0.262419700622560    3.519342899322510     2mm
-0.235290527343750    3.781762599945070     3mm
-0.276700973510740    4.017053127288820     4mm
-0.219363212585450    4.293754100799560     5mm 
-0.277537345886230    4.513117313385000     6mm 
-0.228695392608640    4.790654659271240     7mm
-0.267527103424080    5.019350051879880     8mm


Hi dave please see this i got the good step difference i think  
 now please tell me how can i prepare it like calibration sheet? and how do
i set the reference voltage in mini 2440?

Thanks in advance

davef
The first thing I'd be asking myself is why the variable step difference
between the various mm measurements, they are "all over the place".  You
are not going to be able to fit a curve to that data (just my opinion).

Are you getting noise and/or do the readings vary over time?  You might
need to do a "running average" to get more consistent data.

If the data is really like you have measured I would consider a LUT (look
up table) and maybe linear interpolation between values.

You will have to scale the voltage done so as not to exceed the max voltage
rating of the ADC.

Also, there is no point going to 15 decimal places!  You have a 1024 bit
ADC on the mini2440 with a max voltage of 3V0 or 3V3, check the datasheet.

Titus Breidung
A (little bit off topic) question of my interest in my only basic
electronics knowledge:

Is it possible to measure/generate voltages with a precision of 10E-15 with
usual means?

The values above confusing me...

Thanks in advance,

Titus