linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* SPI-ADC
@ 2010-02-13  5:48 arjun rath
       [not found] ` <dc6d3181002122148v6451ebffka164de288738485d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2010-02-13 13:48 ` [spi-devel-general] SPI-ADC Linus Walleij
  0 siblings, 2 replies; 14+ messages in thread
From: arjun rath @ 2010-02-13  5:48 UTC (permalink / raw)
  To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f


[-- Attachment #1.1: Type: text/plain, Size: 195 bytes --]

Hi everybody,

can anybody share how to start a spi based ADC linux driver.I am having a
MAXIM 1242 ADC chip.

Can anybody share some reference driver for the same chip

Thanks in advance

Arjun

[-- Attachment #1.2: Type: text/html, Size: 223 bytes --]

[-- Attachment #2: Type: text/plain, Size: 254 bytes --]

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev

[-- Attachment #3: Type: text/plain, Size: 210 bytes --]

_______________________________________________
spi-devel-general mailing list
spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: SPI-ADC
       [not found] ` <dc6d3181002122148v6451ebffka164de288738485d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2010-02-13  6:38   ` Ben Gamari
  0 siblings, 0 replies; 14+ messages in thread
From: Ben Gamari @ 2010-02-13  6:38 UTC (permalink / raw)
  To: spi-devel-general

Excerpts from arjun rath's message of Sat Feb 13 00:48:40 -0500 2010:
> Hi everybody,
> 
> can anybody share how to start a spi based ADC linux driver.I am having a
> MAXIM 1242 ADC chip.
> 
> Can anybody share some reference driver for the same chip
> 
I've recently been working on a design for a data acquisition
board to interface with the Beagle Board using the Maxim 5134 and 1270.
I'm using the spidev driver to interface with the devices from
user-space. Documentation on this driver can be found in the
Documentation/spi/spidev file of the Linux kernel tree. My code can be
found at [1]. Hope things are going well,

- Ben


[1] http://goldnerlab.physics.umass.edu/git?p=tracker.git;a=tree

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [spi-devel-general] SPI-ADC
  2010-02-13  5:48 SPI-ADC arjun rath
       [not found] ` <dc6d3181002122148v6451ebffka164de288738485d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2010-02-13 13:48 ` Linus Walleij
  2010-02-13 16:51   ` Jonathan Cameron
  1 sibling, 1 reply; 14+ messages in thread
From: Linus Walleij @ 2010-02-13 13:48 UTC (permalink / raw)
  To: arjun rath; +Cc: spi-devel-general, linux kernel

2010/2/13 arjun rath <rath.arjun@gmail.com>:

> can anybody share how to start a spi based ADC linux driver.I am having a
> MAXIM 1242 ADC chip.

The ḱernel does not contain any generic ADC subsystem abstraction (I
think it would be good if it did), instead most drivers using ADC have
their ADC portions stored inside a driver for something else, e.g.
drivers/hwmon for ADCs used in temperature monitoring, or
drivers/power for ADCs used in monitoring of currents and voltages
for power supplies/batteries.

This is a bit bad for driving a generic ADC like this using spidev and,
even if it was to be accessed from userspace only, having it under
drivers/spi is rather counterintuitive, what happens when the next ADC
using I2C turns up? drivers/i2c/chips?

I would suggest creating subsystem drivers/adc if you have time and
energy, other ideas?

Linus Walleij

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [spi-devel-general] SPI-ADC
  2010-02-13 13:48 ` [spi-devel-general] SPI-ADC Linus Walleij
@ 2010-02-13 16:51   ` Jonathan Cameron
  2010-02-13 17:03     ` Mike Frysinger
  2010-02-13 21:20     ` Linus Walleij
  0 siblings, 2 replies; 14+ messages in thread
From: Jonathan Cameron @ 2010-02-13 16:51 UTC (permalink / raw)
  To: Linus Walleij; +Cc: arjun rath, spi-devel-general, linux kernel

Hi Arjun and Linus,
> 
>> can anybody share how to start a spi based ADC linux driver.I am having a
>> MAXIM 1242 ADC chip.
> 
> The ḱernel does not contain any generic ADC subsystem abstraction (I
> think it would be good if it did), instead most drivers using ADC have
> their ADC portions stored inside a driver for something else, e.g.
> drivers/hwmon for ADCs used in temperature monitoring, or
> drivers/power for ADCs used in monitoring of currents and voltages
> for power supplies/batteries.
That's not entirely true.  These are covered by the IIO subsystem which
is admittedly currently in staging as some elements still need cleaning up.

As a quick summary of IIO.  Except for a few bits of management code, basic
drivers look pretty much like hwmon.  An example in tree is the tsl2563 driver
(under drivers/staging/iio/light) though that one is moving out to ALS when
Amit has a chance to sort out the relevant patch.

For more advanced drivers (only add support if you have a use as it is a fair
bit more complex) we have support for hardware and software ring buffers, an
events interface which is more or less the equivalent of input without cross
device aggregation.

ADC drivers are under drivers/staging/iio/adc.

I think in mainline we still only have a max1363 driver which covers a lot
of the i2c maxim parts (more to add after testing).  There are a couple
more iio using adc drivers in a blackfin tree at:

http://blackfin.uclinux.org/gf/project/linux-kernel/scmsvn/
(Note these are very much under development!)  Though from a quick look
all of them are i2c based.  For an spi equivalent, take a look at
drivers/staging/iio/accel/ where we have the kxsd9 driver (which is another
simple example of an IIO driver) + lis3l02dq and sca3000 which are on the
heavy side (probably not a good place to start). 

For a general list of devices people are working on, or at least have and
intend to work on, take a look at:

https://sourceforge.net/apps/mediawiki/iioutils/index.php?title=Device_List

Just for reference, the big up coming change in IIO is a new userspace ABI
to clean things up before we get too many drivers using the somewhat messy
old version.

It will still be a little while before we have cleaned up the more controversial
issues in the core (none of which touch on the simpler drivers) but with a
steady increase in active developers things are speeding up.

So in conclusion, if your use of the driver doesn't fall neatly under hwmon
or elsewhere, and you don't mind writing for a subsystem which isn't entirely
polished and may change, then IIO might be what you are looking for.

Currently all discussions take place on LKML, but we are working on a more
focused alternative list which I'll announce once it is sorted out.

Just taking a quick and dirty look at the datasheet for the MAX1242:

* You might have fun getting the required conversion delay before a read.
 (Chip select must be enabled for 7.5 microsecs before the clock starts)

* Otherwise it is a nice simple chip with no actual control of anything.

Perhaps you can supply some information on your application to guide
an continuation of this discussion?

Thanks,



Jonathan Cameron
> 
> This is a bit bad for driving a generic ADC like this using spidev and,
> even if it was to be accessed from userspace only, having it under
> drivers/spi is rather counterintuitive, what happens when the next ADC
> using I2C turns up? drivers/i2c/chips?
> 
> I would suggest creating subsystem drivers/adc if you have time and
> energy, other ideas?
> 
> Linus Walleij
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [spi-devel-general] SPI-ADC
  2010-02-13 16:51   ` Jonathan Cameron
@ 2010-02-13 17:03     ` Mike Frysinger
  2010-02-13 21:20     ` Linus Walleij
  1 sibling, 0 replies; 14+ messages in thread
From: Mike Frysinger @ 2010-02-13 17:03 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Linus Walleij, arjun rath, spi-devel-general, linux kernel

On Sat, Feb 13, 2010 at 11:51, Jonathan Cameron wrote:
> http://blackfin.uclinux.org/gf/project/linux-kernel/scmsvn/

people who like git can always use:
http://blackfin.uclinux.org/git/?p=readonly-mirrors/linux-kernel.git;a=summary
-mike

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [spi-devel-general] SPI-ADC
  2010-02-13 16:51   ` Jonathan Cameron
  2010-02-13 17:03     ` Mike Frysinger
@ 2010-02-13 21:20     ` Linus Walleij
       [not found]       ` <63386a3d1002131320u5afbc35ak2bc3533aab3f1e54-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  1 sibling, 1 reply; 14+ messages in thread
From: Linus Walleij @ 2010-02-13 21:20 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: arjun rath, spi-devel-general, linux kernel

2010/2/13 Jonathan Cameron <kernel@jic23.retrosnub.co.uk>:

>>> can anybody share how to start a spi based ADC linux driver.I am having a
>>> MAXIM 1242 ADC chip.
>>
>> The ḱernel does not contain any generic ADC subsystem abstraction
>> (...)
>
> That's not entirely true.  These are covered by the IIO subsystem which
> is admittedly currently in staging as some elements still need cleaning up.
> (...)
> ADC drivers are under drivers/staging/iio/adc.

Great stuff. I knew about IIO and then it fell out of my mind, how
could I...

What strikes me especially about IIO is the underlying assumption, which I
think ought to be written in clear somewhere where I missed it, and that
is that all IIO drivers are supposed to deliver values and be controller from
userspace with this nice ABI, and nothing's wrong with that of course.

But I'm hinting about a few in-kernel uses: for AB3100 we have a battery
charging mechanism, which use a (calibrated) ADC value supporting the
bulk of the driver in the power/ subsystem.

As it looks today IIO is not intended for the case where another subsystem
needs to grab and use and ADC for its own purposes. Is this correct or did
I get it all wrong?

Would you say it'd be a good idea to hack the IIO ADC interface (for
example) to be used also internally in the kernel, or would that violate
the idea behind IIO?

If these are disparate categories it would warrant a separate adc/
subsystem, see.

> Currently all discussions take place on LKML, but we are working on a more
> focused alternative list which I'll announce once it is sorted out.

LKML is just fine with me, for one.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: SPI-ADC
       [not found]       ` <63386a3d1002131320u5afbc35ak2bc3533aab3f1e54-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2010-02-15  4:29         ` arjun rath
       [not found]           ` <dc6d3181002142029j13a9e57la45aa90a269404fa-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: arjun rath @ 2010-02-15  4:29 UTC (permalink / raw)
  To: Linus Walleij
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	Jonathan Cameron, linux kernel


[-- Attachment #1.1: Type: text/plain, Size: 2336 bytes --]

Hi all,

Thanks for the suggestions.

Actually i am new to SPI,and all related ADC drivers in the latest kernels
are through I2C.i am going to use an temperature module through this adc
connected through SPI.so i think i am going to read the data only,no data
writing is required.

Let us try and see .If any body is having a reference driver for SPI based
ADC,they can share.

Regards

Arjun

On Sun, Feb 14, 2010 at 2:50 AM, Linus Walleij
<linus.ml.walleij-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:

> 2010/2/13 Jonathan Cameron <kernel-tko9wxEg+fIOOJlXag/Snyp2UmYkHbXO@public.gmane.org>:
>
> >>> can anybody share how to start a spi based ADC linux driver.I am having
> a
> >>> MAXIM 1242 ADC chip.
> >>
> >> The ḱernel does not contain any generic ADC subsystem abstraction
> >> (...)
> >
> > That's not entirely true.  These are covered by the IIO subsystem which
> > is admittedly currently in staging as some elements still need cleaning
> up.
> > (...)
> > ADC drivers are under drivers/staging/iio/adc.
>
> Great stuff. I knew about IIO and then it fell out of my mind, how
> could I...
>
> What strikes me especially about IIO is the underlying assumption, which I
> think ought to be written in clear somewhere where I missed it, and that
> is that all IIO drivers are supposed to deliver values and be controller
> from
> userspace with this nice ABI, and nothing's wrong with that of course.
>
> But I'm hinting about a few in-kernel uses: for AB3100 we have a battery
> charging mechanism, which use a (calibrated) ADC value supporting the
> bulk of the driver in the power/ subsystem.
>
> As it looks today IIO is not intended for the case where another subsystem
> needs to grab and use and ADC for its own purposes. Is this correct or did
> I get it all wrong?
>
> Would you say it'd be a good idea to hack the IIO ADC interface (for
> example) to be used also internally in the kernel, or would that violate
> the idea behind IIO?
>
> If these are disparate categories it would warrant a separate adc/
> subsystem, see.
>
> > Currently all discussions take place on LKML, but we are working on a
> more
> > focused alternative list which I'll announce once it is sorted out.
>
> LKML is just fine with me, for one.
>
> Yours,
> Linus Walleij
>

[-- Attachment #1.2: Type: text/html, Size: 2951 bytes --]

[-- Attachment #2: Type: text/plain, Size: 254 bytes --]

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev

[-- Attachment #3: Type: text/plain, Size: 210 bytes --]

_______________________________________________
spi-devel-general mailing list
spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: SPI-ADC
       [not found]           ` <dc6d3181002142029j13a9e57la45aa90a269404fa-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2010-02-15  8:49             ` jassi brar
  2010-02-15 17:33             ` SPI-ADC Ben Gamari
  1 sibling, 0 replies; 14+ messages in thread
From: jassi brar @ 2010-02-15  8:49 UTC (permalink / raw)
  To: arjun rath
  Cc: Jonathan Cameron, linux kernel,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Mon, Feb 15, 2010 at 1:29 PM, arjun rath <rath.arjun-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Let us try and see .If any body is having a reference driver for SPI based
> ADC,they can share.
Don't think you need to anything 'ADC specific' all u need is to _use_
your SPI driver.
grep for spi_sync in linux/drivers/ and refer to any spi user driver.

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: SPI-ADC
       [not found]           ` <dc6d3181002142029j13a9e57la45aa90a269404fa-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2010-02-15  8:49             ` SPI-ADC jassi brar
@ 2010-02-15 17:33             ` Ben Gamari
  1 sibling, 0 replies; 14+ messages in thread
From: Ben Gamari @ 2010-02-15 17:33 UTC (permalink / raw)
  To: spi-devel-general

Excerpts from arjun rath's message of Sun Feb 14 23:29:18 -0500 2010:
> Let us try and see .If any body is having a reference driver for SPI based
> ADC,they can share.
> 
Have a look here[1]. The code certainly isn't finished (we're at a
similar stage of development as you, it seem), but you should get the
rough idea.

Cheers,

- Ben


[1] http://goldnerlab.physics.umass.edu/git?p=tracker.git;a=blob;f=max5134.h;h=4aa93485347b5fb9f595b75147aeff3579c04966;hb=HEAD

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: SPI-ADC
  2010-04-26  7:26             ` SPI-ADC Haavard Skinnemoen
@ 2010-04-26  7:40               ` arjun rath
  0 siblings, 0 replies; 14+ messages in thread
From: arjun rath @ 2010-04-26  7:40 UTC (permalink / raw)
  To: Haavard Skinnemoen
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	hskinnemoen-AIFe0yeh4nAAvxtiuMwx3w

>> The max124[0|1] is still a spi device so using the atmel_spi driver is
>> the correct route.  You just need to add the necessary support to the
>> driver to handle the SPI_READY mode.
>
> If there's only one master driver which supports this flag, it sounds
> to me like it would be a _lot_ easier in the long run to instead teach
> the device driver to deal with drivers which don't support this mode.
>
> The atmel_spi hardware doesn't have any hardware support for this mode
> as far as I know, so the implementation will be very CPU-intensive
> either way.
>
> But the best solution is probably to replace the ADC with one that
> doesn't have a completely boneheaded interface.
>
> Haavard


Now i written the program with simple IO port reading/writing since
those pins can be also configured as gpio pins.And when pulling the CS
line LOW and checking the probe DOUT data is showing in the CRO but
while reading the DOUT pin it always shows 1(high) only.

Really its getting tougher and tougher

On Mon, Apr 26, 2010 at 12:56 PM, Haavard Skinnemoen
<haavard.skinnemoen-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> wrote:
> H Hartley Sweeten <hartleys-3FF4nKcrg1dE2c76skzGb0EOCMrvLtNR@public.gmane.org> wrote:
>> The max124[0|1] is still a spi device so using the atmel_spi driver is
>> the correct route.  You just need to add the necessary support to the
>> driver to handle the SPI_READY mode.
>
> If there's only one master driver which supports this flag, it sounds
> to me like it would be a _lot_ easier in the long run to instead teach
> the device driver to deal with drivers which don't support this mode.
>
> The atmel_spi hardware doesn't have any hardware support for this mode
> as far as I know, so the implementation will be very CPU-intensive
> either way.
>
> But the best solution is probably to replace the ADC with one that
> doesn't have a completely boneheaded interface.
>
> Haavard
>

------------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: SPI-ADC
       [not found]           ` <0D753D10438DA54287A00B0270842697636D941949-gaq956PjLg32KbjnnMDalRurcAul1UnsRrxOEX5GOmysTnJN9+BGXg@public.gmane.org>
@ 2010-04-26  7:26             ` Haavard Skinnemoen
  2010-04-26  7:40               ` SPI-ADC arjun rath
  0 siblings, 1 reply; 14+ messages in thread
From: Haavard Skinnemoen @ 2010-04-26  7:26 UTC (permalink / raw)
  To: H Hartley Sweeten
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	hskinnemoen-AIFe0yeh4nAAvxtiuMwx3w, arjun rath

H Hartley Sweeten <hartleys-3FF4nKcrg1dE2c76skzGb0EOCMrvLtNR@public.gmane.org> wrote:
> The max124[0|1] is still a spi device so using the atmel_spi driver is
> the correct route.  You just need to add the necessary support to the
> driver to handle the SPI_READY mode.

If there's only one master driver which supports this flag, it sounds
to me like it would be a _lot_ easier in the long run to instead teach
the device driver to deal with drivers which don't support this mode.

The atmel_spi hardware doesn't have any hardware support for this mode
as far as I know, so the implementation will be very CPU-intensive
either way.

But the best solution is probably to replace the ADC with one that
doesn't have a completely boneheaded interface.

Haavard

------------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: SPI-ADC
       [not found]       ` <y2tdc6d3181004222208uf6f4a9ecl7d0e2f084fd56a08-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2010-04-23 16:58         ` H Hartley Sweeten
       [not found]           ` <0D753D10438DA54287A00B0270842697636D941949-gaq956PjLg32KbjnnMDalRurcAul1UnsRrxOEX5GOmysTnJN9+BGXg@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: H Hartley Sweeten @ 2010-04-23 16:58 UTC (permalink / raw)
  To: arjun rath
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	hskinnemoen-AIFe0yeh4nAAvxtiuMwx3w

On Thursday, April 22, 2010 10:09 PM, arjun rath wrote:
> Hi ,

Please do a reply-all to keep the thread on the lists.  Also, please
do not top-post.  I fixed both here...

> On Thu, Apr 22, 2010 at 9:53 PM, H Hartley Sweeten <hartleys-3FF4nKcrg1dE2c76skzGb0EOCMrvLtNR@public.gmane.org> wrote:
>> On Wednesday, April 21, 2010 11:20 PM, arjun rath wrote:
>>> Hi Everybody,
>>>
>>> I am using a SPI based 12 bit adc(max1241) from maxim.I am trying to read
>>> the value from adc  using spi_read() in linux kernel.But every time i used
>>> to read i am getting *0xff* only.(i have to read two consecutive bytes).To
>>> the adc chip i am probing with CRO which always shows DOUT pin of ADC as
>>> high provided the input to ADC is always 1.1 volt.
>>> And the clock is also coming as seen in the CRO with Chip select line going
>>> low.
>>>
>>> Is it a delay problem since for adc's we have to wait for sometime for
>>> conversion of data....????
>>>
>>> Can anybody give some suggestion regarding this....
>>	
>> According to the datasheet, to start a conversion with the max124[0|1] you
>> need to pull the chip select low.  At the falling edge the T/H enters its
>> Hold mode and a conversion is initiated.  During this time the ADC will keep
>> the DOUT pin pulled low and the SCLK must be kept low during the conversion.
>> The end of conversion is signaled by DOUT going high.  At this point the
>> data can be shifted out with the SCLK signal.
>>	
>> It appears the SPI API is supposed to support this with the SPI_READY mode
>> flag.  But, the only SPI master driver in mainline that supports this flag
>> is the davinci_spi driver.
	
> Thanks for the reply.
>
> You mean to say with atmel spi master it is not possible(at91sam9263)...
> and to start the conversation i am pulling the chip select line low...

Looking at the atmel_spi driver it appears that it currently does not
support the SPI_READY mode.  So yes, with the driver as it is now it will
not work correctly with the max124[0|1] parts.

> Is it possible that i can write the serial protocol procedure what ever
> given in the datasheet instead of spi.

The max124[0|1] is still a spi device so using the atmel_spi driver is
the correct route.  You just need to add the necessary support to the
driver to handle the SPI_READY mode.

I added the author, Haavard Skinnemoen, to the Cc list to see if he has any
ideas to help.

Regards,
Hartley



------------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: SPI-ADC
       [not found] ` <o2idc6d3181004212320neaf99b0az27938c369e1a5557-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2010-04-22 16:23   ` H Hartley Sweeten
       [not found]     ` <y2tdc6d3181004222208uf6f4a9ecl7d0e2f084fd56a08@mail.gmail.com>
  0 siblings, 1 reply; 14+ messages in thread
From: H Hartley Sweeten @ 2010-04-22 16:23 UTC (permalink / raw)
  To: arjun rath, spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Wednesday, April 21, 2010 11:20 PM, arjun rath wrote:
> Hi Everybody,
> 
> I am using a SPI based 12 bit adc(max1241) from maxim.I am trying to read
> the value from adc  using spi_read() in linux kernel.But every time i used
> to read i am getting *0xff* only.(i have to read two consecutive bytes).To
> the adc chip i am probing with CRO which always shows DOUT pin of ADC as
> high provided the input to ADC is always 1.1 volt.
> And the clock is also coming as seen in the CRO with Chip select line going
> low.
> 
> Is it a delay problem since for adc's we have to wait for sometime for
> conversion of data....????
> 
> Can anybody give some suggestion regarding this....

According to the datasheet, to start a conversion with the max124[0|1] you
need to pull the chip select low.  At the falling edge the T/H enters its
Hold mode and a conversion is initiated.  During this time the ADC will keep
the DOUT pin pulled low and the SCLK must be kept low during the conversion.
The end of conversion is signaled by DOUT going high.  At this point the
data can be shifted out with the SCLK signal.

It appears the SPI API is supposed to support this with the SPI_READY mode
flag.  But, the only SPI master driver in mainline that supports this flag
is the davinci_spi driver.

Regards,
Hartley
------------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 14+ messages in thread

* SPI-ADC
@ 2010-04-22  6:20 arjun rath
       [not found] ` <o2idc6d3181004212320neaf99b0az27938c369e1a5557-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: arjun rath @ 2010-04-22  6:20 UTC (permalink / raw)
  To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Hi Everybody,

I am using a SPI based 12 bit adc(max1241) from maxim.I am trying to read
the value from adc  using spi_read() in linux kernel.But every time i used
to read i am getting *0xff* only.(i have to read two consecutive bytes).To
the adc chip i am probing with CRO which always shows DOUT pin of ADC as
high provided the input to ADC is always 1.1 volt.
And the clock is also coming as seen in the CRO with Chip select line going
low.

Is it a delay problem since for adc's we have to wait for sometime for
conversion of data....????

Can anybody give some suggestion regarding this....

Thanks in advance
------------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2010-04-26  7:40 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-13  5:48 SPI-ADC arjun rath
     [not found] ` <dc6d3181002122148v6451ebffka164de288738485d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-02-13  6:38   ` SPI-ADC Ben Gamari
2010-02-13 13:48 ` [spi-devel-general] SPI-ADC Linus Walleij
2010-02-13 16:51   ` Jonathan Cameron
2010-02-13 17:03     ` Mike Frysinger
2010-02-13 21:20     ` Linus Walleij
     [not found]       ` <63386a3d1002131320u5afbc35ak2bc3533aab3f1e54-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-02-15  4:29         ` SPI-ADC arjun rath
     [not found]           ` <dc6d3181002142029j13a9e57la45aa90a269404fa-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-02-15  8:49             ` SPI-ADC jassi brar
2010-02-15 17:33             ` SPI-ADC Ben Gamari
2010-04-22  6:20 SPI-ADC arjun rath
     [not found] ` <o2idc6d3181004212320neaf99b0az27938c369e1a5557-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-04-22 16:23   ` SPI-ADC H Hartley Sweeten
     [not found]     ` <y2tdc6d3181004222208uf6f4a9ecl7d0e2f084fd56a08@mail.gmail.com>
     [not found]       ` <y2tdc6d3181004222208uf6f4a9ecl7d0e2f084fd56a08-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-04-23 16:58         ` SPI-ADC H Hartley Sweeten
     [not found]           ` <0D753D10438DA54287A00B0270842697636D941949-gaq956PjLg32KbjnnMDalRurcAul1UnsRrxOEX5GOmysTnJN9+BGXg@public.gmane.org>
2010-04-26  7:26             ` SPI-ADC Haavard Skinnemoen
2010-04-26  7:40               ` SPI-ADC arjun rath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).