porting EMD 5.1 to Arduino

By tomerbr , 13 February 2013

Hello,

I want to portate EMD5.1 to Arduino platforms.

After successful tests with Jeff Rowbergs DMP20 and DMP41 hacks with different boards (teensy 2.0, promini328, promicro, mega2560)
and sensors (MPU6050, MPU9150) I have big problems to init and setup MPU's with EMD5.1 software.

For my EMD5.1 adaption I used the proven i2c_lib of MultiWii open source project (Copter).
This i2c_lib is also part of my DMP20/DMP41 software hacks and works here fine.
V_CPOUT is always 25V.

I added some error outputs in EMD5.1 software to figure out my problems.

Dump with MPU9150 after powerup looks like this:

Reset MPU9150 at st.hw->addr: 0x69
Product rev= 0x00
Product ID = 0x09
setup_compass() akm_addr=0x0C, data[0]=0x19
setup_compass() akm_addr=0x0D, data[0]=0x1B
setup_compass() akm_addr=0x0E, data[0]=0x1D
setup_compass() akm_addr=0x0F, data[0]=0x1F
Compass not found.
Gyro initialized.
loading firmware... length=3062
Block write verification error, bank ii=0
write: 0x00 0x00 0x70 0x00 0x00 0x00 0x00 0x24 0x00 0x00 0x00 0x02 0x00 0x03 0x00 0x00
read : 0x00 0x0E 0x70 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xFA 0x80 0x00
loading firmware result=-3
Enabling interrupt detection (NanoWii_10 PCINT0 interrupt)...

if I use the MPU9150 before in RAW modus with the MultiWii software I see this:

Reset MPU9150 at st.hw->addr: 0x69
Product rev= 0x02
setup_compass() akm_addr=0x0C, data[0]=0x48
Gyro initialized.
loading firmware... length=3062
Block write verification error, bank ii=0
write: 0x00 0x00 0x70 0x00 0x00 0x00 0x00 0x24 0x00 0x00 0x00 0x02 0x00 0x03 0x00 0x00
read : 0x00 0x0E 0x80 0x5F 0xFF 0x03 0xB9 0xC4 0x73 0x2B 0x69 0x2C 0x63 0x33 0x03 0x0C
loading firmware result=-3
Enabling interrupt detection (NanoWii_10 PCINT0 interrupt)...


... now I'm able to setup the compass!!!!




for a MPU6050 with megs2560 board I see this:

startup after first run in RAW modus with MultiWii software and then flashing EMD5.1 software:

Reset MPU6050 at st.hw->addr: 0x68
Product rev= 0x00
Product ID = 0x08
Gyro initialized.
loading firmware... length=3062
Block write verification error, bank ii=0
write: 0x00 0x00 0x70 0x00 0x00 0x00 0x00 0x24 0x00 0x00 0x00 0x02 0x00 0x03 0x00 0x00
read : 0x00 0x01 0x70 0x00 0x00 0x00 0x00 0x24 0x00 0x00 0x00 0x02 0x00 0x03 0x00 0x00
loading firmware result=-3
Enabling interrupt detection (CRIUS AIO ICP1 interrupt)...


after setting 2. byte of image explicit to 0x01 for test:

Reset MPU6050 at st.hw->addr: 0x68
Product rev= 0x00
Product ID = 0x08
Gyro initialized.
loading firmware... length=3062
Block write verification error, bank ii=0
write: 0x00 0x01 0x70 0x00 0x00 0x00 0x00 0x24 0x00 0x00 0x00 0x02 0x00 0x03 0x00 0x00
read : 0x00 0x01 0x70 0x70 0x00 0x00 0x00 0x00 0x24 0x00 0x00 0x00 0x02 0x00 0x03 0x00
loading firmware result=-3
Enabling interrupt detection (CRIUS AIO ICP1 interrupt)...


if I disable the compare check in mpu_load_firmware() for banks ii < 33 I see this (2. imagebyte back to 0x00):

Reset MPU6050 at st.hw->addr: 0x68
Product rev= 0x00
Product ID = 0x08
Gyro initialized.
loading firmware... length=3062
Block write verification error, bank ii=0
write: 0x00 0x00 0x70 0x00 0x00 0x00 0x00 0x24 0x00 0x00 0x00 0x02 0x00 0x03 0x00 0x00
read : 0x00 0x01 0x70 0x00 0x00 0x00 0x00 0x24 0x00 0x00 0x00 0x02 0x00 0x03 0x00 0x00
Block write verification error, bank ii=16
write: 0x00 0x65 0x00 0x54 0xFF 0xEF 0x00 0x00 0xFA 0x80 0x00 0x0B 0x12 0x82 0x00 0x01
read : 0x00 0x11 0x92 0x01 0x24 0x44 0x48 0x84 0xC0 0xA0 0x20 0x21 0x40 0xC0 0x44 0x94
Block write verification error, bank ii=32
write: 0x03 0x0C 0x30 0xC3 0x0E 0x8C 0x8C 0xE9 0x14 0xD5 0x40 0x02 0x13 0x71 0x0F 0x8E
read : 0x00 0x21 0xCE 0x0B 0x3A 0xAF 0x9F 0xBA 0xBE 0x7F 0x30 0x38 0xFC 0xBD 0xB5 0xB6
Block write verification error, bank ii=48
write: 0x38 0x83 0xF8 0x83 0x30 0x00 0xF8 0x83 0x25 0x8E 0xF8 0x83 0x30 0x00 0xF8 0x83
read : 0x00 0x31 0x21 0xA6 0x18 0x68 0x60 0xE1 0x61 0x41 0x20 0x62 0x10 0x11 0x4C 0x14
loading firmware result=-3
Enabling interrupt detection (CRIUS AIO ICP1 interrupt)...


after powerdown of the board I have this:

Reset MPU6050 at st.hw->addr: 0x68
Product rev= 0x00
Product ID = 0x08
Gyro initialized.
loading firmware... length=3062
Block write verification error, bank ii=0
write: 0x00 0x00 0x70 0x00 0x00 0x00 0x00 0x24 0x00 0x00 0x00 0x02 0x00 0x03 0x00 0x00
read : 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x68 0x00 0x00 0x00 0x00 0x00 0x00 0x00
loading firmware result=-3
Enabling interrupt detection (CRIUS AIO ICP1 interrupt)...


in summary I found this problems:

+++ my EMD5.1 software can't communicate with the MPUs.
+++ DMP20-/DMP41-hacks or software in RAW modus works fine with all my MPUs...
+++ errors of MPUs with devAddr=0x68 looks a little bit different as with devAddr=0x69 in EMD5.1...
+++ I can read/write some bytes if I run the MPUs first in RAW modus and then with EMD5.1 ...


any fixes or helps for my probs?

tanks, Dieter

phpbb Topic ID
15066