AnsweredAssumed Answered

IIS2dh multi-byte read doesn't work?

Question asked by Jeff Gros on Dec 5, 2017
Latest reply on Dec 11, 2017 by Jeff Gros

Hello ST Community,


I have an application using the IIS2DH MEMS accelerometer. I was running into some issues, so to troubleshoot, I bought the STEVAL-MKI168V1 daughter board and SEVAL-MKI109V2 mother board. Using these kits, and by using the STSW-MKI109W software package, I was able to troubleshoot the majority of my issues.


I have one issue that remains. The multibyte read does not work in 4 wire SPI mode. Here are some details.

1. I have the /MS bit in the command byte set to 1.

2. My command sequence appears to be no different than SPI_Read_MultiData in spi_mems.c of the sample code.

3. When reading out the registers (0x20 to 0x3F), I get correct data if I read each register using the single-byte read mode. If I use the multi-byte read mode, I will get data that doesn't make sense. For example, I might read INT1_SRC (0x31) and get a 1 in the most significant bit (supposed to be zero).


I noticed a few things while looking at the sample code and using the Unico application.

1. I ran the the Unico application with the IIS2DH and used a logic analyzer to spy the bus. It never seems to perform a multi-byte read, even when I click the "Read All" button in the Registers tab. Instead, it reads each register using the single-byte mode.

2. I did a search in the firmware and found that 2 files files called SPI_Read_MultiData, but there are also 2 files where it is commented out in favor of the single-byte read. I'm having a hard time finding my way around to confirm whether the sample code for the IIS2DH would use multi-byte reads or not. As far as I can tell, it looks like I might be using lis2dh12.c, which has SPI_Read_MultiData commented out.



It is curious that multi-byte read is disabled in some files of the sample code. Is there an errata for the IIS2DH somewhere that I'm not aware of? Is multi-byte read a known problem for the IIS2DH?