How do I know if data from compass are used?

By alvaro_canivell , 7 September 2011

Hi, we did port embedded motion app platform code for MPU6050 to JN5148 with a good success. Device is working pretty good (still under heavy test right now). We connected an HMC5883L compass device to the MPU and we rewrite ak8975.c interface to adapt to HMC5883L.
We did all is stated in documentation in order to use compass device, but how can I be sure compass device data are used?
To read data out of compass device, is the API function "ext_slave_descr.read" (which is a function pointer to our hmc5883l specific implementation) used? So I can put a log therein?

Thanks for any response.
Paolo.

do_seoung

14 years 6 months ago

It would be easier if you call inv_send_external_sensor_data() during setup, and call inv_get_external_sensor_data() during execution to read the values.

phpbb Post ID
17901

alvaro_canivell

14 years 6 months ago

First of all thanks for you replay.

I did what you suggested.
I changed method umplStartMPU (in file umpl-states.c) adding the call to inv_send_external_sensor_data as follow:

inv_send_external_sensor_data(INV_ELEMENT_1, INV_16_BIT);

this method invocation has been placed after inv_dmp_open and before inv_dmp_start.

Then I put a trace inside function inv_get_compass_data (in file compass.c) in order to trace magnetometer data used within this function.
From the log the magnetometer data looks to be correct.

In my main loop I keep invoking following methods:

umplOnTimer();
result = inv_get_quaternion_float(fQuatEst);

looking to the log generated while running, I'm able to read the magnetometer data logged within inv_get_compass_data function.
This means that MPU is somehow reading magnetometer data while estimating orientation.

I'm using a 3D cuboid to check quaternion orientation. I apply quaternion to this cube. When I put a metallic screwdriver nearby my magnetic sensor the cube orientation is not changing, meanwhile logged magnetometer data are!

So: or (1) you have an excellent algorithm to correct magnetic distortion or (2) magnetic data are not used to estimate quaternion?

May you answer this question? Which of the two is correct?

Thanks forward for your response.
Paolo.

phpbb Post ID
17904

ben_bodley

14 years 2 months ago

@paolomosna wrote:

Hi, we did port embedded motion app platform code for MPU6050 to JN5148 with a good success. Device is working pretty good (still under heavy test right now). We connected an HMC5883L compass device to the MPU and we rewrite ak8975.c interface to adapt to HMC5883L.
We did all is stated in documentation in order to use compass device, but how can I be sure compass device data are used?
To read data out of compass device, is the API function "ext_slave_descr.read" (which is a function pointer to our hmc5883l specific implementation) used? So I can put a log therein?

Thanks for any response.
Paolo.


Hi paolomosna, where you can find ak8975.c file?
phpbb Post ID
17910
phpbb Topic ID
13488