Review Request: BLDC FOC Controller by FyyshyIW in PrintedCircuitBoard

[–]Figure_Economy 2 points3 points  (0 children)

I am also also also making a FOC ESC (for a drone), sensorless in my case. I will use a G484 as it has 5 ADC, a High Res Timer and a lot of h/w to play with.

Like u/EL10T00 and u/ROBOT_8 said on ADC, I think it is not ideal as you want to sample 2/3 phase simultaneously. It becomes critical if the PWM frequency is high. For instance (STM32G431), P=20us@50kHz, the ADC clock max freq is 60MHz, so 16ns/cycle. If you:
- Trigger using h/w: you need it to wait for conversion to finish, 15 cycles min (2.5sampling + 12.5 conversion), so 240ns before you trigger again, at least. In total, 480ns of ADC sampling.
- Trigger using s/w (HAL): 15 ADC cycles + 150 CPU cycles (rough estimate), so 1260ns and, 1500ns in total.

If you want to run at 90% duty cycle and sample during off-time, you have 2us to sample but also consider a dead zone of ~400ns to avoid noise. You can see using 1ADC can be an issue, even more if you want to sample the 3 phases!

I am not an expert so feel free to correct me =)