完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
有时使用 DMA 激活某些外设会以导致外设无法工作的方式生成代码。
当 MX_DMA_Init 放置在所需的外设 MX 启动之后时,问题就出现了。解决方案是强制 MX_DMA_Init 在 MX GPIO 启动后立即保留。 每次从 MX 生成代码来处理这个简单的操作后,这都会对我造成影响。这可能会导致新用户浪费大量时间来调试他们感染了这个问题的代码。现在我在使用 SAI2 和 DMA 时遇到了这个问题。我也遇到过 I2C 的这个问题。 实际问题(此代码阻止 SAI2 工作): 虽然重现这个错误可能很难,因为它并不总是发生。也许您必须在没有 DMA 生成代码的情况下初始化 periph,然后再次激活它的 DMA。或者一些不寻常的东西会产生这个错误。 |
|
相关推荐
3个回答
|
|
When DMA is used, the MX_DMA_Init shall always be called before any other HAL_***_Init (where *** is any peripheral with a HW dependency on DMA init code). A regression was detected in the previous STM32CubeMX version 6.3.0 (STM32CubeIDE Version: 1.7.0 ) generating a wrong order of initialization functions. This issue was fixed in the latest STM32CubeMX version 6.4.0. Thus, newly created project with this version will generate the correct initialization functions order. Because the calling order is saved into the ioc file, the misplacement call to MX_DMA_Init() remains the same when trying to migrate automatically an old project from a buggy old version to the fixed version. The order stays the same and the generated code will be unfunctional. For any old ioc file created by any STM32CubeMX version up to 6.3.0 included, hereafter some steps to overcome this misbehavior:
|
|
|
|
Many thanks for posting this. It saved my sanity after a couple of frustrating days trying to get DMA working for the LPUART and the ADCs.
There are many posts on stackoverflow etc. saying that the DMA must be initialised before the thing that uses it, e.g. ADCs. I had moved the DMA initialisation to position 3 in the start up order (after GPIO and SystemClock_Config) but DMA didn't work. When I moved it to position 2 as shown above, DMA worked. So there must be some interaction between the DMA and the SystemClock_Config initialisation that is preventing the DMA from running correctly. tldr: Make sure the order is:
|
|
|
|
I have just generated code with this IDE
STM32CubeIDE Version: 1.8.0 Build: 11526_20211125_0815 (UTC) OS: Linux, v.5.13.0-28-generic, x86_64 / gtk 3.24.20, WebKit 2.34.4 Java version: 11.0.11 CubeMX Version: 6.4.0-RC4 Build: 20211122-2105 (UTC) Still: Wrong code. WTF ST?
|
|
|
|
只有小组成员才能发言,加入小组>>
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
2671 浏览 1 评论
3224 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
1796 浏览 1 评论
3625 浏览 6 评论
6007 浏览 21 评论
953浏览 4评论
1324浏览 4评论
在Linux上安装Atollic TRUEStudio的步骤有哪些呢?
599浏览 3评论
使用DMA激活某些外设会以导致外设无法工作的方式生成代码是怎么回事
1317浏览 3评论
1377浏览 3评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-4 16:08 , Processed in 1.147630 second(s), Total 82, Slave 64 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号