2025-01-25 09:21 AM
I'm testing a STEVAL-PTOOL1V1 board, and I loaded the STEVAL-PTOOL1V1_6S_SL sample project in Motor Control Workbench v6.3.2. I generated the code (which used STM32CubeMX v 6.13.0) for STM32CubeIDE v1.11.5 toolchain, and the resulting code compiled and loaded on the board fine. The board runs the motor OK, although not at high speeds, where it shuts down, presumably because I'm reaching a current limit. The motor I'm using is not the one set in the sample project so I tried to change the parameters in MC Workbench and regenerate, but it doesn't seem to change how it operates. I see some parameters scattered around various header files, but I can't find the power supply max application current (Apk).
I would like to confirm the changes I make in MC Workbench are appearing in the generated code, but it doesn't seem to be and I don't know where to look. I even did a diff on the entire project before and after a parameter change and didn't see any code changes.
I could change the values manually in the code rather than try to use MC Workbench and rebuilding, but not sure where this value (and others) appear.
Thanks,
Angelo
2025-01-27 01:15 AM
Unfortunately, the motor library isn't designed very well and relies heavily on the MCWB code generator.
This leads to important values being scattered and (re)defined over many files.
There's also a significant lack of code documentation, especially regarding defines and their relationship to settings inside the MCWB.
The value for the power supply max used in the MCWB isn't directly used in the code, it only seems to limit the other current values set for the motor and driver.
Generally, the motor parameters can be found in the 'pmsm_motor_parameters.h' file (the name probably changes depending on the chosen motor architecture).
'NOMINAL_CURRENT_A' in this file seems to set the max phase current of the system (it is both used as "nominal" and "max" current in the code...) and is used in the torque controller for limiting the torque (-> current).
'IQMAX_A' in the file 'drive_parameters.h' (this file contains most of the other important settings regarding to the used hardware) seems to limit the current in regards to the speed controller.