cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX problem

mickaël aliot
Associate II
Posted on June 18, 2018 at 10:20

hello ST community,

I have a little problem with STM32CubeMX.

The problem is, when i generate new code with cubeMX to my existing programm, some of my existing work is not working as intended anymore (here it is my I2C that only returns 255 all the time after the modification). But if i make the modification without CubeMX (copy and past the exact same code) i don't have any problem. I even checked, all the files are the same.

Does someone have an idea why this is happening and how to solve this issue ?

Thanks for your time.

#stmcubemx #st-cube
1 ACCEPTED SOLUTION

Accepted Solutions
mickaël aliot
Associate II
Posted on June 19, 2018 at 11:05

Thank you

iwanicki.artur

‌ for trying to help me, but i have found the problem.

The problem was the optimisation configuration in System Workbench for STM I don't know why but CubeMX change the configuration of the optimisation back to 'Optimize more -O2' each time in generate a new code.

But i would like to know if i can change the default optimisation level in CubeMX.

(just to answer, my MCU is a STM32L476VGT6)

Thanks for your time and your help,

Mickaël Aliot.

View solution in original post

3 REPLIES 3
Artur IWANICKI
ST Employee
Posted on June 19, 2018 at 07:38

Hello,

Interesting. To be honest it is the first time I met such a case. Maybe the problem is in initial configuration (SystemInit function) or configuration of I2C peripheral itself. What is the MCU behind?

Your initial code (before the modifications mentioned above) has been generated by STM32CubeMX using the same library? Which version of STM32CubeMX and STM32Cube library are you using?

Which files of the project have you compared? Are you using interrupts in I2C? Last question is important as you can store your interrupt configuration function (setting priority and enabling them) either in peripheral initialization function or in separate one called MX_NVIC_Init(). Decision is up to you and it is done within NVIC configuration @STM32CubeMX

Thank you in advance,

Best Regards,

Artur 

mickaël aliot
Associate II
Posted on June 19, 2018 at 11:05

Thank you

iwanicki.artur

‌ for trying to help me, but i have found the problem.

The problem was the optimisation configuration in System Workbench for STM I don't know why but CubeMX change the configuration of the optimisation back to 'Optimize more -O2' each time in generate a new code.

But i would like to know if i can change the default optimisation level in CubeMX.

(just to answer, my MCU is a STM32L476VGT6)

Thanks for your time and your help,

Mickaël Aliot.

Artur IWANICKI
ST Employee
Posted on June 19, 2018 at 11:10

Hello,

At the moment it is not possible to change the default optimization level in STM32CubeMX. I will put this option as a proposal for future releases.

Best Regards,

Artur