cancel
Showing results for 
Search instead for 
Did you mean: 

Timer Configuration for a PWM Scheme

BoboyeOkeya
Associate III

Hi All,

I would really appreciate your input to this problem.

I am presently trying to implement the waveform "(a) PWM-ON" shown in figure below

0693W000008xZwfQAE.pngIt is for a 6step control algorithm, the STSW-SPIN32F0251 to be exact.

Here is the snapshot of the code that I have implemented for each step

0693W00000ALzGrQAL.png0693W00000ALzMPQA1.pngThis is the result that I am getting on the output timers that generates output PWM signals.

-->The yellow and green waveforms are the hall sensor input signals. All the three hall sensors signals have been XORed internally in my MCU into a single channel TI1.

-->The blue waveform is the gate signal to the high side of the first leg.

-->The pink waveform is the gate signal to the low side of the second leg.

0693W00000ALzMyQAL.jpgA zoom in: 0693W00000ALzN8QAL.jpgAlso here is an interesting picture showing the current waveform in pink color. The current decays to 0 between each step due to this delay problem

0693W00000ALznVQAT.jpg 

Now the problem that I would love you to help me with is this:

  1. There is this delay between the signals on each gate signal waveform (blue and purple). It sort of makes sense since, I use the hall sensor signal edges (rising and falling) to indicate a step (1-6). so at each step, another pulse is produced on the same hall sensor interface timer to use in triggering the configuration changes in the output PWM timer for my gate drivers.
  2. Hence it makes sense that there would be an initial delay, but after that there should be no delay as explained here in the manual RM03600693W00000ALzReQAL.png

So how can I fix this delay?

I kinda think it could be a setting problem on the PWM timer - advanced timer 1. Maybe there is a setting to ensure the signals repeat and not get cleared until the next step.?

Thank you

16 REPLIES 16

@Javier Muñoz​ The delay still exists though after I did that.

About outputting the corresponding commutation steps through the DAC. I might be inexperienced but I don't have a way to do that since the board - EVSPIN32F0251S1 - does not have an actual DAC. It only came with an external PWM DAC to transform the current reference - which is a PWM signal - into a DC value by passing it through a low-pass filter for a Peak current control.

@BoboyeOkeya​ whatever suits you, but yes to be able to vsualize your commutation steps along with your pwm gate driving signals will improve your debugging

we dont need to firmware by ourselves, lets talk

@Javier Muñoz​ I kinda plotted the steps on software but you are right, it does not have the step like shape, however it does slopes down from 6 to 1 and vice versa, but sometimes it doesnt reach 6 or 1.

0693W00000AMk5LQAT.png

Depends of how fast are your steps going....

The SWV debugger will try to fish your variables from memory "at runtime"

But if your commutation steps are going much faster you will get undersampled signals like thisone you showed me in green.

what about slowing down (speeding down) the motor?

we dont need to firmware by ourselves, lets talk

ohhhh yes thats true, its the signal acquisition. At slow speeds it tries to get the step form but it still doesnt.

During the process of the debuggings ive done earlier though, I was comparing the hall sensor signals to the PWM gate signals.

Here is my rookie deduction from the image I attached below in figure 1:

  1. At each rising/falling edge of the hall sensor signal, the gate signals fall to zero and hence the delay.
  2. The only reasonable deduction for this is that either the CCR values get cleared or the PWM timer is disabled

Figure 1

Hallsensor signals: yellow and green waveform

PWM Gate signals: pink and purple.

0693W00000ALzN8QAL.jpg 

Figure 2: shows an example of how the hall sensor capture timers is interlinked with them PWM timer

0693W00000ALzReQAL.pngPlease help me, lol, i just want to be able to graduate.

@BoboyeOkeya​ sorry but i cant help you further without actually doing the work for you.

Maybe ask for help to your techers/classmates or use an already existing implementation of bldc motor control to check against yours.

good luck

we dont need to firmware by ourselves, lets talk

@Javier Muñoz​ thank you for all the help so far. I am actually using an already existing motor control solution software from STM itself - their six step motor control library called STSW-SPIN32F0251

I still have not been able to solve it from help from teachers or classmates