I’m working in BEMF detection for this board, I managed to get some readings that look very trapezoid-y:
The board supports pwm-on and pwm-off BEMF detection. ST says the lines take time to stabilize, at low duty cycles measurements should be taken at the end of the pwm off phase. At high duty cycles measurements should be taken at the end of the pwm on phase. It might not be possible to do off-duty BEMF detection and current sensing at the same time (needs research).
The BEMF detection circuit is shown below:
For on-pwm BEMF detection, GPIO_BEMF should be configured as output and driven low. The BEMF1 pin connected to the CPU can be read to obtain a measurement. How do I calculate gain from this circuit? Measurements suggest the gain should be around 40.
Is there an industry standard algorithm to detect the zero-crossings?
For interested readers, here is a reference from ST about minimizing BEMF measurement noise https://www.st.com/resource/en/application_note/cd00043112-back-emf-detection-during-pwm-on-time-by-st7mc-stmicroelectronics.pdf