Skip to main content
ASibi.2
Associate
January 5, 2022
Solved

Hi, I'am trying to create an inverter 3PH with my stm32F446RE. I've been make a simple inverter with constant frequency but i need change it. I've a problem with code. The problem is:when i change typedef variables the compiler return me an error.

  • January 5, 2022
  • 1 reply
  • 1269 views

If i don't put #define on the variables "linked" to Tim2_Ticks, it make me an error like:"inizializer element is not constant". On web i serch this error but i didn't solve. In this page (https://stackoverflow.com/questions/30158010/initializer-element-not-constant) anyone have same problem but i have same gcc compiler by the way didn't works.

Any idea for solve this problem?

Best Regards, Antonio S.0693W00000HqdPHQAZ.jpg

This topic has been closed for replies.
Best answer by Nikita91

This is because you use the variable F_SIGNAL in the initializer of TIM2_Ticks. There is no error if you replace F_SIGNAL by 100.

The compiler set the cursor on the 1st element of the initializer formula, and wrongly point to TIM2CLK.

You must use only constants known at compile time in an initialiser.

1 reply

Nikita91
Nikita91Best answer
Lead II
January 5, 2022

This is because you use the variable F_SIGNAL in the initializer of TIM2_Ticks. There is no error if you replace F_SIGNAL by 100.

The compiler set the cursor on the 1st element of the initializer formula, and wrongly point to TIM2CLK.

You must use only constants known at compile time in an initialiser.