From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Academic Hardware Products (myDAQ, myRIO)

cancel
Showing results for 
Search instead for 
Did you mean: 

Error -363011 in I2C Express VI with myRIO-1900 and ArduIMU V3 MPU-6000

Hi,

I'm trying to read some measurements from an accelerometer, using a myRIO-1900 with I2C communication, but when I run the attached VI, I get an error with code -363011. I'm using LabView 2015 (32-bit) on Windows 7.

 

I have a DIYDrones ArduIMU V3 from Sparkfun. The documentation of this board, including Eagle files (schematic and board design) and the datasheet with product specification of InvenSense's MPU-6000 can be downloaded here: https://www.sparkfun.com/products/retired/11055

The Register Map and Descriptions of InvenSense's MPU-6000 can be downloaded here: https://www.invensense.com/wp-content/uploads/2015/02/MPU-6000-Register-Map1.pdf

 

As you can see in the attached image, I connected the board to the myRIO using the pins I2C.SCL and I2C.SDA of MXP connector A. At the same time, I connected the board to a computer using an RS-232 connector and the UART pins of the board.

 

Note that the SCL line is also connected to the pin 17 (SCK) of the microcontroller, which has an unknown program (this board was used some years ago by another student and he made a program for the microcontroller, but now I'm only interested in the accelerometer of the MPU-6000, not in the microcontroller's program) and is also acting as a master to read the measurements from the MPU-6000 with an unknown frequency. However, I believe that this should not be a problem, because the I2C bus is a multi-master, multi-slave serial computer bus.

 

According to this forum thread, it seems that this error occurs because the myRIO doesn't receive the Acknowledge bit from the slave.

 

I have also tried to read the accelerometer's measurements using the UART line and ArduIMU_pack_v14 for LabView, which can be downloaded from here. However, it seems that the readings from the serial port aren't correctly decoded.

 

In addition, I've tried using the I2C Digital Waveform Reference Library, by downloading and installing the file from NI: http://www.ni.com/example/31080/en/

However, all my attempts were unsuccessful. Do you know how I could solve this problem?

 

0 Kudos
Message 1 of 8
(5,893 Views)

After a few weeks trying to solve this problem, I finally found a solution:

 

I tried reading the measurements from the accelerometer of the MPU-6000 using another board (using MikroElektronika's MPU IMU Click instead of Sparkfun's ArduIMU V3) and I got the same error, so I concluded that the problem was with the MPU-6000, not with the board. There were two problems with the IMU and the program in LabView:

 

1. The address of the datasheet was wrong. The datasheet says that the slave address of the MPU-6000 and MPU-6050 is b1101000 if pin AD0 is logic low, and it is b1101001 if pin AD0 is logic high. However, it is just the opposite: the address is b1101000 if AD0 is high, and it is b1101001 if AD0 is low. If we write the address b1101000, the problem is solved by connecting AD0 to high, which seems that it's the proposed solution in this thread (in the board of the person who posted the first message, this pin might be Vi0, but in the MPU-60X0 it's AD0, so this explains why other people who had the same problem didn't find the pin Vi0).

 

2. The registers 1B, 1C and 6B (hexadecimal) had to be properly configured and a few hundred milliseconds had to be allowed for the MPU to initialize registers before reading the values from the registers corresponding to the accelerometer and gyroscope measurements. I wrote a 0 in registers 1B (GYRO_CONFIG), 1C (ACCEL_CONFIG) and 6B (PWR_MGMT_1), and I programmed the myRIO to wait 500 milliseconds before entering the timed loop, in which it reads the measurements of the sensors.

 

By the way, the help of the Read/Write I2C Express VI is wrong: it says that the Block Diagram Input "Byte Count" "Specifies the number of bytes to write to the I2C slave device", but it should be "Specifies the number of bytes to READ from the I2C slave device".

 

0 Kudos
Message 2 of 8
(5,759 Views)

so put A0 to +3.3V logic high and soem changes to the I2C reads. Do you have an example to show your solution - I would be grateful. for some reason I never got this error and now am getting it!

0 Kudos
Message 3 of 8
(5,253 Views)

Hi tomnz,

 

I chose to put AD0 low (connected to ground), so the slave address in my case was 1101001 (binary). I didn't try with AD0 to +3.3V, but it should work with the address 1101000. What changes did you make to the I2C reads?

 

I attach an example that works for me.

0 Kudos
Message 4 of 8
(5,244 Views)

My experience is that it worked fine with teh original address as on the data sheet - I tried the A0 to 3.3V thing and it changed the address to 89. I could fix it by using an interrupt but this in turn messed up my PWM that I had in the loop. I then realised that the problem wasn't software at all, but due to the fact that I had twisted the wires of the MPU650 breakout board for neatness. Bad move, this introduces noise. I only realised this because my older programs stopped working too. I shielded the I2C wires and it all worked perfectly as before. I didn't need the interrupt any more. There are other things that also cause this error. If you have the I2C wires the wrong way round, or if you momentarily lose power when a wire is pulled.

0 Kudos
Message 5 of 8
(5,241 Views)

Just one more comment about your code. You are easier using Join Numbers to join two 8 bit numbers. Other comment is that you appear to be using the acceleration  outputs only. The gyro plus accelerometer uses 14 outputs from the array - first 6 are acceleration  followed by two unused (temp maybe) followed by final six which are gyro - but I assume you are not using the gyro outputs.

0 Kudos
Message 6 of 8
(5,239 Views)

I didn't make any changes as it had worked previously. I added a few of your suggestions but the error still came. Noise was the cause in this case. Good screened wire. Connect the screen to earth and the other two to the I2C outputs. I will send my code soon.

0 Kudos
Message 7 of 8
(5,235 Views)

Ok so here is my version including a Kalman filter and 3D model (yaw not included). Should give very stable estimates of Pitch and Roll. I do not connect A0 or the interrupt pin.

 

Thanks

 

 

Tom Moir

 

0 Kudos
Message 8 of 8
(5,229 Views)