You are here

Center-aligned PWM and ADC sampling. Custom firmware

1 post / 0 new
Last seen: 1 month 21 hours ago
Joined: 2020-09-12 10:20
Posts: 1
Center-aligned PWM and ADC sampling. Custom firmware

Hello everyone!

I am working on an application to control an IPMSM and I am developing a firmware inspired by the VESC. I could not use the standard firmware because I need to design and implement more complex algorithms (MTPA, FW, optimizations,...), and I do not see a straightforward way of doing this in the firmware. If anyone has experience or any good tutorials on how to modify the VESC firmware to incorporate other algorithms please share!!


Right now I am trying to synchronize the PWM signal and the ADC so the samples are taken only when all upper switches are ON or OFF at the same time, in order to obtain the maximum quality in the measurements. I have tried several ways but nothing seems to work as intended. I have dived in the VESC code and, from what I understand, the PWM is not configured as center-aligned, but as upward counting. And it is triggered by TIM8 which is slave to TIM1?


Are these observations correct? Is there any flowchart of how this algorithm works? What about modifying the code, can more speed controllers by included by just putting the code in the existing PID function?