为什么Tim1 PWM生成CH1触发输入在TIM3上进行比较
我对嵌入式SW开发非常新,我试图通过实现STM32G031C6T6 MCU的简单代码来尽可能多地了解,所以这很可能是一个愚蠢的问题,但我找不到答案。 首先,我为PWM生成的TIM1的频道1设置,该通道是在PA8引脚上输出的,并且可以正常工作。 然后,我将TIM3的通道1设置为输入捕获,该输入捕获是在PA6引脚上升边缘上执行的。 在代码中,我使用hal_tim_pwm_start(& htim1,tim_channel_1)和hal_tim_ic_ic_start_it(& htim3,tim_channel_1)启动了计时器。 我运行程序,每当Tim1生成的PWM信号的上升边缘时,TIM3中的输入比较就会触发。 我无法弄清楚为什么会发生这种情况,也找不到有关此行为的任何信息。 最后但并非最不重要的一点是,我敢肯定,PA8和PA6之间没有物理连接,加上输入比较通道(我尝试以最大值设置过滤器设置过滤器),因此PWM通道中没有噪声可以触发它。
Cubemx中配置的屏幕截图 [tim3]: https://i.sstatic.net/ehxbe.jpg [tim1]: https://i.sstatic.net/s95ku.jpg
PS:之后进一步的测试我注意到,只有当我在频道1上启用输入比较时,其他3个频道似乎可以正常工作
I'm very new to embedded SW development and I'm trying to understand as much as possible by realizing simple code for a STM32G031C6T6 MCU, so probabily this is a stupid question but I can't find the answer anywere.
First I set up channel 1 of TIM1 for PWM generation, that is output on the PA8 pin and it's working properly.
Then I set channel 1 of TIM3 for input capture, that is performed on the PA6 pin rising edge.
In the code I started the timers with HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1) and HAL_TIM_IC_Start_IT(&htim3, TIM_CHANNEL_1).
I run the the program and the input compare in TIM3 is triggered everytime there's a rising edge of the PWM signal generated by TIM1.
I can't figure out why this is happening and I'm unable to find any info about this behavior.
Last but not least I am sure that there's no physical connection between PA8 and PA6, plus the input compare channel is filtered (I tried to set the filter even at its max value) so that no noise from the PWM channel can trigger it.
screenshot of the configuration in cubeMx
[TIM3]: https://i.sstatic.net/ehXbe.jpg
[TIM1]: https://i.sstatic.net/s95kU.jpg
PS: after further testing i noticed that it happens only if I enable the input compare on channel 1 the other 3 channels seems to work just fine
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论