当前位置:网站首页>基于STM32F405的硬件IIC+DMA操作分享
基于STM32F405的硬件IIC+DMA操作分享
2022-07-13 19:01:00 【君__】
早就听说STM32的硬件IIC不好用,我个人接触到的很多项目中也都是用模拟IIC来实现对应的操作,但是最近接触到的一个项目中的OLED是IIC接口,当然原本也是用的模拟IIC来实现的刷屏操作,因此效率真的是惨不忍睹。于是就萌生了改用硬件IIC的想法。
在改用硬件IIC的时候确实领略到了STM32硬件IIC的难啃,实际上最主要就是以下一个问题:
使用硬件STM32硬件IIC经常会遇到IIC驱动死掉的情况
注意这里是IIC驱动死掉,调用发送函数会返回失败,CPU是正常运行的。抓波形可以发现一开始有正常的IIC波形,但是马上就没有了。此时STM32的硬件IIC处于busy状态,导致其放弃了后续的IIC操作。我尝试下来只能通过对IIC外设复位来解决。
在调试好IIC外设后发现IIC的DMA也不是直接就能使用。主要问题在于最后的STOP信号丢失,抓波形发现主机最后没有发送STOP信号,该问题在我调用DMA发送函数发送成功后强制控制IIC的寄存器使其发送一个STOP信号后即可解决。
由于调试时间有限并没有研究太深入,欢迎大家来讨论。若有错误的地方也希望大家进行指正。
下面附上基于STM32F405的硬件IIC与DMA操作例程:
边栏推荐
- Otacle table query
- Test basis 1
- 为什么越来越多的人要考PMP项目管理认证?
- Hcip second experiment
- Preorder and inorder traversal sequences determine a binary tree (restore binary tree)
- Hcip third day notes
- [unity] preliminary discussion
- 要么退休,要么转行,要么转管理ps居然俩月没写博客了
- Is there a completely independent localization database technology
- Jerry's phone book synchronization Bluetooth may have no sound [chapter]
猜你喜欢

Win11怎么共享文件夹?Win11创建共享文件夹的方法

不要小看WebSocket!长连接、有状态、双向、全双工都是王炸技能

二项堆原理与解析

Record a detailed penetration test of a site

linux下连接redis报错Could not connect to Redis at 192.168.164.118:6379: Connection refused

Séquence de traversée de l'ordre initial et de l'ordre moyen pour déterminer un arbre binaire (restauration de l'arbre binaire)

What if the win11 touchpad doesn't work? The solution of win11 touch panel not working

左倾堆 - 解析与实现
![[Go]二、RESTful API介紹和API流程和代碼結構](/img/fd/8ae3d6a4c0d0c973ce81672c1c529c.png)
[Go]二、RESTful API介紹和API流程和代碼結構

首届人工智能安全大赛启动报名 三大赛题等你来战
随机推荐
第三讲:最短距离
[ES6] let, const keywords and deconstruction assignment
Lesson 3: take coins
Pressing the volume key on the prototype can synchronously adjust the call volume of the mobile phone when Jerry is talking [chapter]
浅谈——对技术转型做管理的看法
05.01 字符串
Hcip static routing
Don't underestimate websocket! Long connection, stateful, bidirectional and full duplex are all Wang's skills
Analysis of thread related methods wait, notify, notifyAll in object
Test basis 4
[Go]二、RESTful API介紹和API流程和代碼結構
不要小看WebSocket!长连接、有状态、双向、全双工都是王炸技能
Shell script learning record
Jerry's IR may lose code [article]
Virtualization path of GPU resource pool
【Day 2】机器阅读理解——常见机器阅读理解模型(上)
Hongliulin, data gold mine has been dug up in the coal mine!
Response. Write specific introduction
Jerry's key switches the default EQ and EQ adjusted by EQ tool [chapter]
[go] II. Introduction to restful API, API process and code structure