AnsweredAssumed Answered

STM32F3Discovery and PWM

Question asked by hoelker.juergen on Oct 4, 2013
Latest reply on Oct 5, 2013 by hoelker.juergen

i've been looking around for a solution to this for some days now, but nothing, maybe someone of you can help me. I have the following code:
TIM_TimeBaseInitTypeDef TIM_TimeBase_InitStructure;
TIM_OCInitTypeDef TIM_OC_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1, ENABLE);
TIM_TimeBase_InitStructure.TIM_ClockDivision = TIM_CKD_DIV1;
TIM_TimeBase_InitStructure.TIM_CounterMode = TIM_CounterMode_Up;
TIM_TimeBase_InitStructure.TIM_Period = 20000 - 1; // 20000
TIM_TimeBase_InitStructure.TIM_Prescaler = 72 - 1; // 72
TIM_TimeBase_InitStructure.TIM_RepetitionCounter = 0;
TIM_TimeBaseInit(TIM1, &TIM_TimeBase_InitStructure);
TIM_OC_InitStructure.TIM_OCMode = TIM_OCMode_PWM1;
TIM_OC_InitStructure.TIM_OutputState = TIM_OutputState_Enable;
TIM_OC_InitStructure.TIM_OutputNState = TIM_OutputNState_Enable;
TIM_OC_InitStructure.TIM_OCPolarity = TIM_OCPolarity_High;
TIM_OC_InitStructure.TIM_OCNPolarity = TIM_OCNPolarity_Low;
TIM_OC_InitStructure.TIM_OCIdleState = TIM_OCIdleState_Set;
TIM_OC_InitStructure.TIM_OCNIdleState = TIM_OCIdleState_Reset;
TIM_OC_InitStructure.TIM_Pulse = BaseValue + CCR2_Val; //min = 500, max = 2500, BASE = 600
TIM_OC1Init(TIM1, &TIM_OC_InitStructure);
TIM_OC1PreloadConfig (TIM1, TIM_OCPreload_Disable);
NVIC_InitStructure.NVIC_IRQChannel = TIM1_CC_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
 with normal GPIO-Initialization of Pin PA8 as GPIO_Mode_AF and  GPIO_PinAFConfig.

There are 2 Problems with that:
First, I have no output current on Pin PA8. I have an almost similar example for the STM32F0Discovery, which works fine, but on the F3 nothing... i simply can't see why.

Second, what i'm thying to do is provide a PWM Signal for a BLDC, wich doesn't work, not on the F3(clearly ;) )  and not on the F0, which at least seems to give some kind of output.

I've searched the Net up and down for some examples or hints, but everything i find looks almost like the code above.

Can PLEASE someone of you guys help me??