Skip to content

Using DMP to receive multiple sensor data values -  #34

@n2d7

Description

@n2d7

Many thanks for adding the DMP support for this library.
I followed the recent example Example5_DMP_Quat9_Orientation and was successful getting the quaternion values from the sensor as the example shows. However, I would also want to get multiple data values at the same time, including quaternions and raw accel,gyro,mag data.
To test it out, I added the following lines in the setup;

success &= (myICM.enableDMPSensor(INV_ICM20948_SENSOR_ACCELEROMETER) == ICM_20948_Stat_Ok);
success &= (myICM.setDMPODRrate(DMP_ODR_Reg_Accel, 200) == ICM_20948_Stat_Ok);

and in the loop

else if ((data.header & DMP_header_bitmap_Accel) > 0)
{

	float acc_x = ((float)data.Raw_Accel.Data.X); 
	float acc_y = ((float)data.Raw_Accel.Data.Y); 
	float acc_z = ((float)data.Raw_Accel.Data.Z); 

	char sensor_string_buff[128];
	sprintf(sensor_string_buff, "{\"accel_x\":%f, \"accel_y\":%f, \"accel_z\":%f}", acc_x,acc_y,acc_z);
	Serial.println(sensor_string_buff);
}

However, I am not getting any data (both quaternion and accel values), and it seems like the fifo is empty.
When reading the data if ((myICM.status == ICM_20948_Stat_Ok) || (myICM.status == ICM_20948_Stat_FIFOMoreDataAvail)) is always false.
Appreciate any help to fix this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions