PORTING eMD-SmartMotion-ICM20789-20689-DMP-1.1.0

By cyd , 24 June 2021

Porting ICM-20689 to NordicSemiconductor nRF52832
Porting sarted by reading the value 0x98 from the who am I register, 0x75, over I2C address of ICM-20689,0x68 or 0x69 depending on AD0, having called my read_reg function. Having successfully queried the ICM-20689 for its identity, the TDK/Invensense library eMD-SmartMOTION-ICM20789-20689-DMP-1.1.0 was hacked and added, now, referred to as library. This was mainly performed by adding the library files until the compiler completed successfully. Again, the ICM-20689 was queried for its identity, but this time through the library call: inv_icm20789_get_whoami(&icm_device, icm_rx_reg); [must be called four times until it reads correctly every time after].

TDK/Invensense library eMD-SmartMOTION-ICM20789-20689-DMP-1.1.0
Started with a simple TWI
1. Arranged to communicate via TWI to access the who_am_i register for a value of 0x98
2. Separated all TWI or I2C communication structure into a separate file: ICM20689.c/h
a. Called the read_reg function with theI2C address of ICM-20689,0x68 or 0x69, and the who am I register 0x75 and received back 0x98.
i. I2C communication is performing as required

Added library files into my project

1. Included the library .h files from example main.c into my ICM-2689.h file
2. Added the library source files into my make file to be compiled
a. After compiling: duplicate definition of MIN and MAX (commented out Invenseses’)
i. Icm20689Augmented.c needed to point call of MIN to nordic_common.h
3. Added the static const uint8_t dmp3_image = {#include “icm20789_img.dmp3.h”};

Added functions from example project into my ICM-20689.c/h file
1. The hooks between the library and a new embedded processor are mainly in the four files: sensor.c/h and system.c/h.
a. Instanciated inv_icm20789_t icm_device inside my ICM-20689.c
b. Instantiated struct inv_icm20789_serif icm20789_serif inside my ICM20689.c file
i. Changing the .read_reg to my icm_i2c_read
ii. Changing the .write_reg to my icm_i2c_write
2. Called the library function: inv_icm20789_reset_states(&icm_device, &icm20789_serif);
a. Filling the inv_icm20789_t instantiation which is filled with defaults with the vaules of the inv_icm20789_serif instantiation.
3. Repeatedly calling inv_icm20789_get_whoami(&icm_device, icm_rx_reg);

phpbb Topic ID
39064