cancel
Showing results for 
Search instead for 
Did you mean: 

LIS2MDL magnetometer with steval_mki181v1

ASREB
Associate II

Hello everyone,

I'm working with the LIS2MDL sensor (steval_mki181v1) , i made a connection between it and the nrf5340 and I configured it over I2C with pull-up resistors enabled.

-VDD -- > VDD

-VDDio --> VDD

-CS --> VDD 

-PIN I2C  :: SCL to SCL et SDA to SDA

-GND t GND

Current configuration:

  • I2C communication working (i got the chip id 0x40)

  • Block Data Update (BDU) enabled

  • Output Data Rate tested at 10 Hz or50 Hz

  • Offset cancellation enabled

  • Continuous mode enabled

  • I applied the offset XYZ as :: 
    int16_t mag_offset[3] = {
    0xF500, /* OFFSET_X_REG */
    0xF800, /* OFFSET_Y_REG */
    0xF400, /* OFFSET_Z_REG */
    };

However, I noticed that the values I read from the sensor remain almost always the same and do not update as expected, as shown in the photo below.

Could anyone help me understand what might be causing this issue or guide me on how to troubleshoot it?

Any help would be greatly appreciated. Thank you!

ASREB_0-1777298804785.pngASREB_1-1777298856405.png

 

17 REPLIES 17
ASREB
Associate II

Hello I need  a response please can u help me ?? 

 

Smithson
Associate III

Are you using the 109 board to handle the communication?  

They do not reply to all questions, sometimes you are in the field of knowledge on your own.  

How are you using the device.  It can be read with a C# program quite nicely, but that depends on the use

ASREB
Associate II

Thank u for your response ....

i used c programmin , i used the board nrf5340 (nordic board) et le lis2mdl dans le module steval_mki181v1

ASREB
Associate II

I need a response , can u help me ST community?? 

Andrew Neil
Super User

Welcome to the forum.

Please see How to write your question to maximize your chances to find a solution for best results.

A schematic is more useful than a text list of connections.

 


@ASREB wrote:

i made a connection between it and the nrf5340 and I configured it over I2C with pull-up resistors enabled.


What pullups did you use?

Have you used an oscilloscope to verify that you have good, clean edges?

See the diagram here for the effects of pullup resistance - from too low to too high ...

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

@ASREB wrote:

i used the board nrf5340 (nordic board) et le lis2mdl dans le module steval_mki181v1


Have you tried using an ST board, and ST's provided software ?

Obviously, issues with the nRF5340 are beyond the scope of this forum - so would be good to remove that as an "unknown".

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
ASREB
Associate II

Hello Andrew
I don’t think the problem comes from the Zephyr driver, because the driver uses the same logic as the ST driver, especially in this configuration.

https://github.com/STMicroelectronics/STMems_Standard_C_drivers/blob/master/lis2mdl_STdC/examples/lis2mdl_read_data_polling.c

Have you actually tried that example?

You didn't answer about the pullups, or schematic.

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.