你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。
chrome
firefox
safari
ie8及以上
ST
意法半导体官网
STM32
中文官网
ST
全球论坛
登录/注册
首页
技术问答
话题
资源
创客秀
视频
标签
积分商城
每日签到
这样的硬件电路有问题吗
[复制链接]
nj_jacky
提问时间:2012-8-1 14:11 /
[img]https://www.stmcu.org.cn/file:///E:/Work/QQ2011/47538885/Image/P00[SX$%252P%7DEUW2Q466SRBH.jpg[/img]
用STM32F103的PA8(PWM,OUT2跟PA8相连)控制输出有问题吗?
使用PA8~PA11做4路PWM控制端,共生产了10片,有6片在使用中发现PA8、PA9、PA10输出为"0",不知为何?PWM的初始化也看了相关资料应该没有问题。
赞
0
收藏
0
评论
8
分享
发布时间:2012-8-1 14:11
举报
请先
登录
后回复
8个回答
nj_jacky
回答时间:2012-8-1 14:13:02
a0a.1 0b0c
RE:这样的硬件电路有问题吗
其他4片能够正常控制PWM占空比,频率也是正确的
赞
0
评论
回复
支持
反对
nj_jacky
回答时间:2012-8-1 14:13:30
a0a.1 0b0c
RE:这样的硬件电路有问题吗
我使用的是STM32F103VCT6
赞
0
评论
回复
支持
反对
yjwpm
回答时间:2012-8-1 14:50:18
a0a.1 0b0c
RE:这样的硬件电路有问题吗
你的PWM是互补方式输出吗?
赞
0
评论
回复
支持
反对
废鱼
回答时间:2012-8-1 15:40:12
a0a.1 0b0c
RE:这样的硬件电路有问题吗
看不到你的配置,没法解决。希望把你PWM的配置和IO口的配置发出来,另外,注意外部IO口是不是有被上拉?
赞
0
评论
回复
支持
反对
么回家
回答时间:2012-8-1 16:45:02
a0a.1 0b0c
RE:这样的硬件电路有问题吗
PWM的配置和IO口的配置发出来
图片看不到
赞
0
评论
回复
支持
反对
nj_jacky
回答时间:2012-8-2 09:33:50
a0a.1 0b0c
RE:这样的硬件电路有问题吗
//====================================//
void PWM_FROM_TIM1_Configuration(void)
{
TIM_TimeBaseInitTypeDef TIM_BaseInitStructure;
TIM_OCInitTypeDef TIM_OCInitStructure;
// TIM_BDTRInitTypeDef TIM1_BDTRInitStructure;
//TIM1_OC1:set PWM channel 1 duty
TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1;
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
TIM_OCInitStructure.TIM_OutputNState = TIM_OutputNState_Disable;
TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;
TIM_OCInitStructure.TIM_OCNPolarity = TIM_OCNPolarity_High;
TIM_OCInitStructure.TIM_Pulse = PWM_DUTY_0_PERCENT;
TIM_OCInitStructure.TIM_OCIdleState = TIM_OCIdleState_Reset;
TIM_OCInitStructure.TIM_OCNIdleState = TIM_OCIdleState_Reset;
//TIM1_OC1:set PWM channel 1 duty
TIM_OC1Init(TIM1, &TIM_OCInitStructure);
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
TIM_OCInitStructure.TIM_Pulse = PWM_DUTY_0_PERCENT;
TIM_OC1PreloadConfig(TIM1, TIM_OCPreload_Enable);
//TIM1_OC2:set PWM channel 2 duty
TIM_OC2Init(TIM1, &TIM_OCInitStructure);
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
TIM_OCInitStructure.TIM_Pulse = PWM_DUTY_0_PERCENT;
TIM_OC2PreloadConfig(TIM1, TIM_OCPreload_Enable);
//TIM1_OC3:set PWM channel 3 duty
TIM_OC3Init(TIM1, &TIM_OCInitStructure);
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
TIM_OCInitStructure.TIM_Pulse = PWM_DUTY_0_PERCENT;
TIM_OC3PreloadConfig(TIM1, TIM_OCPreload_Enable);
//TIM1_OC4:set PWM channel 4 duty
TIM_OC4Init(TIM1, &TIM_OCInitStructure);
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
TIM_OCInitStructure.TIM_Pulse = PWM_DUTY_0_PERCENT;
TIM_OC4PreloadConfig(TIM1, TIM_OCPreload_Enable);
//TIM1 base counter(PWM frequency is 100Hz)
//72MHz/TIM_PRESCALER=1MHz,PWM Frequency = 1MHz / PWM_PERIOD
TIM_BaseInitStructure.TIM_Prescaler = TIM_PRESCALER-1;
TIM_BaseInitStructure.TIM_CounterMode = TIM_CounterMode_Up;
TIM_BaseInitStructure.TIM_Period = PWM_PERIOD-1;
TIM_BaseInitStructure.TIM_ClockDivision = 0;
TIM_BaseInitStructure.TIM_RepetitionCounter = 0;
TIM_TimeBaseInit(TIM1, &TIM_BaseInitStructure);
TIM_ARRPreloadConfig(TIM1, ENABLE);
TIM_ClearITPendingBit(TIM1, TIM_IT_Update | TIM_IT_CC1 | TIM_IT_CC2 | TIM_IT_CC3 | TIM_IT_CC4);
//open TIM1
TIM_Cmd(TIM1, ENABLE);
//enable TIM1_CO to enable PWM channel x(must be added)
TIM_CtrlPWMOutputs(TIM1, ENABLE);
}
赞
0
评论
回复
支持
反对
nj_jacky
回答时间:2012-8-2 09:35:11
a0a.1 0b0c
RE:这样的硬件电路有问题吗
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(GPIOA, &GPIO_InitStructure);
赞
0
评论
回复
支持
反对
nj_jacky
回答时间:2012-8-7 08:37:09
a0a.1 0b0c
RE:这样的硬件电路有问题吗
期待高手指点,谢谢!
赞
0
评论
回复
支持
反对
所属标签
相似问题
关于
意法半导体
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
STM32Cube扩展软件包
意法半导体边缘AI套件
ST - 理想汽车豪华SUV案例
ST意法半导体智能家居案例
STM32 ARM Cortex 32位微控制器
关注我们
微信公众号
手机版
快速回复
返回顶部
返回列表
RE:这样的硬件电路有问题吗
RE:这样的硬件电路有问题吗
RE:这样的硬件电路有问题吗
RE:这样的硬件电路有问题吗
RE:这样的硬件电路有问题吗
图片看不到
RE:这样的硬件电路有问题吗
void PWM_FROM_TIM1_Configuration(void)
{
TIM_TimeBaseInitTypeDef TIM_BaseInitStructure;
TIM_OCInitTypeDef TIM_OCInitStructure;
// TIM_BDTRInitTypeDef TIM1_BDTRInitStructure;
//TIM1_OC1:set PWM channel 1 duty
TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1;
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
TIM_OCInitStructure.TIM_OutputNState = TIM_OutputNState_Disable;
TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;
TIM_OCInitStructure.TIM_OCNPolarity = TIM_OCNPolarity_High;
TIM_OCInitStructure.TIM_Pulse = PWM_DUTY_0_PERCENT;
TIM_OCInitStructure.TIM_OCIdleState = TIM_OCIdleState_Reset;
TIM_OCInitStructure.TIM_OCNIdleState = TIM_OCIdleState_Reset;
//TIM1_OC1:set PWM channel 1 duty
TIM_OC1Init(TIM1, &TIM_OCInitStructure);
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
TIM_OCInitStructure.TIM_Pulse = PWM_DUTY_0_PERCENT;
TIM_OC1PreloadConfig(TIM1, TIM_OCPreload_Enable);
//TIM1_OC2:set PWM channel 2 duty
TIM_OC2Init(TIM1, &TIM_OCInitStructure);
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
TIM_OCInitStructure.TIM_Pulse = PWM_DUTY_0_PERCENT;
TIM_OC2PreloadConfig(TIM1, TIM_OCPreload_Enable);
//TIM1_OC3:set PWM channel 3 duty
TIM_OC3Init(TIM1, &TIM_OCInitStructure);
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
TIM_OCInitStructure.TIM_Pulse = PWM_DUTY_0_PERCENT;
TIM_OC3PreloadConfig(TIM1, TIM_OCPreload_Enable);
//TIM1_OC4:set PWM channel 4 duty
TIM_OC4Init(TIM1, &TIM_OCInitStructure);
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
TIM_OCInitStructure.TIM_Pulse = PWM_DUTY_0_PERCENT;
TIM_OC4PreloadConfig(TIM1, TIM_OCPreload_Enable);
//TIM1 base counter(PWM frequency is 100Hz)
//72MHz/TIM_PRESCALER=1MHz,PWM Frequency = 1MHz / PWM_PERIOD
TIM_BaseInitStructure.TIM_Prescaler = TIM_PRESCALER-1;
TIM_BaseInitStructure.TIM_CounterMode = TIM_CounterMode_Up;
TIM_BaseInitStructure.TIM_Period = PWM_PERIOD-1;
TIM_BaseInitStructure.TIM_ClockDivision = 0;
TIM_BaseInitStructure.TIM_RepetitionCounter = 0;
TIM_TimeBaseInit(TIM1, &TIM_BaseInitStructure);
TIM_ARRPreloadConfig(TIM1, ENABLE);
TIM_ClearITPendingBit(TIM1, TIM_IT_Update | TIM_IT_CC1 | TIM_IT_CC2 | TIM_IT_CC3 | TIM_IT_CC4);
//open TIM1
TIM_Cmd(TIM1, ENABLE);
//enable TIM1_CO to enable PWM channel x(must be added)
TIM_CtrlPWMOutputs(TIM1, ENABLE);
}
RE:这样的硬件电路有问题吗
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(GPIOA, &GPIO_InitStructure);
RE:这样的硬件电路有问题吗