Brushless motor algorithm

michinyon:
what do you mean by "the undriven coil" ?

If you know anything about driving BLDCs with trapezoidal mode this is obvious.
If you don't know such things, why try and contribute to answering this query?

The first thing to say to the OP is "post your code and schematic". You'lll probably
need to set the analog clock to run faster so you can monitor the idle phase rapidly
and spot the cross-over point. If you are using PWM then there will be noise and this
may require some carefully chosen low-pass filtering.

You mentioned a comparator - there needs to be 3 comparators, one for each phase,
or a summing circuit to average the 3 phases (since two are known) and share the
comparator.

Code and schematic please...