完善资料让更多小伙伴认识你,还能领取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. |
|
|
|
|
只有小组成员才能发言,加入小组>>
stm32mp157的异核通信的rpmsg_sdb的m4固件和a7驱动该如何编写?
1453 浏览 0 评论
stm32f103用freertos对一个采样率为1kHz的传感器,进行采样,数据出差
1502 浏览 0 评论
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
3649 浏览 1 评论
3842 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
2461 浏览 1 评论
STM32H7打开DCache后,出现了串口接收信息为空的现象,是哪里出了问题?
727浏览 5评论
用NANO STM32F103RBT6的开发板烧录不了是哪里出了问题?
663浏览 5评论
710浏览 5评论
外部中断触发类型为双边沿触发,进入中断回调后有什么办法判断该边沿是上升沿还是下降沿?
941浏览 5评论
STM32L071CBT6低温环境下无法正常工作是什么原因引起的?
745浏览 5评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-2 09:10 , Processed in 1.264973 second(s), Total 48, Slave 41 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
1872