Closed uLipe closed 2 years ago
Closing this due to a number of limitations of current drivers from Zephyr side:
The ADC driver does not support to be triggered by hardware from PWM (or other external source), doing this by software capturing the PWM edges using the last channel and starting a conversion on the ADC revealed too much latency in sync mode, and translates into consuming all the CPU bandwidth making the STeP nodes to not execute timely.
Even in async mode, the latency has not been solved, the ADC in async mode is not suitable to be re-started from ISR (e.g.: inside of the adc completion callback), only in thread context, so deferring a workqueue was not sufficient to capture two adc channels in time, leaving cpu for STeP node execution, result: starving again.
without proper current sensing synchronized with PWM edges, is not possible to run the observer node, since it depends of trustable current measurements to achieve correct rotor angle estimation.
Possible solutions to continue from here:
Transform the foc_driver.c / .h into a out-of-tree driver, wiith common API and platform dependent implementation, and rewrite it to use the target platform hardware triggers from PWM+ADC.
Revisit this implementation without the sync ADC measurement, adding shunt amplifiers inline of the motor phases, this manipulation eliminates the need of sync measurements.
Signed-off-by: Felipe Neves felipe.neves@linaro.org