cancel
Showing results for 
Search instead for 
Did you mean: 

STEVAL-MKI168V1 with IIS2DH I2C issues

engineer42
Associate II

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!

1 ACCEPTED SOLUTION

Accepted Solutions
Federica Bossi
ST Employee

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.

View solution in original post

6 REPLIES 6
Federica Bossi
ST Employee

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.

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

 

 

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.

Hi Federica

Is is possible that the IIS2DH does not support auto increment on I2C?

Had to call the registers individually. Here is the dump:

[0]	unsigned char	00000000b '\x00' (Binary)	0x001FA0	
[1]	unsigned char	00000000b '\x00' (Binary)	0x001FA1	
[2]	unsigned char	00000000b '\x00' (Binary)	0x001FA2	
[3]	unsigned char	00000000b '\x00' (Binary)	0x001FA3	
[4]	unsigned char	00000000b '\x00' (Binary)	0x001FA4	
[5]	unsigned char	00000000b '\x00' (Binary)	0x001FA5	
[6]	unsigned char	00000000b '\x00' (Binary)	0x001FA6	
[7]	unsigned char	11111111b '\xff' (Binary)	0x001FA7	
[8]	unsigned char	00000000b '\x00' (Binary)	0x001FA8	
[9]	unsigned char	00000000b '\x00' (Binary)	0x001FA9	
[10]	unsigned char	00000000b '\x00' (Binary)	0x001FAA	
[11]	unsigned char	00000000b '\x00' (Binary)	0x001FAB	
[12]	unsigned char	00000000b '\x00' (Binary)	0x001FAC	
[13]	unsigned char	00000000b '\x00' (Binary)	0x001FAD	
[14]	unsigned char	00000000b '\x00' (Binary)	0x001FAE	
[15]	unsigned char	00110011b '3' (Binary)	0x001FAF	
[16]	unsigned char	01000101b 'E' (Binary)	0x001FB0	
[17]	unsigned char	00001000b '\x08' (Binary)	0x001FB1	
[18]	unsigned char	10010001b '\x91' (Binary)	0x001FB2	
[19]	unsigned char	00100000b ' ' (Binary)	0x001FB3	
[20]	unsigned char	10100000b '\xa0' (Binary)	0x001FB4	
[21]	unsigned char	00110100b '4' (Binary)	0x001FB5	
[22]	unsigned char	00100010b '"' (Binary)	0x001FB6	
[23]	unsigned char	00011010b '\x1a' (Binary)	0x001FB7	
[24]	unsigned char	00011111b '\x1f' (Binary)	0x001FB8	
[25]	unsigned char	10100000b '\xa0' (Binary)	0x001FB9	
[26]	unsigned char	01100000b '`' (Binary)	0x001FBA	
[27]	unsigned char	10010100b '\x94' (Binary)	0x001FBB	
[28]	unsigned char	11100000b '\xe0' (Binary)	0x001FBC	
[29]	unsigned char	11100000b '\xe0' (Binary)	0x001FBD	
[30]	unsigned char	00010000b '\x10' (Binary)	0x001FBE	
[31]	unsigned char	00000000b '\x00' (Binary)	0x001FBF	
[32]	unsigned char	01011111b '_' (Binary)	0x001FC0	
[33]	unsigned char	00000000b '\x00' (Binary)	0x001FC1	
[34]	unsigned char	00000000b '\x00' (Binary)	0x001FC2	
[35]	unsigned char	00000000b '\x00' (Binary)	0x001FC3	
[36]	unsigned char	00000000b '\x00' (Binary)	0x001FC4	
[37]	unsigned char	00000000b '\x00' (Binary)	0x001FC5	
[38]	unsigned char	00000000b '\x00' (Binary)	0x001FC6	
[39]	unsigned char	11111111b '\xff' (Binary)	0x001FC7	
[40]	unsigned char	00000000b '\x00' (Binary)	0x001FC8	
[41]	unsigned char	00000011b '\x03' (Binary)	0x001FC9	
[42]	unsigned char	00000000b '\x00' (Binary)	0x001FCA	
[43]	unsigned char	00000001b '\x01' (Binary)	0x001FCB	
[44]	unsigned char	00000000b '\x00' (Binary)	0x001FCC	
[45]	unsigned char	01000101b 'E' (Binary)	0x001FCD	
[46]	unsigned char	00000000b '\x00' (Binary)	0x001FCE	
[47]	unsigned char	00100000b ' ' (Binary)	0x001FCF	
[48]	unsigned char	00000000b '\x00' (Binary)	0x001FD0	
[49]	unsigned char	00000000b '\x00' (Binary)	0x001FD1	
[50]	unsigned char	00000000b '\x00' (Binary)	0x001FD2	
[51]	unsigned char	00000000b '\x00' (Binary)	0x001FD3	
[52]	unsigned char	00000000b '\x00' (Binary)	0x001FD4	
[53]	unsigned char	00000000b '\x00' (Binary)	0x001FD5	
[54]	unsigned char	00000000b '\x00' (Binary)	0x001FD6	
[55]	unsigned char	00000000b '\x00' (Binary)	0x001FD7	
[56]	unsigned char	00000000b '\x00' (Binary)	0x001FD8	
[57]	unsigned char	00000000b '\x00' (Binary)	0x001FD9	
[58]	unsigned char	00000000b '\x00' (Binary)	0x001FDA	
[59]	unsigned char	00000000b '\x00' (Binary)	0x001FDB	
[60]	unsigned char	00000000b '\x00' (Binary)	0x001FDC	
[61]	unsigned char	00000000b '\x00' (Binary)	0x001FDD	
[62]	unsigned char	00000000b '\x00' (Binary)	0x001FDE	
[63]	unsigned char	00000000b '\x00' (Binary)	0x001FDF	

 

 

 

Hi Federica

It really seems as the IIS2DH does not support auto increment on I2C.This was the reason I only received "0" values, as only the value in register 0x28 (IIS2DH_OUT_X_L) was used multiple times and bitshifted.

When I call the individual registers, I receive the correct values.

Can you comment on this?

 

Thanks and best regards

 

Federica Bossi
ST Employee

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.