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.


  • Similar Content

    • By Ricardo de Abreu
      Hi guys. This semester I'm starting a course system development for control and automation engineering, witch will be based on LabView. Therefore, my University doesn't have a NI hardware, even a MyRIO for us to test our VI and the teacher said that we should test our projects with our own Arduino...
      So, I have a little experience in Arduino and I know the basics for LabView. Now I'm in a point that I know that with Arduino I'll not take the best from LabView. I cannot even deploy a code to it.
      So, there is where my question comes in...
      I'm looking for a new board better then Arduino to use in the classes. I would buy a MyRIO card if I had the money but in Brazil this board is too expensive for me
       Witch one should I get that is closest to myRIO and less expensive than that? I would like to try de deployment of a VI and FPGA..... Is this possible?
      Thanks a lot for the help!
      Regards
    • By Benoit
      View File MCP2221A library
      There it is.
      The complete library for the MCP2221A. I2c adapter, I/O in a single IC. I love that one.
      Let me know if any bug is found.
      I try to make that library as much convenient as possible to use. Two version available 32 bit and 64 bit. little note: to open by serial number, the enumeration need to be activated on the device first. (open by index, enable the enumeration) It needs to be done only once in the life time of the device.
      PLEASE do not take ownership of this work since it is not yours. You have it for free, but the credit is still mine... I spent many hours of my life to make it works.
      Submitter Benoit Submitted 05/29/2018 Category *Uncertified* LabVIEW Version 2017 License Type BSD (Most common)  
    • By Benoit
      There it is.
      The complete library for the MCP2221A. I2c adapter, I/O in a single IC. I love that one.
      Let me know if any bug is found.
      I try to make that library as much convenient as possible to use. Two version available 32 bit and 64 bit. little note: to open by serial number, the enumeration need to be activated on the device first. (open by index, enable the enumeration) It needs to be done only once in the life time of the device.
      PLEASE do not take ownership of this work since it is not yours. You have it for free, but the credit is still mine... I spent many hours of my life to make it works.
    • By grjgrj
      Hello. I need change some code for SbRIO-9626 with LabVIEW 2018. I have code from LabVIEW 2015. Right now I have only LabVIEW 2018. And I worked with it for SbRIO-9627.
      LabVIEW FPGA, LabVIEW Real-Time, NICRIO1800 driver istalled.
      And I install Xilinx ISE 11.5 Compilation Tool too. 
      When I start compilation FPGA VI I got error about problem with compilation too (see attachment picture).
      Could you tell me how I can solve this problem? 
      It is very important. 

    • By venustas08
      I have a question.... The MPSSE I2C driver works great. But it does not have a Write-Read dll in it.
      Calling the WriteDevice and Read Device separately in LabVIEW is generating considerable delay ( ~1ms windows scheduler + labview ).
      is there a combined DLL for Write-Read.
      currently I am able to reach only about 400 samples per second with my ADC. I want to be able to use upto 10ksps.
      Is there any other way to reduce this delay ? 
      Thanks for the help.
       
       





×
×
  • Create New...

Important Information

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