完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,我试图通过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个回答
|
|
你好,你的
你提到你能够从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. |
|
|
|
感谢您的答复。
我会检查并通知你。但是在参考手册中没有提及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 |
|
|
|
我发现了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. |
|
|
|
只有小组成员才能发言,加入小组>>
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
2642 浏览 1 评论
3208 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
1783 浏览 1 评论
3611 浏览 6 评论
5989 浏览 21 评论
939浏览 4评论
1316浏览 4评论
在Linux上安装Atollic TRUEStudio的步骤有哪些呢?
584浏览 3评论
使用DMA激活某些外设会以导致外设无法工作的方式生成代码是怎么回事
1303浏览 3评论
1361浏览 3评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-24 17:16 , Processed in 1.081868 second(s), Total 82, Slave 66 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号