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.
Solved! Go to Solution.
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
While this is a very simple example for sbRIO:
[example] small FPGA I2C Implementation for sbRIO and other RIO devices - Discussion Forums - National Instruments
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.
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
I found this documentation to be quite helpful:
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.