07-25-2013 11:39 AM
Hello Priyatham,
Here is some basic code that will do what you need, if your data is perfect.
Again if your input array is not a multiple of 8 this will either truncate the last bits or create a corrupted last byte.
Regards,
Dan King
10-23-2013 06:00 AM
how to use it when my HS-DIO card (6535) should work as a slave on SPI? Then only MISO should be as an output. Should I use SS as an trigger for 'Dig out task'?
11-06-2013 11:56 AM
Hello,
Does anyone have an example of a basic SPI Read waveform using SDW toolkit in half duplex?
Thanks!
R
02-25-2014 12:46 AM
Hi I need to make the above digital waveforms for SPI communication but all lines are connected to DAQ PFI lines. I am using PXIe 6259 and they are connected to p2.0 to P2.3.
Now I have few questions:
1.Can I use PFI lines to read back DOUT?
2. I made the exact waveforms in LV (dt = 0.001 s).but I don't know what I need to do next? Do I need to write these waveforms to DAQ lines and synchronously monitor DOUT to read data? Is there any example to show how can I do this synchronous write/read for SPI comminication?
3. can I use the reference lib?
02-25-2014 07:13 AM
Hello Tintin,
First of all, you are going to have to change which lines you are connected to; M-Series DAQ cards can only perform hardware-timed DIO operations on Port 0.
If you are trying to perform SPI communication on your DAQ card the first thing I would check out is this whitepaper:
http://www.ni.com/example/31200/en/
It includes information on a reference design that helps you build your waveforms and links to reference applications for HSDIO and DAQ devices. This is going to be your best resource.
Regards,
Dan King
02-25-2014 09:55 AM
Hi Dan
Thanks for your help. It was very useful.
Could you pelase let em know if I can use the following sequence for 6259?
My other question is , as you mentieond I shoudl use port0 lines but do I need to output SCLK (clock ) as well or if I use internal clock then I don't need to output SCLK?
02-25-2014 11:45 AM
Hello Tintin,
In the whitepaper it is assumed that you are creating the sample clock as part of your waveform, so it is generated along with SDO and !CS.
As for clocking, right below where you got that pic is this one:
which shows the simplest way of using one of your onboard counters as a oversample clock for you SPI generation. So, if you want SPI traffic at 100 kHz you would set up your counter to generate at 200 kHz and then set up your DIO sample clock to be that counter's internal output.
So the physical channel of the counter would be something like PXI1Slot2/ctr0 and your clock source would be something like PXI1Slot2/Ctr0InternalOutput (Which you would have to right click on the clock source constant/control and choose I/O Name Filtering>Include Advanced Terminals to find).
Regards,
Dan King
02-25-2014 01:41 PM
Dan . unfortuantely I can't use the port0 lines because it needs major changes on the board.Is it possible to manually for loop the data to send it bit by bit and then also read back DOUT bit by bit.
so as you can see first I generate the waveform and then 1 write 1 row of boolean values to SCLK,MOSI and CS and then monitor DOUT.
I also see
100 ns min SCLK high pulse width
100 ns min SCLK low pulse width in the product manual for clock. If I want to send it in this way then is there any way to control timing?
02-26-2014 10:03 AM
Hello Tintin,
You cannot hardware-time any lines on a M-Series multifunctionDAQ board outside of Port 0. At this point your best bet (outside of a board redesign, which I know would suck) would be to software time the lines or make an inline adapter board.
Neither of these is an ideal option.
For software timing, the minimum times you mentioned probably wouldn't be too much of an issue. But it's going to depend on your device on how long an output data bit is going to stay high after a clock transistion. It MAY stay high long enough for you to read a static DIO line, but there is no guarunteee. The code difference is that you wouldn't be using any clock or writing multiple samples to the DAQ card, instead you would sequence writes and reads in a loop so that you are executing in the correct pattern.
The problem with this is that if you are using windows you can't really expect better than 10 ms of timing accuracy (in my experience), and if you let it run full out you are going to see variable performance based on Windows background processes. With this restriction you would be better off using LabVIEW Real-Time if you have it available.
It's definitely something to try, and it's better than the next option.
For the translation board, I'm talking about an inline PCB that direct connects most lines, but switches the problem ones over to Port 0. I understand that this takes extra time and money and that the software-timing option is a better bet, but I just wanted to bring it up in case software timing didn't cut it.
Regards,
Dan King
09-18-2014 09:29 AM
Hello,
I would like to read a 3-axis digital accelerometer (STMicroelectronics LIS3LV02DL) using the SPI protocol. I'm wondering if it is possible to use the SPI Digital Waveform Library on my NI9403 together with the NI cDAQ-9178. I've read here http://zone.ni.com/reference/en-XX/help/370466V-01/mxdevconsid/digiocseries/ that for this combination of devices <<You can only do hardware timing in one direction at a time on a serial bidirectional module>>. What does it mean? How should I take into consideration this issue on the labview program?
Thank you so much.
Kind Regards.
Giovanni