Skip to main content
Associate II
September 16, 2026
Question

SPI and Dual UART Configuration with MC Workbench

  • September 16, 2026
  • 1 reply
  • 12 views

Dear ST Community,

I am working on an STM32 motor control project using MC Workbench and would like to configure one SPI interface and two UART interfaces in addition to the motor control peripherals.

Is it possible to configure SPI and two UARTs while using MC Workbench?

I tried configuring these peripherals by modifying the generated .ioc file in STM32CubeMX. However, when I regenerate the project/code, some of the peripheral configurations are overwritten by the MC Workbench-generated configuration.

Could you please suggest the recommended approach for this use case? Specifically:

  1. Is there a supported way to configure SPI + two UARTs directly through MC Workbench?
  2. If not, what is the recommended method to add these peripherals without their configuration being overwritten?
  3. Should the peripherals be configured in the .ioc file after MC Workbench code generation, or is there another recommended integration method?
  4. Are there any specific USER CODE sections, middleware, or configuration files where I should add the initialization and application code?

I would appreciate any guidance or example for integrating additional peripherals with an MC Workbench-generated project.

Regards,
Prathmesh

1 reply

Visitor
September 16, 2026

I think the main thing I'd avoid is treating the generated .ioc as the place for permanent changes if MC Workbench is going to regenerate parts of it. I'd first let MC Workbench generate the motor control project, then check which initialization sections are protected for user code and add the SPI and UART setup there. The exact approach probably depends on the MC Workbench and CubeMX versions, but I'd be interested to know if ST has a recommended workflow for adding non motor control peripherals without having them overwritten on regeneration.