This is Bhimesh . I need a linux driver for spi interface for AD7266 part .
Thist fit like a fist on a eye
Yesterday I was searching for a ADC and came to the AD7266 too.
I run a Marvel Discovery MV78200 (it is a killer) with two PCIe 4x or up to eight PCIe 1x which I like to use as a PanelPC with some Scientific Modules which will contain the AD7266 and some Very-HighSpeed ADCs (AD9637).
However, it seems I have to code the driver my own... (I have realy not enought time to do this too)
Can you describe your system, setup and application a little bit?
We usually only do host independent device drivers.
A driver becomes host independent in case a standard system bus, such as SPI or I2C is used.
So in this case we would need to make this an AD7266 SPI bus client driver.
SPI typically features only one MISO strobe, so the theoretically sample rate will reduce
from 2MSPS to 1MSPS, when using only one AD7266 DOUT strobe.
Readout speed will be set by spi:max_speed_hz. SPI bus is not really suited for continuously sampling at
high frequency. So there is no guarantee that you can achieve constant or maximum sample rates.
If that's not an problem for you, we can provide an AD7266 Linux driver.
If you require continuously sampling at high frequency, you should better connect it to your processors high speed
synchronous serial interface peripheral such as TI OMAP McBSP, Freescale SSI, ADI Blackfin SPORT, etc.
However since there is no generic bus abstraction for these in Linux, we can't provide host independent device drivers.
thank you for you answer.
To make my industrial PanelPC modular, I use only USB 3.0 which mean, the problem starts here, to find a USB 3.0 Device Controller. It is already enough, ifit pass-trough the data. Firmware can be written easily. And applications on the Host-Side can be written as usualy.
However, connecting a bunch of AD7266 to a µC gives me headache.
I mean, I have TWO similar ADCs connected to a PIC32MX795F512H with an EPSON S1D13782 SPI->TFT Controller and CAN. The PIC32MX handel nicely the traffic.
However, the load on the µC would be to high so I like to use a DSP (Shark or TigerShark) where I can connect many ADCs.
Currently I have only a Blackfin EVKit running Linux, but what about Shark or TigerShark?
Does it make sense to run Linux on it?
In general, I need 2 Modules for my PanelPC
1) 8-32 ADCs with 6-8bit as Digitizer with at least 2 MSPS/Channel and I was ongoing to use the AD9637 instead of the AD7266 but how to handel 8 and more LVDS channels?
2) 2 Very HighSpeed ADCs with>12bit and more then 250MSPS used as DSO
So which solutions do exist for this kind of usage?
I am new to the HighSpeed Sampling Country and need some advices...
...and it seems, I am not alone.
For your ADC module you could use a BF54x running Linux. This one features 4 SPORTS, so you can connect up to for AD7266 ADCs.
But it's still not enough for your application.
The SHARC DSP family typically features more SPORTs, however there is no Linux available for SHARC.
When reading your application requirements - it calls for an FPGA.
And in my opinion using an FPGA to connect your high speed converters is the only solution.
For more help on FPGA Converter Interface HDL, see here:
Thanks for your reply
Actually we are having OMAP3530 infaced to AD7266 by McSPI or McBSP (i.e we not at decided) . But after your reply we will go for McBSP. So do you have linux driver for this adc part through interfaces like McBSP or MCSPI or else related C code .
Sorry we don't have or develop host dependant drivers. But I can offer that
we develop a spi bus client driver for the AD7266, and you can convert it
for your processor platform high speed serial bus afterwards.
Thanks for your reply Michael.
Please provide me such a spi client driver for AD7266 part .
Plz provide AD7266 driver for us.
Sorry, the driver is not yet written.
I'll get back to you once it is done.
Most likely by the end of next week.
I've just posted the driver for AD7266 on the linux-iio mailinglist. http://marc.info/?l=linux-iio&m=132333392615585&w=2
To sucessfully build the driver you'll need the latest linux iio kernel tree and also you need to apply this patch ontop of it before the patch for the driver.
You can find documentation for the driver in our wiki.
I've attached both the patch for the driver and the patch it depends on to this post.
Hope this helps, I've you have any issues with the driver or any questions regarding it's usage feel free to send a follow-up post.
Thanks for Reply . I will go through it .
From: larsc firstname.lastname@example.org
Sent: Thursday, December 08, 2011 3:05 PM
To: kumar bhimesh
Subject: New message: "AD7266"
<http://ez.analog.com/index.jspa> Analog Devices EngineerZone
reply from larsc <http://ez.analog.com/people/larsc> in Linux Device Drivers - View the full discussion <http://ez.analog.com/message/38016#38016
We are using 2.6.37 kernel version. we tried to apply the given patches to our kernel. But we are getting following errors.
Patch Commands :
bhimesh@bhimesh-desktop:~/current/AM35x-OMAP35x-LINUX-PSP-04.02.00.07/src/kernel/linux-04.02.00.07$ patch p0< /home/bhimesh/DSP/ADC/0001-staging-iio-ring_sw-Add-helper-function-for-initiali.patch
patching file p0
Hunk #1 FAILED at 15.
Hunk #2 FAILED at 414.
2 out of 2 hunks FAILED -- saving rejects to file p0.rej
Hunk #1 FAILED at 23.
Hunk #2 FAILED at 32.
bhimesh@bhimesh-desktop:~/current/AM35x-OMAP35x-LINUX-PSP-04.02.00.07/src/kernel/linux-04.02.00.07$ patch p0< /home/bhimesh/DSP/ADC/0002-staging-iio-adc-Add-AD7265-AD7266-support.patch
Hunk #1 FAILED at 13.
1 out of 1 hunk FAILED -- saving rejects to file p0.rej
Hunk #1 FAILED at 30.
Can you please update the patch to our kernel version (2.6.37) as we compiled our applications for 2.6.37 kernel . Now it is very hard to move to another kernel. Because this working kernel for my board.
The short answer is no.
If we tried to provide a driver version for every different kernel version - development would stop. Our model is to provide something that works what is stable on kernel.org at the time of development, and then forward port this as changes are necessary.
2.6.37 was released over a year ago (04Jan2011) - too many things have changed since then.
As Robin said we don't have a driver for this chip for 2.6.37, but what might work in your case is to backport the whole IIO framework from a more recent version. It shouldn't have to many external dependencies, so copying drivers/staging/iio folder over from say 3.2 could work.
Ok Larsc. Could you please tell me which stable kernel version suitable for this adc patch so that we can apply successfully without any hunk failed. I gone through the linux-3.2.1 stable version . But I think it is not the right one for it .
Link : http://www.kernel.org/
Sent: Monday, January 23, 2012 9:06 PM
reply from larsc <http://ez.analog.com/people/larsc> in Linux Device Drivers - View the full discussion <http://ez.analog.com/message/40934#40934
I've rebased the necessary patches onto v3.3-rc1 for you and attached them to this message.
Could you please tell me where the converted digital samples are stored.
The data is stored in a kernel ringbuffer. You can access the data by reading from the /dev/iio:deviceX (where X is your iio device number e.g. /dev/iio:device0) device node. Take a look at drivers/staging/iio/Documentation/generic_buffer.c for an example.
I was inserted the driver into my linux kernel .
At root :sys/bus/iio/devices/ i verified for the iio:device0 and trigger0 using ls command .
Nothing is displayed . Does i need any thing else i have enable in the code what i have to do.
You first need to select the channels which you want to sample. You'll find the available channel in /sys/bus/iio/devices/iio:device0/scan_elements. You can select a channel by writing '1' to in_voltageX-voltageY_en e.g. `echo 1 > in_voltage0-voltage1_en`. The next step is to set the buffer size. This can be done in the /sys/bus/iio/devices/iio:device0/buffer folder by writing the buffer size to the length file. E.g. `echo 1000 > length`, this will ensure that the buffer is large enough to hold 1000 samples. The last set is to enable the buffer this can be done by writing '1' to the buffer enable attribute. E.g. `echo 1 > enable`. Now you can read samples from the sample buffer by reading from /dev/iio:device0.
For a more detail explanation on the different sysfs attributes checkout our wiki page for the AD7622.
Thanks for the support. The driver we got is Mcspi based A/D converter. But with this driver i think it is tough to get 2MSPS speed . Can you provide to us MCBSP based driver for this part or else tell me how to update this driver to get MCBSP based driver .
As pointed out earlier in this thread, we do not develop host depended drivers. If you'd want to use the MCBSP you can either develop a driver which exposes the MCBSP as a normal SPI master device. Or since you are aiming for maximum performance you might want a bit tighter integration. So you'd have to replace the generic spi transfer calls in the ad7266 driver with custom code which talks to the MCBSP.
Retrieving data ...