完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你好ST社区,
我有一个使用IIS2DH MEMS加速度计的应用程序。我遇到了一些问题,所以要进行故障排除,我买了STEVAL-MKI168V1子板和SEVAL-MKI109V2主板。使用这些套件,并使用STSW-MKI109W软件包,我能够解决我的大部分问题。 我还有一个问题。多字节读取在4线SPI模式下不起作用。这是一些细节。 1.命令字节中的/ MS位设置为1。 2.我的命令序列似乎与示例代码的spi_mems.c中的SPI_Read_MultiData没有什么不同。 3.当读出寄存器(0x20至0x3F)时,如果我使用单字节读取模式读取每个寄存器,则会得到正确的数据。如果我使用多字节读取模式,我将获得没有意义的数据。例如,我可能会读取INT1_SRC(0x31)并在最高有效位(假设为零)中得到1。 在查看示例代码和使用Unico应用程序时,我注意到了一些事情。 1.我使用IIS2DH运行Unico应用程序,并使用逻辑分析器监视总线。即使我单击“寄存器”选项卡中的“全部读取”按钮,它似乎也不会执行多字节读取。相反,它使用单字节模式读取每个寄存器。 2.我在固件中搜索,发现有2个文件文件被调用 SPI_Read_MultiData,但也有2个文件被注释掉,有利于单字节读取。我很难找到确定IIS2DH的示例代码是否会使用多字节读取的方法。据我所知,看起来我可能正在使用lis2dh12.c,它已经注释掉了SPI_Read_MultiData。 奇怪的是,在示例代码的某些文件中禁用了多字节读取。 IIS2DH是否有一个我不知道的勘误表?多字节读取是IIS2DH的已知问题吗? 谢谢 杰夫 以上来自于谷歌翻译 以下为原文 Hello ST Community, I have an application using the IIS2DH MEMS accelerometer. I was running into some issues, so to troubleshoot, I bought the STEVAL-MKI168V1 daughter board and SEVAL-MKI109V2 mother board. Using these kits, and by using the STSW-MKI109W software package, I was able to troubleshoot the majority of my issues. I have one issue that remains. The multibyte read does not work in 4 wire SPI mode. Here are some details. 1. I have the /MS bit in the command byte set to 1. 2. My command sequence appears to be no different than SPI_Read_MultiData in spi_mems.c of the sample code. 3. When reading out the registers (0x20 to 0x3F), I get correct data if I read each register using the single-byte read mode. If I use the multi-byte read mode, I will get data that doesn't make sense. For example, I might read INT1_SRC (0x31) and get a 1 in the most significant bit (supposed to be zero). I noticed a few things while looking at the sample code and using the Unico application. 1. I ran the the Unico application with the IIS2DH and used a logic analyzer to spy the bus. It never seems to perform a multi-byte read, even when I click the 'Read All' button in the Registers tab. Instead, it reads each register using the single-byte mode. 2. I did a search in the firmware and found that 2 files files called SPI_Read_MultiData, but there are also 2 files where it is commented out in favor of the single-byte read. I'm having a hard time finding my way around to confirm whether the sample code for the IIS2DH would use multi-byte reads or not. As far as I can tell, it looks like I might be using lis2dh12.c, which has SPI_Read_MultiData commented out. It is curious that multi-byte read is disabled in some files of the sample code. Is there an errata for the IIS2DH somewhere that I'm not aware of? Is multi-byte read a known problem for the IIS2DH? Thanks Jeff |
|
相关推荐
5个回答
|
|
您可以在示波器或逻辑分析仪上的多次读取过程中捕获SPI信号吗?
以上来自于谷歌翻译 以下为原文 Can you capture SPI signals during you multi-read procedure on a scope or logic analyzer? |
|
|
|
是!我绝对可以捕捉到你的踪迹!
我附加了一个逻辑分析仪跟踪,显示IIS2DH上的读取寄存器0x20到0x3F。我在同一个逻辑分析仪跟踪中完成了这些寄存器的多字节和单字节读操作,这样您就可以比较两种方法的结果。 第一组读取使用多字节读取模式完成。我在读取寄存器0x32的位置留下了标记1(蓝色的一个)。我们期望MSBit很低,但我们读取0x80。寄存器0x33也是如此。 第二组读取使用单字节读取模式完成。我一次读取一个事务的每个寄存器(在0x20和0x3F之间)。我已将标记2(红色的一个)留在它读取寄存器0x32的位置。我们看到我们得到0x00,这是预期的结果。 使用Digiview 3400逻辑分析仪生成逻辑分析仪跟踪。要查看跟踪,您需要下载相关的PC软件。您可以从Tech-Tools网站下载: http://www.tech-tools.com/d_digiview.htm 感谢您查看这个! 如果您需要更多信息,请与我们联系。 以上来自于谷歌翻译 以下为原文 Yes! I can absolutely capture a trace for you to examine! I have attached a logic analyzer trace that shows reading registers 0x20 to 0x3F on the IIS2DH. I have done both multi byte and single byte reads of these registers all in the same logic analyzer trace so that you can compare the result of both methods. The first set of reads is done using the multi byte read mode. I have left marker 1 (the blue one) at the spot where it reads register 0x32. We expect the MSBit to be low, but we read 0x80. The same is also true for register 0x33. The second set of reads is done using the single bytes read mode. I read each register (between 0x20 and 0x3F) one transaction at a time. I have left marker 2 (the red one) at the spot where it reads register 0x32. We see that we get 0x00, which is the expected result. The logic analyzer trace was generated using the Digiview 3400 logic analyzer. In order to view the trace, you will need to download the associated PC Software. You can download it here from the Tech-Tools website: http://www.tech-tools.com/d_digiview.htm Thanks for looking into this! Please let me know if you need anything further. |
|
|
|
不知怎的,我没有发布相当正确的软件下载链接。上面的链接可以进入下载页面。这是Windows 7/8/10(32/64位安装)的直接下载:
http://www.tech-tools.com/files/digiview-921.exe 以上来自于谷歌翻译 以下为原文 Somehow I didn't post quite the correct link for the software download. The above link gets you to the download page. This is the direct download for a Windows 7/8/10 (32/64 bit installation): http://www.tech-tools.com/files/digiview-921.exe |
|
|
|
多次读取的问题是当达到寄存器0x2D时器件回滚到0x28,因此您希望能够使用一次多次读操作从0x20到0x3F读取所有寄存器。在您的日志中,您可以看到数据(0x40,0x0D,0x90,0x00,0x80,0x80)重复到达0x2D寄存器,这确认了上述行为。
以上来自于谷歌翻译 以下为原文 The problem with the multi-read is that the device rolls back to 0x28 when register 0x2D is reached, so you want be able to read all register from 0x20 to 0x3F using one multi-read operation. In your log you can see that the data (0x40, 0x0D, 0x90, 0x00, 0x80, 0x80) repeats whet you reach 0x2D register, which confirms the behavior mentioned above. |
|
|
|
你想通了!谢谢你的帮助!
我没有意识到我的数据正在重复。我最后一次看这个,我不相信我一次性收集数据。相反,我正在将数据读入缓冲区并使用调试器查看内容。由于Accel寄存器是重复的,我当时的解释是我得到的数据是乱码/随机的,因为加速度计在下次我对寄存器进行采样时会改变。 既然你提到数据正在重复,我可以证实这一点。数据表还提到在第22页的“从FIFO中检索数据”部分中达到0x2D时,地址确实回滚到0x28。 我发现这有点令人困惑。根据数据表的读取方式,我不认为这适用于我的情况,因为我处于旁路模式(不使用FIFO,并且CTRL_REG5中的FIFO_EN位为零)。 我做了另一个实验,我做了两个多字节读操作:一个来自0x20 - 0x2D,另一个来自0x2E到0x3F。这次我得到了预期的结果。 是时候回去更新我的代码以使用多字节读取了! 再次感谢! 以上来自于谷歌翻译 以下为原文 You figured it out! Thanks for your help! I had not realized my data was repeating. The last time I looked at this, I don't believe I gathered the data all in one shot. Instead I was reading the data into a buffer and looking at the contents using the debugger. Since the Accel registers are what repeats, my interpretation at the time was that the data I was getting was garbled/random since the accelerometer would change by the next time I sampled the registers. Now that you mention the data is repeating, I can confirm this. The datasheet also mentions that the address does rolls back to 0x28 when 0x2D in reached in the 'Retrieving data from FIFO' section on page 22. I do find this a bit confusing though. Based on the way the datasheet reads, I wouldn't think this would apply to my situation since I am in bypass mode (not using FIFO, and FIFO_EN bit is zero in CTRL_REG5). I did another experiment where I did two multi-byte reads: one from 0x20 - 0x2D, and another from 0x2E to 0x3F. This time I got the expected result. Time to go back and update my code to use multi byte reads! Thanks again! |
|
|
|
只有小组成员才能发言,加入小组>>
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
2735 浏览 1 评论
3241 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
1810 浏览 1 评论
3650 浏览 6 评论
6039 浏览 21 评论
1339浏览 4评论
201浏览 3评论
对H747I-DISCO写程序时将CN2的st-link复用为usart1,再次烧录时无法检测到stlink怎么解决?
350浏览 2评论
STM32G474RE芯片只是串口发个数据就发烫严重是怎么回事?
444浏览 2评论
STM32处理增量式编码器Z信号如何判断中断是正转的还是反向转的?
274浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-24 07:09 , Processed in 1.337110 second(s), Total 84, Slave 68 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号