I am communicating with MPU-9250 using NXP Kinetis K-65F processor, I am able to read ACCEl, GYRO registers on I2C but whenever I try to flash firmware on DMP, I get memcmp errors.
int mpu_load_firmware(unsigned short length, const unsigned char *firmware, unsigned short start_addr, unsigned short sample_rate)
{
unsigned short ii;
unsigned short this_write;
/* Must divide evenly into st.hw->bank_size to avoid bank crossings. */
#define LOAD_CHUNK (16)
unsigned char cur[LOAD_CHUNK], tmp[2];
if (st.chip_cfg.dmp_loaded)
/* DMP should only be loaded once. */
return -1;
if (!firmware)
return -1;
for (ii = 0; ii < length; ii += this_write)
{
this_write = min(LOAD_CHUNK, length – ii);
if (mpu_write_mem(ii, this_write, (unsigned char*)&firmware[ii]))
return -1;
if (mpu_read_mem(ii, this_write, cur))
return -1;
if (memcmp(firmware+ii, cur, this_write))
return -2;
}
}
My underlying goal is to have temp compensated and biased GYRO data, biased ACCEL data, hard iron, soft iron compensated compass data, is their any way to get it without using DMP (so, that I do not have to flash firmware) ???????
Basically I want compensated 9 axes data out from MPU-9250, why is it so so very hard to do such a simple thing, can anybody help ?
GOOGLE is full of chinese websites describing people facing the exact same issue over and over again but I cannot find a solution:
http://www.openedv.com/thread-56171-1-1.html
http://www.openedv.com/thread-43368-1-1.html
Thanks and Regards
Nitin