Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

SPI with USB 6215

Hi all,

 

I will be attempting to use my USB 6215 with one of the inputs being a tri axial accelerometer which is using a serial output (SPI compatible) as its output.

 

Can these boards accept this as input? Couldn't find much directly relating to SPI in the data sheets.

 

I haven't got the sensor yet - but need to know if I should buy it now or if I buy it now will I even be able to test it with this DAQ.

 

I am using matlab as the acquisition software.

 

Thanks,

Mitch.

0 Kudos
Message 1 of 5
(4,325 Views)

Mitch,

 

The USB-6215 only has software-timed DIO lines. I'm assuming your accelerometer is using a date rate above 1k for the SPI transmission, so you will probably need another device. There have been a number of white papers written regarding SPI and the NI Hardware.

 

Serial Protocol Communication Reference Design for Digital Waveform Devices

http://www.ni.com/example/31200/en/

 

If all you need to do is have a device to receive your SPI sensor you could look at something like the NI USB-8451 which gives you SPI capabilities. Make sure to check your specs of your sensor to verify it's compatible with the device though.

 

If you do want to use a DAQmx device to send or receive SPI commands that's a longer conversation, just let me know if that's the path you want to go down.

Aaron W.
National Instruments
CLA, CTA and CPI
0 Kudos
Message 2 of 5
(4,309 Views)

Thanks for the reply!

 

Hmm what a pain. By 1k do you bits per second or hz? 

 

The project is in development stage which is why we are using the NIDAQ. In the future someones will be making a custom PIC to do all the data acquisition and send it straight to the computer for processing.

 

However we have a low spec accelerometer on there at the moment so I really want to test with a higher spec (and digital output is preferred for the future electronics).

 

Would you recommend giving it a crack? At the moment we are recording accelerometer data at around 100hz.

 

And when you say software timed dio, that would just involve me writing code to create the master and slave lines, plus the clock, right? or am I over looking something.

 

Sorry for all the questions and once again thank you for the reply!!!

0 Kudos
Message 3 of 5
(4,300 Views)

Mitch,

 

Well, I was guessing your trying to get the USB 6215 to be the SPI Master you are going to have to be providing a SCLK (Serial Clock) to your device. Even if you want it to be the slave, you would still have to be able to receive and run off a provided clock, which the 6215 can't do for it's DIO lines. Depending on what your required SCLK rate is for your accelerometer then that will determine what hardware you need. I would imagine that your required clock rate is higher than what you can perform with software DIO. Typical clock rates are between 10kHz and 100MHz. This is faster than you will be able to generate reliably and accurately with a software timed device.

 

I think you are spinning your wheels on trying to get the 6215 to communicate with an SPI device, but again I don't know the exact sensor you are using. Even though you are only recording accelerometer data at 100Hz, that doesn't have any impact on your SCLK for your SPI communication. Keep in mind that for every accelerometer data point you get back there will be a number of bits that needed to be transported back and forth between the master and slave.

 

When I say software timed, I mean that you either call a function in software to read or write from a line. This command gets sent to the hardware and the hardware takes a sample, does the AD/DA conversion and returns that data to software. It's slower because it relies on software to control the hardware. Typically I avoid software timed applications for anything over 1kHz.

 

Hardware timed is different because it uses an onboard clock (oscillator) on the hardware. The software configures the sample rate, number of samples to acquire and when to start the acquisition. The configuration is then sent to the hardware and the hardware can sample the channel without further interaction from the software. Once a number of points are sampled then the hardware returns those samples back to the software.

 

Typically with SPI you do have a SCLK (Serial Clock) and then a MOSI (Master Out, Serial In) and a MISO (Master In, Serial Out). Wikipedia has a good overview of the SPI protocol.

 

Honestly, if all you need to do is communicate with your SPI device and you don't care about any of the other functionality of a DAQ card I would recommend looking at the USB-8451 that I mentioned. It's relatively low cost, lower cost than what it would take to purchase a DAQ card with hardware timed capabilities. Now, if you have other DAQ cards around you might be able to perform it with those. Generally performing SPI on DAQ cards is a more difficult task than the USB-8451. There are some reference libraries from NI that can help, but again I would recommend the USB-8451 if you have to buy something.

Aaron W.
National Instruments
CLA, CTA and CPI
0 Kudos
Message 4 of 5
(4,292 Views)

Hi again Aaron,

 

First of all, thank you for your reply and your awesome knowledge.

 

After looking through what feels like a million different ideas on ways to set up our DAQ we have sort of gone full circle.

 

In the beginning we were using sensors with analog outputs and we had the usb 6215 laying around which is why we used it. But after the sensor spec not being up to scratch we have purchased new sensors which are all digital. This makes life easy and we have now decided to drop the NI DAQ all together and just use a micro controller to sample constantly and another board to interface with a PC. Possibly even combining the two into one board.

 

Thanks again for the help it is really apprecaited!

0 Kudos
Message 5 of 5
(4,279 Views)