DMP Firmware fails to load

By munshiimran , 22 September 2015

I am using Motion Driver 6.12 package and I have ported it to NXP's LPC11U68 Xpresso board.

I am not able to get the MPL running due to failures: 1] NAK for reg_addr=0 AND 2] dmp_load_motion_driver_firmware() fails.

I tried with two units of MPU9150 and I am getting the same error, I am using the code from the STM32F4 board example.

lisaliu

10 years 5 months ago

I am also using Motion driver 6.12 package and tried to ported it Nordic Semiconductor platform.

I also fail to get the dmp run because the failure of dmp_load_motion_driver_firmware().
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;
}
I found the read mem value is different with the write value.

phpbb Post ID
28908

lisaliu

10 years 5 months ago

I've solved the problem. I2c problem.

phpbb Post ID
28998

davlion

10 years 5 months ago

I am having a similar symptom. What did you change about I2C to fix your problem? My I2C appears to be working correctly, as the previous calls to setup the 9250 succeed, but the call to load the firmware to the dmp fails.

phpbb Post ID
29025

munshiimran

10 years 5 months ago

I also had i2c problem. There was a problem in the i2c read routine which was filling the read buffer starting from index 1 which was wrong.

On LPC Xpresso this should be the i2c_read function that MPL expects:

ErrorCode_t i2c_read (unsigned char slave_addr, unsigned char reg_addr, unsigned char length, unsigned char *data) {
I2C_PARAM_T param;
I2C_RESULT_T result;
ErrorCode_t errorCode = LPC_OK;
uint8_t sendBuff[32];// recvBuff[1024];

param.buffer_ptr_send = sendBuff;
param.num_bytes_send = 2;

param.buffer_ptr_send[0] = (uint8_t) slave_addr << 1; //!< First byte of send buffer is the slave address
param.buffer_ptr_send[1] = (uint8_t) reg_addr; //!< Second byte is the address of the slave register of the slave device

//param.buffer_ptr_rec = recvBuff;
param.buffer_ptr_rec = data;
param.buffer_ptr_rec[0] = (slave_addr << 1) | I2C_RD_CMD_BIT;
param.num_bytes_rec = length;

param.stop_flag = 1;

for (int i = 0; i < 5; i++) {
if ( (errorCode = LPC_I2CD_API->i2c_master_tx_rx_poll (i2cHandleMaster, &param, &result) ) == LPC_OK ) {
break;
}

//delay_ms (2);
}

if ( (errorCode != LPC_OK) || (result.n_bytes_recd != length) ) {
memset (data, 0, length); //!< Set data buffer to 0

led_blink_rate = 0;
led_state = false;
}

return errorCode;
}

phpbb Post ID
29028

facotl

10 years ago

Hello,

I have the same issue than you lisaliu and i work with a Nordic too. What did you do about I2C please ?

Thank you.

phpbb Post ID
33664

facotl

10 years ago

Found, Nordic nRF5x does not accept I2C write with flash memory as source, you have to copy chunck in RAM then do I2C write.

phpbb Post ID
33673

facotl

10 years ago

It just fix I2C errors but read back is wrong...

phpbb Post ID
33679
phpbb Topic ID
27615