Hello,
We are trying to get raw data from MPU9250, using Motion Drive 6.12, but not using the DMP.
I porting the code to a BGM11S from Silicon Labs.
I'm able to read and write from I2C interface, set registers and get data from the axes.
But the behaivor and values from the sensor are very strange.
I'm sending the value of accelerometer and gyro throught bluetooth radio.
With these values, we are applying fusio algorithm in a PC application and plot it.
The image bellow is the result.
The sensor is drawing a elipses. I have a development kit from Nordic, that use a MPU9250 and I plot the raw data with Fusio algorithm, and the value don't have this variation.
These is my initialization code for MPU9250.
I don't have any error result from this functions.
mpu_init(&int_param);
inv_init_mpl();
inv_enable_quaternion();
inv_enable_9x_sensor_fusion();
inv_enable_fast_nomot();
inv_enable_gyro_tc();
inv_enable_vector_compass_cal();
inv_enable_magnetic_disturbance();
inv_enable_eMPL_outputs();
inv_start_mpl();
mpu_set_sensors(INV_XYZ_GYRO | INV_XYZ_ACCEL | INV_XYZ_COMPASS)){
mpu_configure_fifo(INV_XYZ_GYRO | INV_XYZ_ACCEL)){
mpu_set_sample_rate(DEFAULT_MPU_HZ)){
mpu_set_compass_sample_rate(1000 / COMPASS_READ_MS)){ mpu_get_compass_fsr(&compass_fsr)) {
inv_set_gyro_sample_rate(1000000L / gyro_rate);
inv_set_accel_sample_rate(1000000L / gyro_rate);
inv_set_compass_sample_rate(COMPASS_READ_MS * 1000L);
inv_set_gyro_orientation_and_scale(
inv_orientation_matrix_to_scalar(gyro_pdata.orientation),
(long)gyro_fsr<<15);
inv_set_accel_orientation_and_scale(
inv_orientation_matrix_to_scalar(gyro_pdata.orientation),
(long)accel_fsr<<15);
inv_set_compass_orientation_and_scale(
inv_orientation_matrix_to_scalar(compass_pdata.orientation),
(long)compass_fsr<<15);
To read the raw values, I'm using these functions:
mpu_get_accel_reg(sensorRawData.acc, NULL);
mpu_get_gyro_reg(sensorRawData.gyro, NULL);
mpu_get_compass_reg(sensorRawData.compass, NULL);I'm not using the compass value, because the value is always zero. I don't know why.
Exist a simplest way to initialize the MPU9250 using the DriverMotion and get the raw data without theses errors?
Why the values of my sensor are strange?
Let me know if you need more informations to help me.
Thanks a lot!