Showing results for 
Search instead for 
Did you mean: 

LSM6DSM interface with STM32L476 in Sensortile board

Associate II

Hello Team,

Recently I bought Sensortile board from ST.  I tried to interface the LSM6DSM gyroscope and accelerometer sensor with STM32L476 microcontroller through SPI half duplex master, but I'm not able to read the device ID or 'Who Am I' register address in LSM6DSM.  I hope SPI is working fine it seems, but not able to receive the device ID.  It is returning constantly 0xFF instead 0x6A.  Here I attached the source code of my project, please go through and let me know the solution to interface this module.  Because of this problem I've stuck and I don't know how to proceed further, so please let me know the solution as soon as possible.

Federica Bossi
ST Employee

Hi @Saranbabu ,

Welcome to ST Community!

SPI can be tricky, but first of all, make sure that it is working by uploading one of the projects available on the board page. Then can you tell me how did you develop your project? if you used CubeMX, what configuration did you use?

Have you got a signal analyzer, so that we can see the signals of the SPI?

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 Bossi 

Thanks for your reply and support.


It was working fine, we were able to see the output in mobile phone through bluetooth.  We are trying to get data from LSM6DSM sensor, for that we made firmware, I hope you've gone through the source code which I've attached.  Please find the attached image of cubemx configuration images for SPI communication.  I've tried both the ways of SPI 4wire and SPI 3wire mode as well.  Please let me know the solution to communicate with LSM6DSM.

Associate II

Hello team,

Is there any progress on my query?.  Because this issue I can't go further, please give me the solution to overcome this issue.