Test program for MPU9250 sensor

Dependencies:   MPU9250

Committer:
andrewbates11
Date:
Wed Sep 27 17:52:29 2017 +0000
Revision:
1:e542337d8586
Parent:
0:6ffb1296d690
update readme

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andrewbates11 0:6ffb1296d690 1 PDIOT Example mbed program
andrewbates11 0:6ffb1296d690 2 --------------------------
andrewbates11 0:6ffb1296d690 3
andrewbates11 0:6ffb1296d690 4 Program to test I2C communication and sensor values from the MPU9250 board.
andrewbates11 0:6ffb1296d690 5 Outputs to serial port.
andrewbates11 1:e542337d8586 6 Acceleration values are shown in G and gyro values in degress per second.
andrewbates11 1:e542337d8586 7
andrewbates11 1:e542337d8586 8 To run:
andrewbates11 1:e542337d8586 9 Copy the .hex file to the J-link drive and keep the USB cable connected.
andrewbates11 1:e542337d8586 10 Open a serial console to view the output.
andrewbates11 1:e542337d8586 11
andrewbates11 1:e542337d8586 12 Expected output:
andrewbates11 1:e542337d8586 13 I AM 0x71
andrewbates11 1:e542337d8586 14
andrewbates11 1:e542337d8586 15 I SHOULD BE 0x71
andrewbates11 1:e542337d8586 16
andrewbates11 1:e542337d8586 17 Self test result 0: 3.746911
andrewbates11 1:e542337d8586 18 Self test result 1: -1.245075
andrewbates11 1:e542337d8586 19 Self test result 2: -0.165160
andrewbates11 1:e542337d8586 20 Self test result 3: 0.021077
andrewbates11 1:e542337d8586 21 Self test result 4: -1.124052
andrewbates11 1:e542337d8586 22 Self test result 5: 0.295831
andrewbates11 1:e542337d8586 23 accel: (-0.674744, 0.749390, -0.046814)
andrewbates11 1:e542337d8586 24 gyro: (-0.556946, 0.877380, 0.915527)
andrewbates11 1:e542337d8586 25 cel: (-0.672729, 0.751099, -0.047363)
andrewbates11 1:e542337d8586 26 gyro: (-0.427246, 0.579834, 0.411987)
andrewbates11 1:e542337d8586 27 accel: (-0.671387, 0.751160, -0.045959)
andrewbates11 1:e542337d8586 28 gyro: (-0.778198, 0.442505, 0.709534)
andrewbates11 1:e542337d8586 29 accel: (-0.675110, 0.748657, -0.046570)
andrewbates11 1:e542337d8586 30 gyro: (-0.045776, 1.831055, 0.007629)
andrewbates11 1:e542337d8586 31
andrewbates11 1:e542337d8586 32 Acceleration should show 1.0 on the axis that is facing straight down.
andrewbates11 1:e542337d8586 33 Gyro values should be close to zero unless you rotate the sensor.
andrewbates11 1:e542337d8586 34
andrewbates11 1:e542337d8586 35 Known bugs:
andrewbates11 1:e542337d8586 36 1. If you enable the init function for the MPU9250, the acceleration and gyro
andrewbates11 1:e542337d8586 37 values are constant. It seems to work OK without this.
andrewbates11 1:e542337d8586 38
andrewbates11 1:e542337d8586 39 2. Running the code by flashing and allowing the NRF52 to run straight away
andrewbates11 1:e542337d8586 40 seems to work. Switching the NRF board on so that it runs the already
andrewbates11 1:e542337d8586 41 flashed code makes it lock up.
andrewbates11 1:e542337d8586 42