Jump to content
Goku25

I2C implementation and DMA FIFO in sbRIO

Recommended Posts

Hi Folks,

 

The scenario is, I have a sbRIO 9651 and a MPU 6050 (A IMU sensor). I would like to acquire sensor data in FPGA VI, stream it to RT VI for processing and analysis and view it from windows based VI. I came across certain problems which I wasn't able to figure out. I dont have the appropriate cable to interface the sensor yet, which I have ordered, to test the VI.

 

1. FPGA VI:  The I2C Master VI outputs a array of 14 bytes raw data (6 bytes for Accelerometer, 6 bytes for gyroscope and 2 bytes for temperature). since the data can only be written element by element in a DMA FIFO, how can I stream an array to RT VI. I did an auto-indexed for loop to write data but I dont know if this will work.

 

2. RT VI: Initialization of MPU6050 is done here. It involves writing a byte array sequence to I2C Master VI to configure it and then a write-read(writing a register to read data from) process to acquire data. I am not sure how to do the write- read part. I was able to do it in myRIO RT Vi as it had clear APIs

 

3.  The single process shared variable 'RT Stop' used for communication between loops in RT VI is written a value after the loop ends which I dont know as to why. The architecture is based on the Turbine example from cRIO developers guide.

 

I am attaching the VIs for your reference. Please have a look into the code and let me know if you find anything that needs correction. I am totally new to Real time and FPGA programming.

 

Thanks a ton

Gokul

first1.lvproj

 

 

myrio.png

RT VI.vi

FPGA acq.vi

first1.lvproj

Edited by Goku25
Added older version of the VIs

Share this post


Link to post
Share on other sites

I don't think your for loop will work because it's in a SCTL and it has the FIFO in there. You have to give up one of those. That is, put the for loop in a normal loop (pass data between the loops using a local) or remove the for loop and keep an index on a shift register in your SCTL. Also, your select function does nothing, you can just delete it and wire the boolean through.

I'm not sure how that API implements write-read. I think you just need to enter your byte array sequence that specifies the register in the write array and set the read Boolean to false. If you have trouble, maybe ask the authors of the API.

The shared variable is written so if the loop exits because of an error, the other loops are notified and stop.

FYI, there's an specific forum for embedded questions you can use.

 

Share this post


Link to post
Share on other sites

Have a look at the SPI examples on ni.com for the FlexRIOs. Some examples are overly simple and there's a couple well written ones using IPs which would work equally well for you.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.