LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Per cycle tristate capability of NI USB 6343 Card for I2C protocol

Hello,

 

I have to read temperature from an IC which communicates using I2C protocol. After reading couple of forum discussions I realize that in order to implement I2C protocol one should have  a board with:

 

1) hardware timed digital IO

2) per cycle tristate capability

 

Since in I2C protocol both master and slave share the SDA (serial data line), both the above conditions must be met. This protocol demands that we should be able to write data to slave at first clock edge and be able to read data from slave on the very next clock edge. Is it possible to do with NI USB 6343? I mean can we transfer control of SDA from master to slave and vice virsa in one clock cycle? (which I believe is necessary condition for per cycle tristating)

 

 From specifications of NI USB 6343 card I know 32 DIOs are harware timed. But I dont know if the IOs support per cycle tristating. 

 

Here is the discussion I read which informs that  although  the card is not ideal for this communication, we still can send and receive data using this protocol http://forums.ni.com/t5/Digital-I-O/I2C-Emulation-with-DIO/td-p/2783186.

 

Can anyone answers to these question:

 

 

Can we use NI USB 6343 card for I2C communication?

Does NI USB 6343 cards support tristate functionality?

Can I use the code wirtten on this link by NI guys for 6343 card? http://www.ni.com/example/31080/en/

 

Thank you

 

0 Kudos
Message 1 of 4
(2,701 Views)

Hello,

 

I try to answer your questions:

 

Can we use NI USB 6343 card for I2C communication?

-> Maybe, but I would not recommend it, because the 6343 is a data acquisition device and no I²C bus interface.

 

Does NI USB 6343 cards support tristate functionality?

-> Tristate is available with the 6343

 

NI USB-6343 Supported Properties
http://zone.ni.com/reference/en-XX/help/370471W-01/cdaqmxsupp/usb-6343/

 

Can I use the code wirtten on this link by NI guys for 6343 card?

-> I don't think so. The example is for High Speed Digital IO hardware (65xx). This class of devices supports other properties tha a USB-6343 which is a so called multifunction data acquisition device.

 

I have never tried to communicate with a I²C device with a multifunction data acquisition device. Like I mentioned bevor, it is may possible to communicate with an I²C, but the USB-6343 is not the right device for your application. Even if it is may possible to create a simple  I²C communication, it would be not possible to switch the tristate mode in one clock cycle deterministically.

 

If you want to communicate with an I²C device, i would recommend the following hardware which makes live easier:

 

NI USB-8452 - National Instruments
http://sine.ni.com/nips/cds/view/p/lang/en/nid/210256

 

Regards, Stephan

0 Kudos
Message 2 of 4
(2,653 Views)

Hi Stephen,

 

Thanks for your reply. 

 

I must use the same card and my I2C communication is pretty simple. I just need to read two registers from my slave chip (temperature sensor IC) and the address register in slave is pointing directly to the temperaure register (the register which holds the temperaure value). After reading the MSB temperaure register the address pointer increments automatically and points to LSB temperature register.

 

In I2C portocol, clock is always controlled by master but data line has to be shared between master and slave. I do realize that the code written by NI guy is for 65xx devices. And i dont think that i can use even a part of that code or amend that code for 6343. Please correct me if I am worng.

 

So I must start I2C communication by sending a 1 byte read command to slave, receive ACK, then receieve data, and then send NACK. Could you give me a pointer how would you start writing code for such protocol for 6343. Is that OK to use a bit pattern generator to produce 1 byte read command and then keep listening to that line. I know i will have to do it in two steps. First I shall send read command and then terminate the communication. Then I will configure the same pin for acquisition and read data on that pin. Don't you think that I will loose the data being sent by slave during switching my IO pin from generation mode to acquisition mode???? Otherwise can I specify the same pin for acquisition/generation mode at the same time?????  

0 Kudos
Message 3 of 4
(2,638 Views)

I don't think that you can reuse the code from the I2C Digital Waveform Reference Library because your hardware don't offer the same abilities like the 65xx cards.

 

The 6343 is a data acquistion device and not a device for digital communication. You can acquire or measure data on a digital line with this device, but it is not possible to switch on-the-fly between both modes. You will lose data between the reconfiguration of the digital IO pin, because it takes some 10ms.

It is also not possible to configurate a digital pin to be use as an input AND output at the same time.

0 Kudos
Message 4 of 4
(2,632 Views)