cancel
Showing results for 
Search instead for 
Did you mean: 

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.

ASibi.2
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions
Nikita91
Lead II

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.

View solution in original post

1 REPLY 1
Nikita91
Lead II

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.