cancel
Showing results for 
Search instead for 
Did you mean: 

Hall sensors on TIM4 + PWM output

walterma
Associate II
Posted on March 06, 2009 at 04:08

Hall sensors on TIM4 + PWM output

1 REPLY 1
walterma
Associate II
Posted on May 17, 2011 at 10:15

Hi,

I use the TIM4 to get the hall sensors for a BLDC motor. In addition to that, I want to generate a PWM signal on the TIM4-CH4 to control a small brushed motor. The problem is that the period of the TIM4 is set to U16_MAX

Code:

// Set full 16-bit working range

TIM_HALLTimeBaseInitStructure.TIM_Period = U16_MAX;

TIM_HALLTimeBaseInitStructure.TIM_ClockDivision = TIM_CKD_DIV1;

TIM_TimeBaseInit(HALL_TIMER,&TIM_HALLTimeBaseInitStructure);

but I need at least a timer period set to 0x00FF to generate a valid PWM for the brushed motor.

My question: If I set

Code:

TIM_HALLTimeBaseInitStructure.TIM_Period = 0x00FF;

what other modifications is needed in the code for the hall sensors?

Thank you!