Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading from MPU-6050 using USB-8452 via I2C

 

Hello, I'm new to I2C and recently struggling to read data using MPU-6050.
At first, I tested with arduino LINX and it worked easily. Now I got a USB-8452 and it's getting weird.
I searched for Labview and Arduino forum and still confused. I need some help.


1. Addressing problem. Shift or not?
https://forums.ni.com/t5/LabVIEW/NI-845X-I2C-communication-example/td-p/3585049
In forum search, crossrulz pointed out that device address should be shifted to right by 1 bit in block diagrams.
Default address of MPU-6050 is 0x68 (104) and should be 0x34 (52) when shifted. However when I set the address 0x34, I get -301742 error. Just using 0x68 seems fine. At least I don't have error messages and can read something then.


2. No measurements
I read MPU-6050 register map documents and it seems I should read register 0x3B (59) to 0x48 (71) for sensor measurements. However when I designate to read 14 bytes from address 59, I only get zeros. Shifting the address did the same.

As I read from forum, I need to use write-read function to read from specific register address, like below:

  • Just to read from register address AAAA: Make an input array sized 1, and input the AAAA at index 0 for the write-read function.
  • Write some value "BBBB" to register address AAAA: Make an input array sized 2, input the AAAA at index 0, input the BBBB at index 1 for the write-read function.

Seems reading from specific register is working, however writing some value to the specific register isn't. For example, I tried to give some random value at index 1, but readings are still all zero.

 

I'm really confused. What am I missing?

0 Kudos
Message 1 of 1
(872 Views)