2011-09-14 14:46:39     ADC and DAC over SPI + GPIO

Document created by Aaronwu Employee on Aug 27, 2013
Version 1Show Document
  • View in full screen mode

2011-09-14 14:46:39     ADC and DAC over SPI + GPIO

Dario Bueno-Baques (MEXICO)

Message: 103389   

 

Hi everybody:

 

I planning to develop an application for the bf537 stamp where is necessary to acquire some data from an ADC (16 bits simultaneous sample, aka AD7655) make some processing and output some data trough a dual DAC (~AD7663 or AD5545). Additionally will be highly convenient to have access to several GPIO pins for miscellaneous configurations.

 

I have been reading the docs and following several posts at the forum, but still don’t have a clear idea about the best way to proceed.

 

Seems that the one possibility is to hookup the ADC and DAC to the spi bus. Here is it possible to use the spidev driver to communicate with both of them?? Also, seems that the spi bus is transparent to the actual ports (SPORT or SPI) where the parts are actually connected, in this case, if the SPORTs are used it is possible to gain access (using some driver) to the GPIO at the same time?? In this later case, is it necessary to enable at the same time the “emulate SPI bus with Blackfin SPORT” and the “user SPI “??

 

Any help will be really appreciated!! Thanks,

 

 

 

Dario

QuoteReplyEditDelete

 

 

2011-09-14 22:56:24     Re: ADC and DAC over SPI + GPIO

Aaron Wu (CHINA)

Message: 103391   

 

If you are connecting to the ADC and DAC by SPI interface, sure you can use the SPI and SPI dev driver to read/write to them with data processing between them. We have multiple SPI controllers and multiple chip selects for a single controller, should be enough for you. Why mentioned sport over SPI, Do you have any considerations for the SPORT emulated SPI? If the sports is reserved as sports over SPI it can not works as GPIO unless you do some tricky hacking. I did not check the details of the ADC/DAC you mentioned, but can the misc configuration of them be done by SPI other than GPIO?

QuoteReplyEditDelete

 

 

2011-09-15 09:34:15     Re: ADC and DAC over SPI + GPIO

Dario Bueno-Baques (MEXICO)

Message: 103397   

 

Hi Aaron:

 

 

 

Thank you for your answer. The parts, in particular the ADC, have some lines that should be managed (aka AD7606 for which an IIO driver exists) and that are not related to the SPI.  If I understand correctly, it is possible to connect both parts to the SPI bus, use different PF – GPIO lines as chip select, and gain access to the other GPIO lines without activating the “SPI over SPORT” feature. Correct??

 

 

 

If I manage to make a custom board for the ADC that connects to one SPORT port, is it possible to use the SPI lines and at the same time the GPIO lines (excluding the selected CS line) independently? Meaning, use the SPI for data exchange and the other GPIO lines for configuration?? This as you suggested, without activating the “SPI over SPORT”.

 

 

 

In a past post, Mike Frysinger, made the statement that the spidev driver should not care about where the part is actually connected. Which extend has that, regarding the other GPIO lines in the SPORT??

 

 

 

Again, any help will be really appreciated. Thanks,

 

 

 

Dario

QuoteReplyEditDelete

 

 

2011-09-15 22:01:26     Re: ADC and DAC over SPI + GPIO

Aaron Wu (CHINA)

Message: 103403   

 

Hi Dario,

 

Yes you are right, you connect to both parts with SPI interface for data transaction, either the hardware SPI interface, or the SPORT simulated SPI interface, as you like, recommend you to use the hardware SPI controller as it's by hardware and suppose to consume fewer CPU cycles.  And for GPIO configurations, you use GPIOs, you may use the SPORT perepheral PINs to work as the GPIO for configuration, since it's configure to GPIO so yes you are right don't need to active "SPI over SPORT"

 

If your customer board has already been designed to connect to the ADC/DAC part SPI interface with SPORT interface of Blackfin, yes you use the GPIO simulated SPI driver over sport, the code is in drivers/spi/bfin_sport_spi.c. And use other GPIO lines for configuration.

 

spidev is a software layer built in the kernel for manipulating the spi data transaction from the userspace, and it's constructed upon the general spi framework in drivers/spi.c, so no matter how the actual spi controller driver is implemented, by hardware spi controller, or by SPORT simulated controller, it is transparent to the spidev layer and the user can ingore this, for details you check the implementation of spidev in  drivers/spi/spidev.c

QuoteReplyEditDelete

 

 

2011-09-15 22:25:16     Re: ADC and DAC over SPI + GPIO

Dario Bueno-Baques (MEXICO)

Message: 103404   

 

HI Aaron:

 

Thank you. I'll go deeper into the drivers files.

 

Dario

Attachments

    Outcomes