Re: lis2mdl magnetometer in microbit v2 #i2c #driver #lis2dw12


Armando VISCONTI <armando.visconti@...>
 

Hi Marti,

On 7/14/21 9:15 PM, Bolivar, Marti wrote:
Hi,
+Armando
"frank.duignan via lists.zephyrproject.org"
<frank.duignan=gmail.com@lists.zephyrproject.org> writes:

I have been experimenting with the microbit v2 and zephyr.  Everything seems to work ok except for the magnetometer.  The values it produces do not change when you re-orient the device.  If you re-orient the device and power cycle it you will see a new set of values which will remain unchanged until the next power cycle. My build version is zephyr-v2.6.0-535-gbd09d4ff3f81
The accelerometer, bluetooth and digital i/o all work fine.
While wandering through the code and experimenting with various configuration options I came across an error in lis2mdl.c on line 453:
const struct lis2mdl_config *cfg = dev->config;
There is no 'dev' parameter passed to this function however there is a "config" parameter and this modification works:
const struct lis2mdl_config *cfg = config;// dev->config;
Did you send a pull request with the fix? If not, please do. Although
I'm confused about how this builds with no 'dev' in scope.
I confirm that, in case CONFIG_PM_DEVICE is enabled, the driver does not
build correctly.
I just created a pull request with the fix (#36975) as suggested by
Frank.

Having said that, I doubt this PR will fix the original issue of the
reporter ("The values it produces do not change when you re-orient the
device"), as the lis2mdl pm_control init routine was never called (in
the PR I fixed also this).

I suggest to open a specific bug for it and I'll look into it.
Thanks for reporting this build bug!

Armando

Join users@lists.zephyrproject.org to automatically receive all group messages.