LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I2C Library Timing Problem

I'm trying to create a module using the I2C Digital Waveform Reference Library:  http://zone.ni.com/devzone/cda/epd/p/id/6080

 

The trouble I'm running into is programming the timing into the Init VI.  The timings I define in the input cluster from a particular IC's datasheet don't seem to hold; the coerced timings cluster shows all 0 for each timing value.  Has anyone gotten this to work?

0 Kudos
Message 1 of 5
(3,129 Views)

Hey Jeanius,

 

what timing parameters do you provide to the Init VI ? What timing constraints are you trying to make? Are you using a 655x device? 

 

Also, I encourage you to post your question on this forum specifically created for questions about the IDW library. It seems like there has already been some discussion about timing in that thread. Don't forget to include the answers to the above questions when you post. Good luck!

 

Misha
0 Kudos
Message 2 of 5
(3,107 Views)
Thank you for your reply, I did end up getting timing values that worked (pulled from the example included in the package).  I am encountering another problem though, which probably arises from my inexperience in dealing with digital waveforms and data:  I'm planning on using a PCI-6224 for this project, which doesn't seem capable of performing to this package's liking.  So I proposed to convert the digital 'Z' states of the waveform generated from the IDW library to '1' states, split the SCL and SDA lines and regroup into a 1D Dig Wfm Array, and route that into one DAQmx write block with the designated clock and data channels.  Problem is, I don't have enough knowledge of the digital LV realm to accomplish this.  Any advice?
0 Kudos
Message 3 of 5
(3,103 Views)

Jeanius,

 

Again, please post your question in the thread created for IDW issues mentioned above - that is your best bet on getting the quickest and most comprehensive answer. 

Misha
0 Kudos
Message 4 of 5
(3,087 Views)

Hi Jeanius -

 

1: You're right about the 6224: it can't tri-state its buffers in a single period of the sample clock, so it can't be used with the IDW in its native form. Changing the 'Z' states to '1' in the IDW waveform will make the waveform compatible with DAQmx devices, but remember that I2C is an open-drain bus and isn't designed for active-drive outputs. If you attempt to receive data from your slave device, you won't be able to see the message returned by the slave because your 6224 will be driving a '1' onto the bus instead of a Z. Likewise, you won't be able to address multiple slaves or listen for ACK/NACK conditions returned by the slaves. You'll essentially be "blind" as the bus master.

 

2: Replacing the 'Z' bits in the IDW waveform after it's been generated is a slow and inefficient process. It's better to directly modify your copy of the IDW library instead, so it creates waveforms with '1" as the high state. Given the caveat I mentioned above, here's how to do it: Open each of the following VIs on your IDW palette and replace every instance of the constant 'Z' that you see with a '1'. (You can just click on the Digital Values Ring constant and select 1 from the menu.)

 

- Add Start Condition.vi

- Add Addr Byte.vi

- Add Clocked Bit.vi

- Add Stop Condition.vi

- Interpret Data.vi

 

Here's an example from Interpret Data.vi:

 

change_z_to_1.PNG

 

 

I should also mention that I would have responded sooner to your question, but I don't actively monitor posts on this topic outside the IDW, SDW, and JDW forums. If you have any more questions about using the IDW, post in the forum that Misha linked above and I'll get a notification of your post. This guarantees you a timely reponse from me or someone else who knows the topic.

Message Edited by David S. on 07-20-2009 10:01 AM
David Staab, CLA
Staff Systems Engineer
National Instruments
0 Kudos
Message 5 of 5
(3,045 Views)