cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX STM32L4 code generation question

Lex
Associate III

Hi folks,

I use MX to generate a code for STM32L4. I noticed, when I configure timer in one pulse mode, I cannot set OC CH1 in PWM mode with CubeMX. I could set it manually after code was generated, but it would be overwritten if I run MX one more time.

Could someone explain, if it is a bug in the tool or "feature"?

 

Cheers

1 ACCEPTED SOLUTION

Accepted Solutions
Sarra.S
ST Employee

Hello @Lex

When working with stm32cubeMX, it's important to understand that the tool provides initial configurations but it might not cover all possible combinations or specific use cases. 

For your specific use case, STM32CubeMX does not allow this configuration directly, you will need to manually adjust the generated code.

To prevent overwriting your manual changes you can use the /* USER CODE BEGIN */ and /* USER CODE END */ sections provided, Alternatively, create a separate function for your PWM configuration and call this function from the main application after the MX_TIMx_Init() call.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

1 REPLY 1
Sarra.S
ST Employee

Hello @Lex

When working with stm32cubeMX, it's important to understand that the tool provides initial configurations but it might not cover all possible combinations or specific use cases. 

For your specific use case, STM32CubeMX does not allow this configuration directly, you will need to manually adjust the generated code.

To prevent overwriting your manual changes you can use the /* USER CODE BEGIN */ and /* USER CODE END */ sections provided, Alternatively, create a separate function for your PWM configuration and call this function from the main application after the MX_TIMx_Init() call.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.