2016-01-08 06:57 AM
Hi, I am trying to communicate with an LSM6DS0 module via SPI. I can retrieve the WHO_AM_I register content succesfully, but then, when I try to set the CTRL_REG6_XL register to start the accellerometer then I am not able to do it properly. In particular, I write 0x20 and then read it again to doublechek, but the module replies 0xF0. And this happens whatever possible value I try to write into it: it always replies 0xF0. Clearly, when I further try to read the acc. register, no values are present.
It sounds like I am missing something. Any suggestion?Thank you in advance and regards.2016-01-12 04:27 AM
Hello, thy
you mentioned you able to read data from who_am_i reegister but not able to write in ctrl_6 reg. there is problem in your spi, in your spi please check data write function where you have to send first device address then register address and without sending stop bit send data back to back. please use CRO for further clarification and check waveform use datasheet waveform for referance.2016-01-17 11:25 PM
Thank you for the reply.
I will check and let you know. However in reference manual there is no mention about any device address for SPI communications. Moreover, the module is the only slave, so no device addressing is needed.Best regards,thy2016-01-20 02:40 AM
I found out what was wrong with the SPI and the module. The problem is in how the microcontroller drives the NSS signal. I was previously using the SPI_NSS_HARD_OUTPUT option having checked with a scope only the setup time was consistent with the LSM6SD0 specs, and it was. Luckily I have given a try with SPI_NSS_SOFT and, that's it, now I am able to r/w operations with CTRL_REG6_XL. So, maybe the problem was with the NSS hold time which has not to be less than 20ns: since the setup time is about 500ns I assumed that the hold time was more or less of the same order.
Regards.