cancel
Showing results for 
Search instead for 
Did you mean: 

General question on motor code organization

BTrem.1
Senior II

Hi All,

I am using the FOC code on a STM302x device and I plan on adding an outer loop to control the motor phase relative to a frequency reference. I've been advised by an ST Apps Mgr not to modify the FOC code library, which I fully agree with. The motor RPS will be ~40Hz and the external reference frequency will be 40Hz. I am comparing these in a digital phase detector (code based) and cascading with a PID block. I plan to add the resulting error signal to a reference RPM to drive the FOC ref RPM input.

Should my new PID block and the code to compute the new RPM be put in my main.c file?

To initialize the PID structure should this be in main.c with the new PID gains defined in drive_parameters.h?

Is there any problem adding drive_parameters.h to the includes for main.c?

Thanks ....

0 REPLIES 0