完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
所有:
是否有可以与STM32F4 Discovery Board一起使用的I2C示例代码连接到LPS25H模块? 我正在以168 MHz的速度运行处理器,据我所知,我已经正确初始化了I2C1端口。 我一直在尝试做最简单的事情 - 读取WhoAmI寄存器,即使是I2C_GenerateSTART()函数,我也不确定应该插入什么。 初始化后直到生成START需要多少延迟? 在发送I2C地址之前,可以在START之后使用I2C_CheckEvent()检查条件吗?可以通过示例代码解决的大量问题...... AN4450应用笔记在6.3节中提到有一些例子,但有没有一个具体的例子来“开始使用LPS25H?” 问候, 托德安德森 #stm32f4#about-lps25h 以上来自于谷歌翻译 以下为原文 All: Is there I2C example code that can be used with the STM32F4 Discovery Board to connect to the LPS25H module? I am running the processor at the full 168 MHz, and as far as I know, I have initialized the I2C1 port correctly. I have been trying to do the simplest thing - read the WhoAmI register, and I am not really sure what I should be inserting after even the I2C_GenerateSTART() function. How much delay is needed after initialization until generating START? Can I2C_CheckEvent() be used after START to check for condition before sending I2C Address? Lots of questions that could be solved by example code... AN4450 App Note mentions in section 6.3 that there are examples, but is there a specific example to ''get started with LPS25H?'' Regards, Todd Anderson #stm32f4 #about-lps25h |
|
相关推荐
5个回答
|
|
托德你好,
我发现最符合您要求的参考代码可以从以下页面下载: http://www.st.com/web/en/catalog/tools/PF261412 #if你向下滚动到页面的末尾,你可以找到一个下载按钮来获取zip。 基本上有一个项目带有一些STM32F4 I2C访问LPS25H的参考代码。它与您拥有的Discovery平台无关,但它仍然是一个STM32F4 micro fw项目(用于核平台)形式,您可以选择一些代码并在经过一些特定于板的修改后使其在您身边工作。解压缩后,这是项目根目录的路径: STM32CubeExpansion_MEMS1_V1.3.0 Projects Multi Examples DataLog 该项目已准备好与IAR,uVision和System Workbench一起使用。 另一方面,从头开始 在底部,您可以参考(附带的)传感器数据表,其中包括第10页的I2C时序图信息和相关延迟,以及第16-17页至第10至14页的逐字节传输详细信息。关于I2C主模式事件检查,您可以获取详细信息中 您可以从http://www.st.com下载特定的STM32F4XXXX micro参考手册 。最好的祝福, 阿达尔韦托 以上来自于谷歌翻译 以下为原文 Hello Todd, the closest reference code I found to match you request can be downloaded from the following page : http://www.st.com/web/en/catalog/tools/PF261412 #if you scroll down to the end of the page you can find a download button to get the zip. There is basically a project coming with some reference code of STM32F4 I2C accessing LPS25H. It's not related to a Discovery platform as the one you own but you it's still an STM32F4 micro fw project (for nucleo platform) form which you can pick some code and make it work on your side after some board specific modifications. After you unzip, here is the path to the root of the project :STM32CubeExpansion_MEMS1_V1.3.0ProjectsMultiExamplesDataLog the project is ready to be used with IAR, uVision and System Workbench. On the other hand, in starting from scratch from the bottom you can refer to the (attached) sensor datasheet, with I2C timing diagram information and related delays coming at page 10 and bytewise transfer details at pages 16-17 through tables 10 to 14. Regarding I2C master mode event checking you can get details within your specific STM32F4XXXX micro's reference manual downloadable from http://www.st.com .Best Regards, Adalberto |
|
|
|
Muhuho:
感谢您的答复。 你说''基本上有一个项目附带一些STM32F4 I2C访问LPS25H的参考代码。'' 这是否意味着在LPS25H上不存在使用I2C的示例代码? 我们一直很难让I2C接口工作。 我有一个带STEVAL-MKI142V1插件的STEVAL-MKI109V2板。 我可以使用它来查看寄存器内容,但我发现它使用SPI作为默认接口。它看起来不像电路板提供连接插件的I2C选项。 此时,我正在考虑使用SPI而不是I2C作为LPS25H的接口。它确实使事情变得复杂,但似乎是更稳定的界面。 问候, 托德安德森 以上来自于谷歌翻译 以下为原文 Muhuho: Thank you for your response. You stated ''There is basically a project coming with some reference code of STM32F4 I2C accessing LPS25H.'' Does that mean there does not exist sample code to use I2C on the LPS25H? We have been having a very difficult time getting the I2C interface working. I have a STEVAL-MKI109V2 board with the STEVAL-MKI142V1 plug-in. I am able to use that to view register contents, but I found that it uses SPI as the default interface. It does not look like the board offers an I2C option to connect to the plug-in. At this point, I am considering using the SPI rather than I2C as the interface to the LPS25H. It does complicate things a bit, but it appears to be the more stable interface. Regards, Todd Anderson |
|
|
|
托德你好,
我在最新答案中提供的指针是你的示例代码 可以从ST主页面开始(http://www.st.com )并浏览 以下链接:Mems和传感器 - >压力传感器 - >软件 我不确定为什么这与你所谓的你所期望的完全不符 一个''示例代码',无论如何它仍然发布在压力传感器区域和 提供了一个完整的项目,通过I2C自下而上解决LPS25H。主要问题是驱动程序通常可以分为两部分: 更高级别的平台无关层,定义如何在抽象中使用数据 方式和平台相关层,它实现细节以便交换 特定总线上的数据字节(在我们的例子中是SPI或I2C),这里是实现的地方 细节从平台到平台明显变化;理想情况下最好至少有一个 项目显示每个ST板/平台通过I2C访问LPS25H,但不幸的是 今天有很多来自ST的不同平台我们做不到 选择它们。但是,在你的情况下,因为你在发现板上使用STM32F4,我期待着 发布的代码是一个很好的参考,因为它附带的其他支持的MCU 也是STM32F4的一个实现,所以它可能只需要一些特定的板 适应运行。最好的问候, 阿达尔韦托 以上来自于谷歌翻译 以下为原文 Hello Todd, the pointer I provided you in my latest answer was example code that you can reach starting from ST main page (http://www.st.com ) and browsing though the following links :Mems and sensors -> Pressure Sensors -> Software I'm not sure why that doesn't match exactly what you expect from what you call a ''sample code'', anyhow it is still published on the pressure sensor area and provides a complete project to address LPS25H through I2C from the bottom up.The main issue is that drivers can generally be split in two parts: a higher level platform independent layer defining how to use data in an abstract way and a platform dependent layer which implements details in order to exchange data bytes on a specific bus (SPI or I2C in our case) and here is where implementation details clearly change from platform to platform; would be ideally best to have at least one project showing LPS25H access through I2C for each ST board/platform but unfortunately today there is a really huge amount of different platforms coming from ST an we cannot choose them all.In your case however, since you are on the Discovery board with STM32F4 I expect the published code to be a good reference because among other supported MCUs it comes with an implementation for STM32F4 as well, so it might take you just some board specific adaptations in order to run.Best Regards, Adalberto |
|
|
|
谢谢您的回复。最后,我们使用了SPI,我能够将STM32F4发现板连接到STEVAL-MKI142V1板,并最初读取WhoAmI寄存器。此外,我通过了AN4450 appnote并能够发出寄存器命令,以便能够一次性读取压力。这样做我收到了有效的压力读数。然后我去了一个装有单个TPS25H的小板,我能够在小板上重复这个程序(由我们公司建造)。
我已经尝试使用Atclic IDE的Xcube插件,它希望允许我创建使用I2C的代码,但到目前为止,学习曲线非常陡峭,我可能不会继续追求I2C路径在这一部分。 问候, 托德安德森 以上来自于谷歌翻译 以下为原文 Thank you for your reply. In the end, we went with SPI, and I am able to connect my STM32F4 Discovery Board to the STEVAL-MKI142V1 board, and initially read the WhoAmI register. Also, I went through the AN4450 appnote and was able to issue the register commands to be able to do a one-shot read of pressure. I received a valid pressure reading in doing this. I then went to a small board with a single TPS25H mounted, and I was able to repeat the procedure on the small board (built by our company). I have tried using the Xcube plug-in for the Atollic IDE, and it would hopefully allow me to create code that would use I2C, but so far the learning curve has been pretty steep, and I will probably not continue to pursue the I2C path on this part. Regards, Todd Anderson |
|
|
|
你介意剪切基本的SPI代码吗?数据表遗漏了很多。
以上来自于谷歌翻译 以下为原文 Would you mind shearing you basic SPI code? The Data sheet leaves out a lot. |
|
|
|
只有小组成员才能发言,加入小组>>
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
2725 浏览 1 评论
3237 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
1807 浏览 1 评论
3646 浏览 6 评论
6034 浏览 21 评论
1337浏览 4评论
197浏览 3评论
对H747I-DISCO写程序时将CN2的st-link复用为usart1,再次烧录时无法检测到stlink怎么解决?
350浏览 2评论
STM32G474RE芯片只是串口发个数据就发烫严重是怎么回事?
442浏览 2评论
STM32处理增量式编码器Z信号如何判断中断是正转的还是反向转的?
273浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-22 17:59 , Processed in 1.249491 second(s), Total 82, Slave 65 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号