Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update drv_pwm.c #3607

Open
wants to merge 1 commit into
base: master
from
Open

Update drv_pwm.c #3607

wants to merge 1 commit into from

Conversation

@Ackleys
Copy link

@Ackleys Ackleys commented May 17, 2020

修复在STM32F103C8TX下,PWM 无法正常输出波形。

拉取/合并请求描述:(PR description)

[
在STM32F103C8T芯片上,使用PWM无法正常输出,在drv_pwm_.c 的stm32_hw_pwm_init函数内增加HAL_TIM_Base_Init即可正常输出PWM信号,在STM32F103C8T6核心板上验证成功。
]

以下的内容不应该在提交PR时的message修改,修改下述message,PR会被直接关闭。请在提交PR后,浏览器查看PR并对以下检查项逐项check,没问题后逐条在页面上打钩。
The following content must not be changed in submitted PR message. Otherwise, the PR will be closed immediately. After submitted PR, please use web browser to visit PR, and check items one by one, and ticked them if no problem.

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other style
  • 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • 本拉取/合并请求代码是高质量的 Code in this PR is of high quality
修复在STM32F103C8TX下,PWM 无法正常输出波形。
@CLAassistant
Copy link

@CLAassistant CLAassistant commented May 17, 2020

CLA assistant check
All committers have signed the CLA.

@BernardXiong BernardXiong requested a review from SummerLife May 17, 2020
@@ -322,6 +322,15 @@ static rt_err_t stm32_hw_pwm_init(struct stm32_pwm *device)
#if defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32L4)
tim->Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
#endif

#if defined(SOC_STM32F103C8TX)

This comment has been minimized.

@SummerLife

SummerLife May 18, 2020
Member

感谢贡献代码,对于本次提交,我有如下两点建议:

首先,我们一般不会对某一个指定型号的芯片来修改驱动代码,一般是对应于某个系列,比如 F1 系列,由于 HAL 的兼容性,这样做是没有问题的。

第二点,你可以参考一下这个 ISSUE,然后检查一下本次修改是否也会造成同样的问题。

This comment has been minimized.

@SummerLife

SummerLife May 18, 2020
Member

同样的,可以参考该 PR ,检查是否会造成同样的问题。

Copy link
Member

@SummerLife SummerLife left a comment

请根据建议完善相关提交代码 🔎

@geniusgogo
Copy link
Contributor

@geniusgogo geniusgogo commented Jun 17, 2020

@SummerLife 我看了之前我修改的PR,这里主要是因为CubeMX的兼容性导致的差异,我在L4上生成出来的有独立的PWM初始化接口HAL_TIM_PWM_MspInit,但是在F2上又没有生成。
这需要手动定义weak函数HAL_TIM_PWM_MspInit才行。

@BernardXiong
Copy link
Member

@BernardXiong BernardXiong commented Jun 29, 2020

@SummerLife 慎重考虑下这份PR,貌似确实存在这样的情况,如果这份PR确实时间久了推动不下去,请自行fix然后发出PR出来。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.