当前位置:网站首页>STM 32 使用cube 生成TIM触发ADC并通过DMA传输的问题
STM 32 使用cube 生成TIM触发ADC并通过DMA传输的问题
2022-06-26 06:18:00 【测试狗2010】
STM 32 使用cube 生成TIM触发ADC并通过DMA传输的问题
这几天在尝试使用freerots,规划了一个电池管理的任务,需要使用TIM触发ADC并通过DMA传输
因为是第一次使用cube和freerots,心里还是不是很有底。
过程基本就是按照百度方式进行配置,进行配置的难度并不大,
问题是出在配置完成之后,直接现象就是ADC没有数据
整体的逻辑就是首先配置TIM和ADC,配置ADC由TIM触发,然后有三个通道扫描,数据发送到内部定义的数组中
经过检查,发现最开始的TIM都没有运行(调试的时候打开TIM3的寄存器看的),后来发现cube生成的代码其实只是配置好了,但是要启动的话还需要用户在用户代码区将他启动起来,像这样
接着改了之后,ADC能正常触发了,但是发现DMA并没有反应,
于是在调试界面打开了DMA的寄存器,发现里面寄存器都是空的。也就是说配置都没有配置。
这个就很奇怪了,因为我是有启动它的语句的
最后发现,原因居然是生成的代码里面,ADC的初始化在DMA初始化之前导致的。。。。。
因为DMA初始化里面是有打开其时钟的,如果ADC在DMA之前配置,DMA的时钟是没有打开的,也就是说ADC初始化的配置是写不进去的。。。。
后来,将这两个初始化的位置换了一下,将DMA放在前面,就能正常收到数据了。
边栏推荐
- Everything is a vector. The service practice of iqiyi online vector recall project
- EFK升级到ClickHouse的日志存储实战
- Logstash - logstash pushes data to redis
- TCP连接与断开,状态迁移图详解
- canal部署、原理和使用介绍
- China micro cultivator market trend report, technical dynamic innovation and market forecast
- Younger sister Juan takes you to learn JDBC -- two days' Sprint Day2
- Unsatisfied dependency expressed through field ‘baseMapper‘; nested exceptio
- Data visualization practice: Data Visualization
- Gof23 - factory mode
猜你喜欢

Several promotion routines of data governance

GoF23—原型模式

A tragedy triggered by "yyyy MM DD" and vigilance before New Year's Day~

Message queue - function, performance, operation and maintenance comparison

GoF23—抽象工厂模式

跨域的五种解决方案
Customer Stories | Netease spring breeze: the "spring breeze" of the fun industry, reaching out to all areas through in-depth interaction

MYSQL索引不生效的原因
Alarm operation and Maintenance Center | build an efficient and accurate alarm collaborative processing system

MVC source code sharing
随机推荐
Transformer中的Self-Attention以及Multi-Head Self-Attention(MSA)
Lamda expression
在web页面播放rtsp流视频(webrtc)
消息队列-功能、性能、运维对比
numpy. log
The sysdig 2022 cloud native security and usage report found that more than 75% of the running containers have serious vulnerabilities
Everything is a vector. The service practice of iqiyi online vector recall project
跨域的五种解决方案
vs code 使用 prettier 格式化 js 的时候, 函数定义的名称和括号之间有一个空格, 而 eslit 又不允许这个空格.
Solve the problem that Cmdr cannot use find command under win10
MySQL-08
Library management system
3.pyinstaller模块介绍
How to design a good technical scheme
Pytorch uses multi GPU parallel training and its principle and precautions
typescript的class结合接口(interface)的简单使用
Mysql-10 (key)
Gof23 - builder mode
Typescript type
China micronutrient market trend report, technical innovation and market forecast