Showing results for 
Search instead for 
Did you mean: 

MCWB configuring both main and aux position/speed sensors give conflict in timer IRQHandler


When configuring both main and aux sensors (Quad encoder and Hall) it is necessary to assign them to different timers, for example Encoder: TIM2, Ch1:A15, Ch2: B3 and Hall: TIM3, Ch1:C6, Ch2:C7, Ch3:C8. This leads to conflict in define for IRQHandler as shown below:

/********** AUXILIARY HALL TIMER MOTOR 1 *************/

#define M1_HALL_TIM_PERIOD 65535

#define M1_HALL_IC_FILTER 14

#define SPD_TIM_M1_IRQHandler TIM2_IRQHandler

/********** AUXILIARY ENCODER TIMER MOTOR 1 *************/

#define M1_PULSE_NBR ( (4 * (M1_ENCODER_PPR)) - 1 )

#define M1_ENC_IC_FILTER 12

#define SPD_TIM_M1_IRQHandler TIM3_IRQHandler

The generated code for SPD_TIM_M1_IRQHandler does not support _both_ sensor types but generates different code for each sensor type when used separately.

How can this problem be solved?

Background: Our application uses an encoder with 0.01 degree resolution for positioning and a Hall sensor for velocity up to 10000 rpm (where the encoder cannot follow).



cedric H
ST Employee

Hello Håkan,

The current MCWB SDK does not support more than one sensor configuration at the same time.

Auxiliary and primary sensors target one sensor less algorithm and one sensor algo.

For your application, I would recommend to use encoder for low speed operation and move to sensorless STO+PLL for high speed operation.

From our tests the sensor less algorithm (STO+PLL) gives even better results than Hall sensors.