Academic Hardware Products (myDAQ, myRIO)

Showing results for 
Search instead for 
Did you mean: 

MPU-9250 myRIO

I am really confused with this project. I have D/L the code and wired it accordingly:


VDD -- > Pin 33

GND --> PIN 30

SCL -- > PIN 21

SDA -- > PIN 25

SDO --> PIN 23

CS -- > PIN 13


I have little experience with MyRIO and LabVIEW so I may be in over my head but I have reviewed the code and it appears that I am not reading any values through the SPI ports. I noticed that the code calls for the DIO pin on channel B but the SPI terminals are set for channel A. Is the normal, or something I was supposed to configure?


Message 11 of 30

Hi ZachTay25,


It looks like you have the setup wired correctly. I do not think that the differences in channels is going to cause any problems or need to be reconfigured. Could you describe a little more about what exactly happens when you run the example? Are you running into any specific errors when you run the code?

Nolan H.
Applications Engineer
National Instruments
0 Kudos
Message 12 of 30



So if I hook up my IMU to channel A, but the digital outputs point to channel B and the SPI is configured to channel A, that is ok? Kind of contradicts the tutorials on NI's site. 


I am not receiving any errors when I run the code. However the plots on the front panel of the main IV stay flatlined. I was told to try and hook up a digital analyzer to determine if something is wrong with the SPI communication. I am not familiar with this process but I'm coming up to speed. I would figure if there was a timing error in the code, then other on the forum would have mentioned but it seems other have had success. 


Thanks for responding,


0 Kudos
Message 13 of 30

That should be fine. The digital output just needs to be low at the start of the data transmission and high at the end. Does your wire going to nCS pin on the MPU go to the same pin that is called in the code (pin 13 of channel B)? As long as the wiring matches what is called in the code, there should not be a problem there.

Nolan H.
Applications Engineer
National Instruments
0 Kudos
Message 14 of 30

I have solved the problem. The Sparkfun breakout board comes with the ADO/SDO soldered to gound. So you have to desolder this SJ2 jumper and solder it to the left side in order to use SPI. For further explanation read this page:


Message 15 of 30

I find that no matter what I write to the registers, I am receiving the same set of data starting from Acceleration, Temperature, Gyro and Compass. 


in Read_data sub VI (see zero.JPG):

for example, I am sending zeros except the first byte (BB, if I send this as zero, I do not receive any data), I am still receiving the output in the above order. May I know why this happens?

And also what is the importance of 6401 bits?


in Initialize_loop sub VI (see init.JPG):

why do you have to send FFFF in the first 6 instances? and is there a specific order that I have to send the rest of the bytes?






Download All
0 Kudos
Message 16 of 30

Hi kumarasova,


Are you using the MPU-9250 IMU? If you are, please look at the MPU-9250-Register-Map for a list of corresponding hex values. 

Please create a new post with your questions as this post will not generate as many views.



Applications Engineer

National Instruments 

0 Kudos
Message 17 of 30

Hey Josh,


I am using MPU9250 IMU sparkfun breakout board. I am already using the register map document you are pointing me to. 

I will create a new post as you mentioned.

0 Kudos
Message 18 of 30

Hi IllinoisControls,


I adapted your code to run a on a raspberry + LINX together with MPU9250, but only the magnetometer part is not working.


Found on the web that to initialize the mag I need to send 0x02 to the 0x37 register (inside the 0x68 address). Do you know how can I do this?


I attached my code.



Thanks in advance. 

0 Kudos
Message 19 of 30



If you want to reach IllinoisControls, you might send a direct message to them since this a fairly old forum post.


As far as your question goes, I think that this is something specific to the LINX protocol. You might want to try the LINX forums on Makerhub. People who use LINX are going to be more likely to be active on that forum, and they might have more insight on how to do something in LINX specifically.

Bill B.
National Instruments
Message 20 of 30