Skip to main content
Junde
Senior III
August 5, 2026
Question

[MCSDK 6.4.1][MC Workbench] Generated motor configuration metadata duplicates parameter values as literals

  • August 5, 2026
  • 3 replies
  • 56 views

[PN]: STM32G431RB, custom motor-control board
[VERSION]: MCSDK 6.4.1 Full, STM32CubeMX 6.15.0
[TOOL]: Motor Control Workbench code generator / MC firmware
[TYPE]: Enhancement request / generated-code consistency issue

[DETAILS]

The generated project contains motor and drive parameters in:

- pmsm_motor_parameters.h
- drive_parameters.h
- power_stage_parameters.h
- parameters_conversion.h

Most runtime configuration correctly uses these macros or derived macros.

However, mc_configuration_registers.c duplicates several motor parameters as numeric literals in ApplicationConfig_reg_t and MotorConfig_reg_t, even though this file already includes parameters_conversion.h.

Examples from one generated project:

- maxMechanicalSpeed = 15900
  duplicates MOTOR_MAX_SPEED_RPM / MAX_APPLICATION_SPEED_RPM

- nominalCurrent = 0.68
  duplicates NOMINAL_CURRENT_A

- nominalVoltage = 24
  duplicates NOMINAL_BUS_VOLTAGE_V

- polePairs = 1
  duplicates POLE_PAIR_NUM

- ratedFlux = 0.8
  duplicates MOTOR_VOLTAGE_CONSTANT

- rs = 3.16
  duplicates RS

- ls = 0.00025 and ld = 0.00025
  duplicate or derive from LS

- maxCurrent = 0.68
  duplicates the configured motor current limit

These structures are compiled into the firmware and returned through MCP using
MC_REG_APPLICATION_CONFIG and MC_REG_MOTOR_CONFIG. Therefore, they are not only
code-generation intermediate data; they are user-visible Motor Pilot metadata.

[CONCERN]

If generated parameter headers are adjusted by a project-specific post-generation
step, variant overlay, or manual customization, the runtime control parameters can
change while the MCP/Motor Pilot metadata continues to report the old values.

Even when all files are regenerated together, the duplicated literals reduce
traceability and make generated-code review and consistency verification harder.

[EXPECTED BEHAVIOR]

Please consider one of the following:

1. Initialize ApplicationConfig_reg_t and MotorConfig_reg_t using the same generated
   parameter macros used by the runtime configuration.

2. Generate a single typed motor-configuration object and derive both runtime
   configuration and MCP metadata from it.

3. If literals are required by the generator architecture, add a generation-time
   consistency check and document the authoritative source and conversion rules.

Parameters with different meanings, such as rated motor current, Iq limit and
alignment current, should remain independently configurable. The request concerns
duplicated representations of the same semantic parameter, not merely equal numeric
values with different meanings.

[HOW TO REPRODUCE]

1. Create a PMSM FOC project in Motor Control Workbench.
2. Configure identifiable motor values for pole pairs, Rs, Ls, nominal current,
   nominal voltage and maximum speed.
3. Generate the CubeMX and firmware project.
4. Compare pmsm_motor_parameters.h / drive_parameters.h with
   mc_configuration_registers.c.
5. Observe that the latter repeats the same values as numeric literals.
6. Check sync_registers.c: the structures are returned for
   MC_REG_APPLICATION_CONFIG and MC_REG_MOTOR_CONFIG.

I can provide a minimal STWB6 project and the generated files if needed.
(I already test it at MCSDK 6.4.2, ant it’s same)

3 replies

GMA
ST Technical Moderator
August 5, 2026

Hello ​@Junde,

Could you please share your STWB6 project?

If you agree with the answer, please accept it by clicking on 'Best answer'.Best regards.GMA
Junde
JundeAuthor
Senior III
August 7, 2026

Hi ​@GMA

 please check the project file in attachment.

 

GMA
ST Technical Moderator
August 7, 2026

Hello ​@Junde,

Thank you for the reporting.

The point has been escalated to dev team under internal ticket: CDM0064982

You will be kept informed of the progress of the point.

If you agree with the answer, please accept it by clicking on 'Best answer'.Best regards.GMA