Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

6561 Acquisition & Generation Application

I am looking into using the PXI-6561 to emulate the slave side of an SPI (Serial Peripheral Interface) bus.

Page 3 of the following link has a timing diagram that's pretty close to what we're doing (CPOL=0, CPHA=1):

http://www.xilinx.com/bvdocs/appnotes/xapp348.pdf

In order to do this I need to use STROBE (SPI's SCK) for both acquisition & generation, but this doesn't appear to be a valid option for acquisition. Is there a way to work around this? (I can live with fairly sloppy timing.)

We were planning to tie the SPI SS to PFI 1 for use as a trigger. Is there a way to also use this signal to stop acquisition/generation?

Any other pointers or thoughts for this app? (I was looking at DeviceDynamicAcqAndGen-SourceSynchronous.c as a starting point.)
0 Kudos
Message 1 of 6
(4,750 Views)

Hey Dean,

 

 

 

I believe using this device for SPI will not be easy. Although I am including some workaround on the problems you mention you might want to consider using the USB-8451 (https://www.ni.com/en-us/support/model.usb-8451.html) or directly FPGA.

 

 

 

First the strobe IS available for acquisition but not generation. You can confirm this on the help file (located in Start»All Programs»National Instruments»NI-HSDIO»Documentation»NI Digital Waveform help) on the clock sources of the device section.

To control this clock with the PFI line you will need to use triggering and retrigger each time you stop it. This can be done with scripting.

Can you provide more information in why this need to be implemented with HSDIO?

Regards,

Yardov

 
Gerardo O.
RF SW Engineering R&D
National Instruments
0 Kudos
Message 2 of 6
(4,731 Views)
Not sure why this card was selected, but LVDS signals are a requirement. Not sure that weither of the links posted quite do the trick -- I need to emulate the slave side of the SPI.
0 Kudos
Message 3 of 6
(4,691 Views)
dean,
 
How fast do you need the interface to run?  The timing diagram you linked, and SPI in general, does not require a free running clock.  The 656x devices, however, require that the clock is always running.  Gating the clock could result in clocking or data errors.  However, if your interface is running sufficiently slower then the max rate of your 656x then you could use a combination of oversampling and triggering to acquire the signals. 
 
It may be possible to use the SCK signal as a pause trigger (input the SCK signal into a data line for pattern match or use a level based trigger on a PFI) which you would use as a synchronous event to qualify the data.  If the acquisition is running using an onboard clock, then you can oversample the data up to 100MHz using the 6561 or 200MHz using the 6562. 
 
Please note that in doing this, the data and SCK signals will be sampled using an unsynchronized clock (unless your DUT has a mechanism to run from an external clock source?) so there is a large probability for sample error.  This is an artifact of channel to channel skew.  Since you can't guarantee phase of a clock relative to the data in an asynchronous system, there is potential that the acquisition clock edge could occur between the SCK data transistion and the MOSI signals.  If you are adequately oversampling, though, you can do some post processing to account for that behavior.  Since you have to do post processing to deserialize the data, though, this should be a simple amount of overhead.
 
Also, some SPI interfaces, on microcontrollers for example, generate a MISO message in response to the MOSI data.  The response time of the 656x devices would be dominated by how fast you can pull the data out into your ADE, deserialize and analyze it, generate the response, and download it into hardware.  If you have a set of known responses, this can be minimized by downloading all of the reponses intially then just tell the hardware which one to generate at a given time.
0 Kudos
Message 4 of 6
(4,683 Views)
Ryan -

The interface is slow: 1/2 MHz clock. Even at that rate, I'm leary about having the ADE/PC in the loop to drive the MISO signal generation.

Pre-loading a bit pattern for MISO is acceptable. However the timing is sloppy, so doing this asynchronously for the entire transfer (SS active) seems too fragile.
0 Kudos
Message 5 of 6
(4,677 Views)

Dean,

Unfortunately, you have to get the ADE involved in order to do the deserialization.  If you run the acquisition using just a 2 MHz clock, for example, you'll sample the data ~4 times for each SCK period (could get 3, may get 5 depending on frequency mismatch between 500k and 2M).  Since the timing error would be generated on the first or last of these samples, you can throw them away and only analyze the middle sample(s) since we can guarantee that they will be correct.  If you capture the SCK as data, you can then use this to qualify the data further.

Once you deserialize and interprete the data, you can use the "niHSDIO Configure Waveform To Generate" function to specify which predownloaded waveform you need to generate as a response.

0 Kudos
Message 6 of 6
(4,672 Views)