cancel
Showing results for 
Search instead for 
Did you mean: 

Frequency pwm with stm3210b

jean239955_st
Associate II
Posted on December 05, 2012 at 10:23

Hello,

I'm working with stm3210b-eval,

I'm doing the following procedures :

1 : I generate with st Workench files in systems drives and params

2 : I compile with IAR

But, in ST workench, the frequency params is 16 KHz. When I'm looking the signals on CN1 connectors, the 6 pwm are 35 KHz.

My goal is to see how the library drive motor with 6 pwm. For the moment, I don't have driver. This possible to see this 6 signals without driver ?

If yes, do you have a correct configuration for stm3210b-eval ?

Thank you,
2 REPLIES 2
Cesar cfg
Associate II
Posted on February 13, 2013 at 10:05

First of all you should adjust the configuration of the clock of your CPU;

second you must recalculate the value of  the autoreload register and you have to choose the value of the prescaler to get the right frequency.

for example for a CPU clock 48 Mhz using the STM32F0 discovery :

//16 Khz pmw signals

  TIM_TimeBaseStructure.TIM_Prescaler = 0;

  TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_CenterAligned3;

  TIM_TimeBaseStructure.TIM_Period = 2999;

  TIM_TimeBaseStructure.TIM_ClockDivision = 0;

  TIM_TimeBaseStructure.TIM_RepetitionCounter = 1;

  TIM_TimeBaseInit(TIM1, &TIM_TimeBaseStructure); 

Gigi
Senior
Posted on February 25, 2013 at 09:45

Ciao,

It seems very strange that you get a different PWM frequency in the output signals.

The STM3210B-EVAL is the default control board that we used when we test the STM32 FOC firmware, it is the default configuration that the MC Workbench creates for a new project and it is also the default configuration that you find in the IAR project after a fresh install of the FOC package.

There is no need to set microcontroller frequency or TIMER registers values. All is done automatically by the firmware.

I suggest restarting from the scratch using the default settings.

Another suggestion is to make sure that both projects (MC Application and User Project) are actually compiled after the generation of the parameters in the system and drive params.

You can use it without driver (just the control board STM3210B-EVAL) to produce the 6 pwm signals. After a while the control will stops because there is no feedback from the motor and you get a fault signaling the startup failed.

Ciao

Gigi