Skip to main content
Associate
August 10, 2023
Solved

STEVAL-MKI168V1 with IIS2DH I2C issues

  • August 10, 2023
  • 2 replies
  • 1885 views

Hi

I currently try to integrate the STEVAL-MKI168V1 for a development board via I2C.

I use a TI MCU and use the default drivers provided by ST. The sensor does not respond to the defined I2C addresses of 0x31 resp. 0x33 if SA0=1. After doing a I2C scan I found out, the sensor responds to address 0x18 resp. 0x19 if SA0=1. Is this normal behavior?

Using the 0x18 address, I can communicate with the sensor and receive the correct whoamI returnvalue of 0x33. But when trying to get accelerometer data the sensor returns 0 for all axes.

This is how i setup the sensor (all setup calls are successful):

 

 iisRet += iis2dh_block_data_update_set(&DevCtx, PROPERTY_DISABLE); 

 iisRet += iis2dh_data_rate_set(&DevCtx, IIS2DH_ODR_100Hz);

 iisRet += iis2dh_full_scale_set(&DevCtx, IIS2DH_2g);

 iisRet += iis2dh_temperature_meas_set(&DevCtx, IIS2DH_TEMP_DISABLE);

 iisRet += iis2dh_operating_mode_set(&DevCtx, IIS2DH_LP_8bit);

 

Thank you!

This topic has been closed for replies.
Best answer by Federica Bossi

Hi @engineer42 ,

The IIS2DH supports auto increment on I2C, but, as mentioned in datasheet, the auto increment is based on the MSB bit of the subaddress:

FedericaBossi_0-1692188488724.png

If this helps you, please mark my answer as "Best Answer" by clicking on the "Accept as Solution" button, this can be helpful for Community users to find this solution faster.

2 replies

Federica Bossi
Technical Moderator
August 10, 2023

Hi @engineer42 ,

Welcome to ST Community!

The sensor does not respond to the defined I2C addresses of 0x31 resp. 0x33 if SA0=1. After doing a I2C scan I found out, the sensor responds to address 0x18 resp. 0x19 if SA0=1. Is this normal behavior? Yes it is, because the SAD is 18h and 19h, SAD+R/W is 31h and 33h. So it is correct to have responses to address 18h.

About not getting accelerometer data, can you share with me what are you writing in register 20h?

Thanks

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Associate
August 11, 2023

Hi Federica

Thank you for your quick response!

Into the config register 20h I write:

ctrl_reg1.xen = 1;
ctrl_reg1.yen = 1;
ctrl_reg1.zen = 1;
ctrl_reg1.lpen = 1;
ctrl_reg1.odr = 5;

Best regards

 

 

Federica Bossi
Technical Moderator
August 11, 2023

Hi @engineer42 ,

This is correct. Can you read all the registers after your settings and share the reg dump? In particular, I am interested in what you read in register 20h, 22h and 23h.

Thanks.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Federica Bossi
Federica BossiBest answer
Technical Moderator
August 16, 2023

Hi @engineer42 ,

The IIS2DH supports auto increment on I2C, but, as mentioned in datasheet, the auto increment is based on the MSB bit of the subaddress:

FedericaBossi_0-1692188488724.png

If this helps you, please mark my answer as "Best Answer" by clicking on the "Accept as Solution" button, this can be helpful for Community users to find this solution faster.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.