NI Home > Community > NI Discussion Forums

Components

Reply
Member
geneM
Posts: 12
0 Kudos

Re: SPI Digital Waveform Library

Hi - I'm hoping to use the set of libraries and examples you provide in this thread with a CUI AMT203 absolute position encoder that has an SPI interface.  I've read this thread and everything else I can find on the NI website but can't tell if I'll be able to use these .vis with a N-I9401 in a cDAQ-9174 chassis.  I know the 9174 has hardware timing but I'd like to double check that the "DAQmx SPI.vi" example is a good place to start with my hardware.

 

Thanks for the help - Gene M.

Active Participant
Dan_K
Posts: 256

Re: SPI Digital Waveform Library

Hello Gene,

You shouldn't have problem using the 9174/9401 combination to control your device, but there are a couple of things you have to be aware of:

  1. DAQ devices do not support per cycle tristate. This means that if you are attempting SPI communication on a single data line it would not work. Looking at the module you are using this doesn't seem to be an issue as there are seperate lines for input and output.
  2. The 9401 is nibble configurable. This means that all of lines 0-3 must be configured as input or ouptut and all of lines 4-7 must be configured as input or output. Each nibble can be different, but the lines within each nibble have to be the same. I would also take a look at KnowledgeBase 59QILUD2: Why Do I Get Error 201133 When Trying To Perform Bidirectional DI/O with My ... for more information on using this device for input and output.

Regards,
Dan King

Active Participant
David S.
Posts: 425
0 Kudos

Re: SPI Digital Waveform Library

Thanks for the help Dan! Just to clarify point 1, tristate shoudln't be a problem with SDW because it only supports 4-wire configurations where every line has a dedicated direction.

David Staab, CLA
Staff Systems Engineer
National Instruments
Active Participant
David S.
Posts: 425
0 Kudos

Re: SPI Digital Waveform Library

To All -

 

It appears the "slowdown effect" that HF-Walter reported for LV2010 may be caused by the LV8.6 code being recompiled when it is loaded into memory. If you click "Save All" after loading the VIs, these compilation changes should be committed to the VIs, and the dev-time execution speed should be restored to what it was in LV8.6 and LV2009.

David Staab, CLA
Staff Systems Engineer
National Instruments
Member
labman1
Posts: 1
0 Kudos

Re: SPI Digital Waveform Library

Hi,

 

Could someone please tell me if I can use the SPI Digital Waveform with my PCI-6221 DAQ. I need to communicate with an Analog Devices gyro directly from the DAQ.

 

Thanks

 

 

Member
Zbig
Posts: 1
0 Kudos

Re: SPI Digital Waveform Library

Hi,

 

Could someone please tell me if I can use the SPI Digital Waveform with my NI PXI-6133 DAQ. I need to communicate with an ATMega microcontroller directly from the DAQ.

 

Thanks

 

Active Participant
DJ_L.
Posts: 396

Re: SPI Digital Waveform Library

Hey labman1 and Zbig, (and anyone else wondering if this supports their specific hardware/DAQ device),

 

On the SPI Digital Waveform Reference Library page, it mentions that "These waveforms can be generated using any National Instruments hardware-timed digital i/o device." So check to see if your device supports hardware-timed Digital IO, and if it does, then you more than likely can use the waveforms that the tool generates with your digital device to communicate with SPI devices. This is also mentioned earlier in this discussion forum, if you glanced through some of the other posts on here. Hope this helps.

 

Regards,

DJ L.

Member
Deborah_Y
Posts: 155
0 Kudos

Re: SPI Digital Waveform Library

Hello Zbig,

 

As DJ L pointed out, since the 6133 has Correlated Digital I/O it should run just fine. Are you looking to buy this card? If so we can test it out for you to double check. If you already have this card I'd say go ahead and use it. Please post with your results.

 

Thank you,

Deborah Y.

LabVIEW Product Marketing Engineer
National Instruments
Member
alanxie
Posts: 25
0 Kudos

Re: SPI Digital Waveform Library

Hi Christian Loew,

 

I have some basic questions about how to use SPI digital waveform library. Can you provide me with detailed explanation on how to set up "SPI timing (ns)" Control input terminal? I want to know the definition of each items in this cluster. Currently, I want to send out some SPI command to my device. CPOL=0, CPHA=1, sample rate is prefered to be 1M. But I don't know how should I fill out other items in "SPI timings", SCLK freq, MOSI setup, SCLK hold, CS lead, CS trail, CS idle, etc.

 

Can you give me an example of setting up those SPI timing information? Thanks.

 

 

Member
alanxie
Posts: 25
0 Kudos

Re: SPI Digital Waveform Library

I have a question regarding the SPI timing setting. When I choose to use CPHA=1, namely "format = 1", I found that I have to set MOSI setup time to be smaller than SCLK Assertion time. Even if they are equal, it won't work and no SCLK pulses generated.

 

For instance, in my program, I set CPHA=1, sample rate = 1M, SCLK frequency = 100K. SCLK hold time = 5000ns, MOSI setup time = 5000ns. LV program does not generate any SCLK pulse. But if I change MOSI setup time = 4500ns, I start to see SCLK pulse. However, DIN changes 1 clock tick after the posedge of SCLK. How can I make DIN change align to the posedge of SCLK, no lag at all? When I look into the block digram of "init.vi", it requires  (SCLK period - SCLK hold time) greater or equal to MOSI setup time. So why when I set these two timings equal, I don't see any SCLK pulse?