LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I2C implementation in FPGA on SOM devkit

Solved!
Go to solution

Dear All,

 

I have this sbRIO 9651 SOM with reference carrier board with which I would like to connect a MPU 6050 sensor in Pmod 5 and acquire sensor data in a FPGA VI and process the data in a RT VI. I'm finding it difficult to implement I2C interfacing in FPGA as I am relatively new to FPGA programming in LabVIEW. The imlementation in myRIO was fairly easy as the API and example for using it was readily available. Any help would be appreciable.

 

Regards

Gokul

0 Kudos
Message 1 of 4
(4,147 Views)

Dear Gokul,

 

there are quite a few examples for using I2C with NI RIO devices available.

 

This example from the community seems to be quite comprehensive, but it is made for a PC with RIO hardware:

 

Community: I2C Implementation in LabVIEW FPGA - National Instruments
https://decibel.ni.com/content/docs/DOC-1151

 

While this is a very simple example for sbRIO:

 

[example] small FPGA I2C Implementation for sbRIO and other RIO devices - Discussion Forums - National Instruments
http://forums.ni.com/t5/LabVIEW/example-small-FPGA-I2C-Implementation-for-sbRIO-and-other-RIO/m-p/31...

 

 

Last but not least you can look at the implementation for myRIO and try to adapt it. If you create a myRIO Custom FPGA Project you can have a look at the default FPGA VI which includes I2C code.

 

Best regards,

Alex

Applications Engineering Intern, NI Germany
Certified LabVIEW Developer
0 Kudos
Message 2 of 4
(4,106 Views)

Hi Alex,

 

Thanks for the links and suggestions

 

Based on a cursory look into the stuff, I can see that digital IO lines represent SCL and SDA.

But in the SOM socket, there are other IO resources like In, out, enable which I am not sure how to make use of

 

0 Kudos
Message 3 of 4
(4,092 Views)
Solution
Accepted by topic author GoKu25

Hi,

 

I found this documentation to be quite helpful:

https://decibel.ni.com/content/docs/DOC-41410

 

It also describes the meaning of in, out and enable. SCL is the serial clock, SDA is serial data. In and out are for reading and writing data, enable switches between the pin being an input or an output. This explains the wiring in this forum post: https://decibel.ni.com/content/message/127591#127591

 

The I2C bus is high when idle, so out is set to false (low) but this has no effect since enable is set to false. In order to drive the bus low, enable is set to true. Now out has an effect and drives the bus low. So low on the bus corresponds to writing true to enable while out is held low.

 

I hope this helps you.

Alex

Applications Engineering Intern, NI Germany
Certified LabVIEW Developer
0 Kudos
Message 4 of 4
(4,062 Views)