09-17-2009 12:18 PM
Hi NicB:
I don't know why but with your program I wasn't able to have SCLK or SS, don't know why, so I build one from your base code and your ideas.
The result was:
when using circular buffer [512 / 1 / 2 / Sub Buffer] sometimes I get a callback, but very randomly and slow.
when using Init 1D Buffer [1 / 2] and 512 Chained Buffers, it didn't callback at all.
Here is the main code (I tried other buffertype too), the callback only do Data Ready = True:
Thanks for everything, once more, I'll move to PPI now!
Just one thing AD7476A only operates in SPI mode, I'll use AD7938 because it has built in 8 ADC's and sequencer, so I can read all of them one sample for each one, amazing 😛 I hope coding in PPI not to be very hard..
Regards,
09-17-2009 01:22 PM
09-19-2009 09:29 AM
Sometimes my brain gets frozen mode..
I can simply use SPI with only one Slave Select and use an ADC with sequencer (you said that in option #3), they come in a single IC (8 ADC's plus sequencer) and seems easy to use.
I'll choose ADC later (ADI site is down) and start the design, I'll post results asap.
Regards,
09-21-2009 08:18 AM
I was very busy so I shall reply to all posts here.
freitas wrote:I don't know why but with your program I wasn't able to have SCLK or SS, don't know why, so I build one from your base code and your ideas.
The result was:
when using circular buffer [512 / 1 / 2 / Sub Buffer] sometimes I get a callback, but very randomly and slow.
when using Init 1D Buffer [1 / 2] and 512 Chained Buffers, it didn't callback at all.
Here is the main code (I tried other buffertype too), the callback only do Data Ready = True:
There are some wrong assumptions in my code. It seems I had forgotten how ADI buffers work in LabVIEW and pros/cons of using them :).
freitas wrote:
Just one thing AD7476A only operates in SPI mode, I'll use AD7938 because it has built in 8 ADC's and sequencer, so I can read all of them one sample for each one, amazing 😛 I hope coding in PPI not to be very hard.
I would use AD7938 as a memory mapped peripheral and not with PPI
Just to clarify things regarding my PPI proposal, here it is a diagram (they are serial ADCs, as AD7476A)
And another kinf of diagram to get actual samples after reading 16 bytes
freitas wrote:Sometimes my brain gets frozen mode..
I can simply use SPI with only one Slave Select and use an ADC with sequencer (you said that in option #3), they come in a single IC (8 ADC's plus sequencer) and seems easy to use.
I'll choose ADC later (ADI site is down) and start the design, I'll post results asap.
Regards,
Note, you need to send the configuration register for next conversion while reading the current one. I would use SPI in chained loopback mode.
- One transmit buffer filled with config for
AD2, AD3, AD4, AD1 (for 4 inputs)
- One receive buffer, or two chained (of course, element count has to be multiple of inputs #).
Regards
09-21-2009 09:55 AM
Hi NicB:
Thanks for your posts! I'll try this way, as it looks the easy one, if it doesn't work I'll move to your solution:
using SPI ADC AD7928 with sequencer!
link: http://www.analog.com/en/analog-to-digital-converters/ad-converters/ad7928/products/product.html
It's programmable, and once programmed it will change the channel of ADC in each CS! I can configure it for example to sequence only 6 ADC's or use 7 and the 7th for sync!
Just one thing, is there any docs to explain the labview buffers (circular, chained, chained with loopback)!
I don't know the best one to use, since I want anything close to Real Time Analysis (old data beeing wasted), and I don't know the difference between chained and chained with loopback..
Regards,
09-21-2009 11:32 AM - edited 09-21-2009 11:38 AM
freitas wrote:Just one thing, is there any docs to explain the labview buffers (circular, chained, chained with loopback)!
I don't know the best one to use, since I want anything close to Real Time Analysis (old data beeing wasted), and I don't know the difference between chained and chained with loopback..
Actually they are ADI buffers not labview ones. Bellow there is an usage example, for more information see Deciding on a Dataflow Method/section 10 of VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors (select download from here, along with other manuals).
freitas wrote:Just one thing, is there any docs to explain the labview buffers (circular, chained, chained with loopback)!
I don't know the best one to use, since I want anything close to Real Time Analysis (old data beeing wasted), and I don't know the difference between chained and chained with loopback..
Probably you are asking about a double buffering technique - process a frame while the other is being acquired. Of course, the only real-time involved here is to finish processing data before next set of samples arrives.
Let’s particularize this to your application:
I would not recommend something like this (that is the main issue forgotten in application posted previously).
Of course, it seems we have two buffers but there is only one with two descriptors (this result into an interesting behavior, sometime useful, in some applications).
freitas wrote:
using SPI ADC AD7928 with sequencer!
link: http://www.analog.com/en/analog-to-digital-converters/ad-converters/ad7928/products/product.html
It's programmable, and once programmed it will change the channel of ADC in each CS! I can configure it for example to sequence only 6 ADC's or use 7 and the 7th for sync!
If you want to use shadow register I would recommend opening SPI first for writing and then close and reopening for reading.
10-04-2009 12:10 PM
Some "old" update:
It's possible to select each Slave Select for writing only one time faster, I managed to config it with SCLK = 1MHz...
Despite this looks very good, it is not... the true SPS (Samples Per Second) was about 300Hz, because after writing and/or reading to SPI the wait time after that is very huge.. However this can be usefull...
I'll continue to work, to post some updates!
Regards,
P.S. - here is the main thing: (this is based on SPI and UART example, they use BF Device Wait Buffer...)
10-17-2009 03:00 PM
Hi everyone:
Here I send you a .vi to configure the AD7928 from Analog Devices, 8-channel SPI ADC with sequencer!
It was based on SPI_and_UART example!
Good Luck for using multiple SPI devices 😛
Regards,
P.S. - one special thank to NicB 😉
10-19-2009 09:23 AM