ST意法半导体
直播中

袁媛

7年用户 176经验值
私信 关注
[问答]

LSM6DS0配置问题

嗨,我试图通过SPI与LSM6DS0模块通信。我可以成功检索WHO_AM_I寄存器内容,但是当我尝试设置CTRL_REG6_XL寄存器以启动accellerometer时,我无法正确执行。特别是,我写0x20,然后再次读取doublechek,但模块回复0xF0。这会发生我尝试写入它的任何可能的值:它总是回复0xF0。显然,当我进一步尝试阅读acc。注册,没有值存在。


听起来我错过了一些东西。有什么建议吗?

提前谢谢你和问候。

以上来自于谷歌翻译


以下为原文




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.

回帖(3)

武妹

2018-9-25 17:41:18
你好,你的
 
 
 你提到你能够从who_am_i reegister中读取数据但是无法在ctrl_6 reg中写入。
 
 你的spi有问题,在你的spi中请检查数据写入功能,你必须发送第一个设备地址然后注册地址而不发送停止位发送数据背靠背。
 
 请使用CRO进一步说明并检查波形使用数据表波形以确认。

以上来自于谷歌翻译


以下为原文





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.
举报

袁媛

2018-9-25 17:52:17
感谢您的答复。
 
 
我会检查并通知你。但是在参考手册中没有提及SPI通信的任何设备地址。此外,该模块是唯一的从设备,因此不需要设备寻址。
 
最好的祝福,
你的

以上来自于谷歌翻译


以下为原文





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,
thy
举报

袁媛

2018-9-25 17:59:00
我发现了SPI和模块出了什么问题。问题在于微控制器如何驱动NSS信号。我之前使用SPI_NSS_HARD_OUTPUT选项检查了范围,只有设置时间与LSM6SD0规格一致,而且确实如此。幸运的是我尝试了SPI_NSS_SOFT,就是这样,现在我可以使用CTRL_REG6_XL进行r / w操作。因此,问题可能是NSS保持时间不小于20ns:由于设置时间约为500ns,我认为保持时间大致相同的顺序。
 
 
问候。

以上来自于谷歌翻译


以下为原文





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.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分