Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Implementing an I2C slave on the HSDIO PXI-6551

Hello,

 

I'm trying to develop an I2C slave using the PXI-6551.  Ideally, it should employ handshaking, but for starters we can attempt a unilateral slave. 

 

Is it possible to write a state machine for the 6551 which is hardware timed (i.e no software, polling etc.)?  Can scripts achieve this?

 

Thanks for any suggestions and tips.

 

Anand

0 Kudos
Message 1 of 7
(5,062 Views)

Hey,

 

Check out the following knowledgebase article and developer zone:

 

http://digital.ni.com/public.nsf/allkb/7A82E998C9225188862575BE0011C369?OpenDocument

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

Doug Farrell
Solutions Marketing - Automotive
National Instruments

National Instruments Automotive Solutions
0 Kudos
Message 2 of 7
(5,038 Views)

Hi Doug,

 

Those links pertain to an I2C *master*.  I have already implemented this.  The links also recommend using an FPGA for an I2C slave implementation.  I was wondering if there was any way to do this using the 6551 (without FPGA).  

 

Anand

0 Kudos
Message 3 of 7
(5,026 Views)

I apologize, I must have misread that part.  This is going to be a bit more difficult to implement than the master because of the ack bit that the slave must send back.  To be able to properly do this you will need FPGA to be able to analyze on the fly and respond with the ack bit appropriately. 

 

However, you may be able to cheat around this but only if you know how many bits to expect the slave to receive.  If that is the case you can run a simultaneous generation and acquisition while tri stating the generation, then after a prespecified number of bits respond with your ack bit.  There is the issue however that if your number of bits sent is not the expected number everything will get very very broken.  This is why the FPGA is recommended to properly implement the protocol, so that the proper ACK bit can be set at the correct time.

Doug Farrell
Solutions Marketing - Automotive
National Instruments

National Instruments Automotive Solutions
0 Kudos
Message 4 of 7
(5,002 Views)

Hi Doug,

 

We are in sync here.  I was planning on implementing a proxy slave in the HSDIO (no handshaking).  The trick is an electronic detection via a D flip-flop of the start condition, using it as a trigger to one of the PFI terminals and streaming out the 'slave' response.

 

However, I thought that with scripts it might just be possible to implement a state machine.  It might be beyond the HSDIO's capabilities still ...

 

Anand

0 Kudos
Message 5 of 7
(4,995 Views)

Scripting could be an option, but I think you are still going to have an issue with when to send the ACK bit.  I am imagining you would have a waveform loaded up of the slave response and then use a trigger to output this waveform in the script.  The issue that I still see here is how the HSDIO would know what the trigger was.

 

In more detail, how would you know that the trigger was the end of the master command and not in the middle of it somewhere.  I think being able to specify this trigger would the be the hard part, but if you could somehow get a way to do that you're good to go.  I think at that point you are no longer in I2C anymore but kind of your own protocol that resembles I2C.

 

I think FPGA is going to be your best bit so you can properly analyze the Master data and send the appropriate slave response in real time.

Message Edited by Doug L. Bear on 10-16-2009 11:29 AM
Doug Farrell
Solutions Marketing - Automotive
National Instruments

National Instruments Automotive Solutions
0 Kudos
Message 6 of 7
(4,983 Views)

Hi Doug,

 

The start condition triggers the slave (HSDIO).  Start condition in I2C is when the data goes high to low when the clock is high.  The I2C SDA line is connected to the D Flip-flop's clock input while the I2C SCL line connects to the D Flip flop's 'D" terminal.  Only a start condition would set the output.

 

Yes, the protocol would be somewhat modified I2C.

 

Anand

0 Kudos
Message 7 of 7
(4,969 Views)