Here is a snippet of code from /src/motorBLDC_6step.c in the Microchip appnote "AN1175 - bldc1619 Source Code - Sensorless Brushless DC Motor Control with PIC16" linked below, that implements a digital filter used in commutation of a BLDC motor:
... #define FILTER_DELAY 6 ... static void PhaseDelayFilter(void) { phase_delay_filter += comm_time; phase_delay = phase_delay_filter >> FILTER_DELAY; phase_delay_filter -= phase_delay; phase_delay_counter = phase_delay >> 3; } The source of the code is found in a project provided by Microchip linked below, to use a PIC16F1619 to control a BLDC motor using six-step commutation method:
- Main page - AN1175 Sensorless Brushless DC Motor Control with PIC16
- AN1175 PDF file
- AN1175 - bldc1619 Source Code - Sensorless Brushless DC Motor Control with PIC16
My questions are:
- What kind of a filter is implemented here (what is its differential equation)?
- How the factors 6 and 3 are chosen ?

phase_delay = phase_delay_filter >> FILTER_DELAY;tophase_delay = phase_delay_filter >> 6;? Or did you copy the code in the question from a different file? In short: Where exactly did the code in the question come from, please? Was it changed? TY \$\endgroup\$comm_timeis updated as expected and check for rounding /truncation errors. I think commutation error is a tradeoff between skew and negative torque or positive torque at the boundary. For examples Hall sensor based fans will fail over time if the sensor thermally or age shifts the skew negative and it won't start and just dither back and forth. I had 1% of Nidec fans in production integration fail because of this and had to screen for start/stop report failure and send my tester to them to screen their product. \$\endgroup\$