Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a I2C Signal with 6221 or 6025 ?

Hello,

 

I need a I2C-Signalto control a Brushless-Controller. Is it possible to create with The PCI 6221 or the PCI 6025 a I2C Signal? and if possible, how does this work? can someone help me to create a VI who creates the I2C signal?

 

thanks (and sorry for my bad english)

 

0 Kudos
Message 1 of 8
(5,188 Views)

Hi,

 

it wont work with that hardware, because the hardware does not support handshaking and that is what you need. 

There exist special VIs for I2C, but they are form the LabVIEW Arm/ Embedded Modul. But they will only work with the matching microcontrollers.

 

Sorry, I couldnt tell you something better.

RMathews

Ramona Lombardo
Applications Engineer, NI Germany
Certified LabVIEW Developer
0 Kudos
Message 2 of 8
(5,148 Views)

Hi steevie -

 

I2C actually doesn't require any handshaking; all actions are clocked by the master device.  However, the protocol places bidirectional I/O on the SDA line so the slave can respond to the master.  This means the master device (your DAQ board) needs to be able to write data and read back on the same line when the slave responds.  Moreover, the master has to use open-drain (or tri-state) output buffers, instead of driving outputs. DAQ devices (like your two cards) don't have support for these functionalities.  However, the 655x (and possibly 6534) do allow you to assign a single pin to both generation and acquisition tasks simultaneously, and they can be configured for tri-state or open-drain output.

 

NI Systems Engineering created a reference library for building I2C communication waveforms with any per-cycle bidirectional device:  I2C Digital Waveform library (IDW) Currently, this only includes the 6551 and 6552 devices through use of the Hardware Compare engine.  The library might be able to be modified to work with the 6534, though it would be a hefty undertaking.  More information on that topic can be found here.

 

Your other option is to use an FPGA-based device like the R-series DAQ devices.  There is code for I2C communication on IPnet that you can use right away.

Message Edited by David S. on 03-27-2009 11:42 AM
David Staab, CLA
Staff Systems Engineer
National Instruments
0 Kudos
Message 3 of 8
(5,130 Views)
Can i use 6229 to use the I2C Waveform library as the card have onboard buffer and different clocks (like PFI ,20MHz Onboard reference clock etc) for generation
0 Kudos
Message 4 of 8
(5,011 Views)

David,

 

Could you provide some more info on the 6221 DIO hardware? Is it a tri-state buffer? If not, what is it? I am trying to use a single line as both a digital output (by using DAQmx digital write) and a true high-impedance buffer (by using DAQmx digital read). After I perform a read I only see 18 K Ohm to ground. After looking through the 6221 manual I notice the leakage current is 250uA which is very high.  Can you shed some light on this issue?

0 Kudos
Message 5 of 8
(4,350 Views)

The 250 uA comes from the 20 kOhm minimum value for the pull-down resistor (page 6 of the specifications).  5 V / 20 kOhm = 250 uA.  It's interesting that you are measuring 18 kOhm, which is technically below the 20 kOhm specification of the pull-down.  Do you have anything else connected to the card when performing this measurement?

 

The 6221 is unsuitable for I2C because the output is active-drive.  To tri-state the line and/or read back the input requires a software call and is thus non-deterministic.  You could technically implement some sort of software-timed I2C using the M Series board as the master, but I think you'd be much better off using appropriate hardware for the task.

 

 

Best Regards,

John Passiak
0 Kudos
Message 6 of 8
(4,343 Views)

John,

 

Thanks for the prompt reply.

 

To answer your question, there is nothing else connected to the card.

 

Would you be able to comment on the Hi-Z impedance for tristate/read back? After performing a DAQmx read I measure 18KOhm to ground and thought it would be much much more for HI-Z. Or perhaps you could let me know what this active-drive topology is, I am unfamiliar with it an a google search wound up short.

0 Kudos
Message 7 of 8
(4,337 Views)

Active-drive just applies for the outputs.  It means when you output a high, the line is connected to 5V.  When you output a low, the line is connected to 0V.  This is in contrast with open collector (AKA open drain) where the line is actively driven low, and floats when a logic high is output.  Different devices support each mode.  Some devices support both.  However, the 6221 is only active-drive.

 

The reason that David mentioned open drain earlier, is that I2C requires bi-directional communication on the same line.  To do this, the line needs to be tri-stated (or in a "logic high" state if it is open drain).  The M Series boards are ill-suited for this because you cannot implement a tri-state in your output buffer.  You need to tri-state the line with a software call on these boards, which doesn't work well for I2C.

 

 

The pull-down resistor is always present.  So, when you tri-state your impedance should be 20k.  18k is pretty close to 20k, but it is technically slightly outside of the specified pull-down resistance.

 

 

Best Regards,

John Passiak
0 Kudos
Message 8 of 8
(4,332 Views)