Page 1 of 1

SPI + GPI interface

Posted: Tue Nov 20, 2018 8:21 pm
by RedDragon
Hello,

I am thinking on connecting ADS8685 analog input to a raspberry pi zero. It needs 32 bit spi datatransfer and needs some gpio to full utilization. I am looking for a good solution handle the signals. Any idea which may work welcomed.
Thanks in advance!

Re: SPI + GPI interface

Posted: Wed Nov 21, 2018 11:56 am
by RattusRattus
Please expand your question. I don't understand what you are asking so I can only offer some general advice for now:

* The ADS868x is able to interface with the Pi as you have already suggested using SPI and a handful of GPIO lines.
* It is 3V3 logic so you will not need any level shift.
* The SPI bus on the Zero is on pins 19 (SPI_MOSI), 21 (SPI_MISO), 23 (SPI_SCK), and there are chip selects on pin 24 (SPI_CE0_N) & 26 (SPI_CE1_N) you will only need the one chip select line (your choise which), likewise it is your choise which GPIO lines to use.
* Section 7.4.1.x of the ADS868x datasheet shows the suggested interconnetion.
It also suggests that some issolation barrier may be used if you want to seporate conducted noise from the digital syetm (the Pi) and Analogue side (including the DAC).
* At bare minimum I would place series termination resistors on all of the control lines and the spi bus to reduce reflections
(but unless you are going down the route of controlled impeadance tracks between your Pi and the DAC to get correct matching, a simple 33R anywhere on each net will probably work fine).
* DACs always work best with a clean power supply. A seporate power rail and issolation of signals from the Pi will make a differance to the output noise - but depending on your application this may not be needed.
* Likewise noise can be reduced by carefull PCB layout; think about signal coupling and clean signal path

Re: SPI + GPI interface

Posted: Wed Nov 21, 2018 5:49 pm
by RedDragon
Thank you for take a look at the device datasheet.
Points still open how can I control the device. According to the datasheet it needs 32 bit word length and Raspberry can transfer 8 bit words. Linux driver can transfer that in multibyte form, as I start to understand but it still needs further investigations.
The other issue is the auxilary pins which can be eliminated from the circuit ( not required according to the datasheet ) but if I could check lines states with GPIO functions from C, would be great. And I am in the difficult point I have no experience how the read the ports beside the linux driver.

Re: SPI + GPI interface

Posted: Mon Dec 03, 2018 3:27 pm
by RattusRattus
So linux has a GPIO driver that you can play around with from the command line. see /sys/class/gpio
I would use that to initially play with the GPIO lines (not the SPI lines) that you conect to the DAC.
simply read and write files (direction, value etc) for the appropriate pin

Likewise the SPI drivers are pretty simple to play with. take a look at linux/spi/spidev.h
You will see that there is a control structure "spi_ioc_transfer". in there you can set byte order, bit speed, bitsPerWord (you can send / receive 32 bit frames if you want - you are not forced to use 8 bit transfers), the clock phase and edge as well as a fram delay period.


/Andy

Re: SPI + GPI interface

Posted: Fri Dec 14, 2018 3:00 am
by RedDragon
Thank you for the suggestions. I have made a small testboard and some small program (they still need some "finishing"), but it works.

Laszlo