Components

cancel
Showing results for 
Search instead for 
Did you mean: 

[Deprecated] SPI Digital Waveform Library

Will the SPI Library work with LV2009?

How do I install it?

Thanks

0 Kudos
Message 61 of 200
(8,946 Views)
Nevermind...
0 Kudos
Message 62 of 200
(8,944 Views)

Thanks David! The way the Sub VIs are written, it was easy enough to modify the code.

 

Regards,

Su Gin

0 Kudos
Message 63 of 200
(8,937 Views)

SPI Emulation with Hardware Timing (& Repetitive Bizarre Behavior of the "Tick Count" VI):

 

To DJL,

 

Thank you for the prompt info on SPI Emulation.  Sorry about the month delay in thanking you.

 

1.  I have the software items that you were suggesting to me (some things were mentioned in my original post).

2.  I referred to USB but I gather that there is no direct USB bus connection to HSDIO devices.  So I've now changed to DAQmx and a USB-6221.  The 1 MHz limit on the hardware digital clock speed will do an adequate emulation of a 250 KHz SPI SCLK (it looks fine on a SPI 'waveform generator' VI).

3.  Again, does anyone have a complete example of continuous, hardware timed SPI emulation?  I have found many pieces.

 

4.  I find that the 'Tick Count' VI fails every 41 or 42 ms:  it properly reports the changing time in milliseconds and then fails by repeating the same 'time' (number) for a second millisecond.  The spacing between errors is 42 ms (twice) and then 41 ms (once), and then back to 42 ms (twice), etc.  This is also visible on an oscilloscope watching a USB-8451 Chip Select (SPI) line using my own 'Tick Count' based timer, and appears to occur using the LV "Timed Loop".  I wrote a VI (attached, LV vers 8.0), independent of the USB bus to expose this behavior, which reveals the same problem on two computers, one using LV 8.0 and one using LV 5.1.  (Also attached is a JPEG screen shot of the VI results.)  I've stumbled into something:  does anyone know what?  (Also, fixing the "Tick Count" VI would significantly help the signal processing on my gyro data which is presently software timed with a USB-8451.)

 

Guyanalog

Download All
0 Kudos
Message 64 of 200
(8,918 Views)

Hi Guyanalog -

 

No complete example exists, because the proper implementation of a full application varies with that application. You would write a different kind of program to poll a sensor and display its information to a user than you would to precondition a SPI-based UUT for a functional test. The example code attached to Serial Protocol Communication... explains how to build and configure the core components of any generic SPI application.

 

Regarding (4) in your post, I think you'll find it more effecitve to ask about the Tick Count function's performance in a new thread on the general LabVIEW forum. This thread is dedicated to discussing the SDW library and its applications. I could speculate on what's causing the behavior you see in ClockCheckerRog1.vi, but the real experts on core LV functions are monitoring the other forum.

David Staab, CLA
Staff Systems Engineer
National Instruments
0 Kudos
Message 65 of 200
(8,904 Views)

Hi,

I am using SPI waveform library to send to output a 21bits but the SPI waveform only show 16bits. What is the problem and how to solve it?

Thankyou.

 

 

0 Kudos
Message 66 of 200
(8,389 Views)

Hi Winterlover - 

 

I created the high-level functions to use common register sizes (which also conveniently fit the standard LV datatypes). You'll have to use the low-level functions (in the bottom row of the palette) to build similar high-level functions for a 21-bit register. It should be straightforward to create a copy of each high-level VI and change the modify it.

 

A tip: since there is no 21-bit datatype, I recommend storing your values in a [U32] and masking out the 21 significant bits to be passed.

David Staab, CLA
Staff Systems Engineer
National Instruments
0 Kudos
Message 67 of 200
(8,385 Views)
What about providing a description of the timing parameters (MOSI Setup, SCLK Freq, SCLK Hold, CS Lead, CS Trail and CS Idle) to the Library VIs? I have not found such a description and it costs me some little bit time to find them out.
0 Kudos
Message 68 of 200
(8,176 Views)

Hi axebauer -

 

SCLK Freq should be self-explanatory. It provides the operating frequency of the SCLK signal. (This is not the frequency of the DAQ/HSDIO device's sample clock.)

 

"Setup" and "hold" times are common terms for describing when, with respect to its referencing clock edge or sample point, a signal transitions from one value to the next. The setup time is the length of time prior to the next clock edge (or sampling point) that the signal is asserted. The hold time is the length of time after the clock edge it is maintained before asserting the next value.

 

MOSI Setup is thus straightforward. It gives the time between asserting a value on MOSI and the active edge of SCLK. SCLK Hold was named thus because that parameter can refer to either the clock's high time or its low time, depending on the CPOL bit. In general, it's the length of time the SCLK value is held after its assertion.

 

For the CS signal values, the terms "lead", "trail", and "idle" are used in the SPI V3 specification itself. The lead time is how long to wait after asserting CS prior to setting up the first bit.  The trail time is how long to wait after clocking the last bit until deasserting CS. The idle time is how long to wait between transmissions; that is, how long to wait after deasserting CS before it can be asserted again.

Message Edited by David S. on 03-04-2010 03:01 PM
David Staab, CLA
Staff Systems Engineer
National Instruments
0 Kudos
Message 69 of 200
(8,167 Views)
I'm sorry. either because its Midnight on Saturday night or I'm just an idiot, but I can't seem to find the SPI examples that people seem to find so helpful.. I downloaded sdw_1_01_lv86.zip, but I didn't see any .vi files in it...I'm a newbie (obviously) so I'm probably missing something totally obvious. I'm using an evaluation Labview 2009 if that makes a difference.
0 Kudos
Message 70 of 200
(7,913 Views)