Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How to communicate using I2C, SPI, UPP and SATA

Can someone give me some examples in LabVIEW regarding how can I communicate using I2C, SPI, UPP and SATA.

0 Kudos
Message 1 of 12
(8,418 Views)

NI has a module on I2C and SPI, so look there or check for the buspirate. Or even FTDI that makes usb to both protocol chips.

 

UPP I don't know

 

sata is used for file-IO or you should use a real digital bus handshaking system.

 

greetings from the Netherlands
0 Kudos
Message 2 of 12
(8,402 Views)

Hi,

 

I have checked that NI has 6551 DIO which we can use for SPI and I2C commn.

But if I want to test following memories using loopback method then what will the process and H/W requirements?

SATA

NOR Flash

DDR

FPGA Flash

 

I don't want to go for cRIO FPGA. Using PXI modules how can we test these?

These devices will be connected via RS232 Port.

 

 

0 Kudos
Message 3 of 12
(8,358 Views)

Hi

the 6551 is a good choice for testing and it has high speed, only for i2c it misses the open collector driver.

testing memory can be done if enough pins are available. testing sata is something I don't know.

Please hire a good labview programmer and hardware specialist when starting with labview.

Easy applications can survive spaghetti coding but it looks you are not just playing.

greetings from the Netherlands
0 Kudos
Message 4 of 12
(8,354 Views)

Millie,

 

I would like to link you to a couple of resources that we have on our webpage that will hopefully give you some good information on the tests you are asking about. I have seen the links below used for DDR and similar memory, however for testing NOR, DDR, FPGA or any memory the key item to look at is the protocol that needs to be sent between the HSDIO device (or any other device) and the memory being tested.

 

It would be helpful if you could provide us the following:

 

1) Clock Rate for the data being sent and received for each of these memory tests.

2) Examples of the communication packet structure that needs to be sent back and forth between the memory and test fixture.

3) Logic levels for the memory we are testing.

4) Interface or connections to the memory. I am guessing this is the SATA that you mentioned.

 

Memory Device Testing:

http://www.ni.com/memory-test/

 

Memory Test Reference Design:

http://zone.ni.com/devzone/cda/tut/p/id/7966

 

These are our best articles when it comes to testing memory and should provide you with some information to determine if the 6551 or 6552 device will work for you application. Now, in the I2C / SPI area we do have a I2C Digital Waveform Reference Library and a SPI Digital Waveform Reference Library that was created by our Systems Engineering group. These libraries do not include the integration of the software with the hardware but are designed to help you generate waveforms that can be downloaded and used by the National Instruments HSDIO devices such as the PXI-6551/2.

 

Serial Protocol Communication Reference Design for Digital Waveform Devices

http://zone.ni.com/devzone/cda/epd/p/id/6200

 

I2C Digital Waveform Reference Library:

http://zone.ni.com/devzone/cda/epd/p/id/6080

 

Serial Protocol Communication Reference Library:

http://zone.ni.com/devzone/cda/epd/p/id/6163

 

Hope this helps.

Aaron W.
National Instruments
CLA, CTA and CPI
Message 5 of 12
(8,278 Views)

Sorry for late reply.

 

Max clock rate is 1 mhz and logic level is 3.3V.

I have two test fixtures.

For one, I am having only RS232 interface.

Using that, I need to test (Loopback: write and read back and then compare) the UART Interface, I2C interface, DDR, NOR Flash, UPP interface, SPI Interface, SATA Interface, FPGA Flash and FPGA_SPI Interface.

How that can be done?

And what PCI hardware will be suitable?

0 Kudos
Message 6 of 12
(8,192 Views)

Millie,

 

I am still a little confused as to what your exact configuration for this test needs to be.

 

For the test fixture with a RS232 interface, are you planning on using the Serial Port on your computer to control the tests or does the connector on the devices you want to test have a RS232 Port that you want to connect to the HSDIO boards?

 

From your earlier posts it appears as though you want to connect the devices to your RS232 Port on your computer, this would then not be using a HSDIO board and instead using the NI-VISA driver on your computer with the built in Serial Port. There are examples in LabVIEW, in the Example Finder (Help >> Find Examples), that will show you how to write to and read from the Serial port on your computer. These examples also show how to set the appropriate baud rate and data bits. There won't be any examples that will completely test all the different protocols that you want though. The examples do a good job of showing you the basics of programming, but from there it is up to you to write a program that will appropriately test the devices.

 

