I am using a ADSP BF527 based board. I use 2011R1 Head distro, and 2011R1-RC4 toolchain.
I plan to read data from AD7476.
Now its possible to read the data from AD7476 through SPIDEV, and also through the IIO Framework.
I used the AD7476 STAMP board.
Once I had made the hardware connections between AD7476 STAMP board to my platform, I tried to read data through both of the above mentioned options.
The Input Voltage was connected to ground.
The SPI Clock rate was 1MHz
The Chip Select has a rate of 100 Hz.
For Both SPIDEV and IIO cases the read data was written to a file in the form "S.No, Data Value", where S.No is the serial number of the captured data
Please find attached the files J13_SPI_MISO_AD7476_DATA_SPIDEV.csv, and J13_SPI_MISO_AD7476_DATA_IIO.csv containing the captured data through SPIDEV and IIO respectively.
As can be seen from these files, there is a huge difference (around 3000 levels), between the two sets of data.
Note : For IIO Case the following configurations were done once the kernel had booted up :
echo spi0.49 > /sys/bus/spi/drivers/ad7476/unbind
echo spi0.49 > /sys/bus/spi/drivers/ad7476/bind
echo 100 > /sys/bus/iio/devices/trigger0/frequency
echo bfintmr3 > /sys/bus/iio/devices/device0/trigger/current_trigger
echo 5000 > /sys/bus/iio/devices/device0/device0:buffer0/length
echo 0 > /sys/bus/iio/devices/device0/device0:buffer0/scan_elements/timestamp_en
echo 1 > /sys/bus/iio/devices/device0/device0:buffer0/scan_elements/in0_en
echo 1 > /sys/bus/iio/devices/device0/device0:buffer0/enable
Note: The hardware connection was not touched after the initial setup (done before both the experiments), and for both SPIDEV and IIO experiments, the hardware setup was identical.
Also find attached the files, main_spidev.c and main_iio.c which contain the code used in these experiments.