SPI Digital Waveform Library

Re: SPI Digital Waveform Library

The ZIP file contains a Windows installer. Unzip all contents to a folder, then run the EXE file to install the component. It includes a user.lib API and an example program that gets installed to <lvdir>/examples/SPI Digital Waveform.

Re: SPI Digital Waveform Library

The Serial Protocol Communicationreference design will help you get this component running with your M-series board. To directly answer your question, yes the Oversample Clock input should be provided with the rate of your DAQmx Sample Clock.

Re: SPI Digital Waveform Library

I'm using SPI library with 6552 and it seems working fine for a single device (ADIS 164xx sensor). But I'm having a hard time making it to talk with multiple devices. I am trying to read one device at a time (with CS = 0). Both Devices share SCLK, MISO, MOSI, with independant CS line. I think I know how it should be, but not sure how to implement this with SPI Libraray toolkit. Can someone please tell me how it should be changed to talk with multiple SPI devices? Many thanks.

Re: SPI Digital Waveform Library

It looks like you're trying to command two slaves in sequence. SDW can build a waveform to do this for you, but I think you're trying to manage the details yourself and that's getting things confused.

There are two software components in the application: The SDW VIs that build the digital waveform, and the Serial Protocol reference VIs that configure and command the HSDIO hardware. The recommended approach to communicating with two slaves in sequence is to configure the HSDIO hardware to implement a 5-pin bus (SCLK, MISO, MOSI, CS_1, CS_0), then build an SDW waveform that manages both CS lines at any given time.

To configure the HSDIO hardware, give it the indices of all four output lines (SCLK, MOSI, CS_1, CS_0) and the input line (MISO) on your bus. Don't worry about one of the CS lines not being used at any given time: SDW will manage that by writing '1's to the waveform to hold that line high when its slave isn't being addressed.

To address one slave or the other, change the value of the "Slave address" input on "Swap.vi" with each generated message. To address the slave on line "CS_0", set the value to 0. To address the slave on line "CS_1", set the value to 1. The Serial Protocol VIs will handle mapping that CS line to the appropriate HSDIO pin when the waveform is downloaded to the HSDIO board's memory.

Here's where you can find the "Slave address" control in your program. This is a screenshot of "Format to SPI.vi":

Re: SPI Digital Waveform Library

I must be missing something because I am getting an error, number of signal in waveform doesn't match the number of assigned channels. I assigned CS0, CS1, MISO, MOSI and SCLK (pin 3, 5, 7, 9, 11). I really appreciate your help.

Re: SPI Digital Waveform Library

Referring to the same screenshot as my last reply, take a look at the "Digital Signal Subset" VI at the end: You're only passing a waveform with 3 channels to the "Run Core Device" VI. But you configured 4 channels for output on the HSDIO device. You'll have to write a 4-channel waveform to the device's memory.

Re: SPI Digital Waveform Library

I understand that and tried it (CS0, CS1, MOSI, MISO, SCLK - signals configured to 0, 1, 3, 3, it only supports 0, 1, or Z with 4 channels) but still gives a wrong data. Is [0, 1, 3, 3] correct configuration for the signals? With the single slave, it worked with [0, 2, 3]. Also what should I do with output initial/idle state input of 'Init Core Device.vi'? Should just copy 'not CS Active' string and feed in to output initial/idle state input of 'Init Core Device.vi'? It feeds in 1101 (CS_0, CS_1 active state, MOSI and CPOL). Thanks again!