Most instruments that you talk to over the Serial Port have very specific commands when talking with the device. There should be a manual or other documentation for the product you want to test and you can use the LabVIEW examples to learn how to send commands over the RS232 port.

 

As for the HSDIO side of things. The HSDIO boards, while capable of generating / receiving the signals necessary to emulate the RS232 Port, would not be your best use of the hardware. When we use the HSDIO boards to interact with SPI or I2C chips we are connecting the HSDIO inputs or outputs directly to the chips to send or receive signals from that chip. The I2C and SPI toolkits that we referenced in the previous post are to be used with the HSDIO boards and only generate the waveforms necessary to adhere to the different protocols.

 

Overall, I really don't think you will find any program that is already written that will tests the different interfaces for you. However, by looking at the examples for the RS232 Port you can learn how to send and receive the commands over the serial port. If you open the example finder you will see a folder structure in the middle. Select 'Hardware Input and Output >> Serial' and you can find the different examples we have available.

 

 

Aaron W.
National Instruments
CLA, CTA and CPI
0 Kudos
Message 7 of 12
(8,180 Views)

Thanks for the quick response.

That I figured out that for the first test bed which is having only RS232 interface, I will have to use VISA for that.

For the second test bed, i have seperate interfaces for SPI, I2C, etc.

What I found out is that NI HSDIO cards and USB modules provides the facility to implement these protocols.

But, is thier any other way of doing this.

Can we go for M series DAQ cards having DIO to implement the protocols?

actually, I want to go for low cost solution and HSDIO cards are bit costly and I dont want to go for cRIO or USB.

Can you suggest something?

0 Kudos
Message 8 of 12
(8,160 Views)

Millie,

 

For your second test you basically have a couple of options to implement the I2C and SPI protocols. These includes a FPGA device, HSDIO device or the USB-8451. It is possible to use a M-Series or a X-Series Device to do the SPI communication. We have some documentation on this in a couple of different forums I will link below.

 

SPI Digital Waveform Library with M-Series

http://forums.ni.com/t5/Components/SPI-Digital-Waveform-Library/td-p/866346/page/2#M179

 

Serial Communications with DAQmx Devices

http://zone.ni.com/devzone/cda/epd/p/id/6200#h31

 

The last link talks about DAQ devices with Internal Sample clocks and correlated DIO devices. We had released our X-Series Cards (63XX cards) after this document was published but they also have an internal sample clock for the DIO.

 

So, the next questions becomes can I do I2C with multifunction DAQ cards like the M-Series or X-Series. The answer is that we cannot do I2C with these devices because they don't have the ability to dynamically change digital lines from reading and writing that is necessary with I2C. More detail on the links below.

 

I2C with DAQmx Devices:

http://forums.ni.com/t5/Digital-I-O/How-to-create-a-I2C-Signal-with-6221-or-6025/td-p/873989#M10635

 

Using Advanced Features for I2C Protocol:

http://zone.ni.com/devzone/cda/epd/p/id/6200#h41

 

The last link talks about the need for Per-Cycle Tristate to implement the I2C protocol and the only cards that have this functionality are some of the HSDIO devices like the NI 6551, NI 6552, NI 6547 and NI 6548. Other devices would be FPGA or the USB-8451 module.

 

If you are worried about cost the best option would probably be the USB-8451. This will allow you to implement both protocols and would still be in a USB form factor so it wouldn't require you to purchase a PXI Chassis and controller. You do mention that you don't want to use USB, why is this?

Aaron W.
National Instruments
CLA, CTA and CPI
0 Kudos
Message 9 of 12
(8,142 Views)

Thanks Aaron.

The reason I don't want to go with USB is that, I don't find it suitable for industrial environment.

And anyway, I will have to use a PXI chassis coz my number of modules are more than 2.

I think I will go with PXI 7811R, it will help implementing both the protocols and its cheaper than HSDIO cards.

Am I correct?

0 Kudos
Message 10 of 12
(8,123 Views)