cancel
Showing results for 
Search instead for 
Did you mean: 

Changing to a MCU with more memory - how to do it and keep user code?

sasha
Associate III
Posted on July 13, 2017 at 04:09

Is there a way to change MCU in STM32Cube without having to regenerate a new project?  E.g I just want to change from a 16kB part to a 32kB part, exactly the same series - when I do this via the Pinout->List Compatible MCU's, it creates a new project which overwrites all my user code when I generate the code the first time!  Also the clock configuration is not copied.  I'm using V4.19 of Cube.

#stm32cube
8 REPLIES 8
Rob.Riggs
Senior
Posted on July 13, 2017 at 05:20

I have not found a way to do it within CubeMX itself.  You can manually edit the ioc file and this usually works.  If you pick a part that has a different feature set than what you are currently using, CubeMX can get a little confused.

It would be nice to have the ability to do this easily within CubeMX itself.  But there are lots of complications with that.  I can imagine it would be a tough feature to support.  I needed to switch between an STM32L433CC and an STM32L452CE part, but I was using a timer on the 433 that doesn't exist on the 452.  How should CubeMX handle that?

Imen.D
ST Employee
Posted on July 13, 2017 at 10:59

Hello,

It's possible with

STM32CubeMX to switch easy from MCU to another microcontrollerof the same seriesby importing a saved configuration to a new MCU project.

For more detail about STM32CubeMX tool, take a look to this user Manual

/external-link.jspa?url=http%3A%2F%2Fwww.st.com%2Fcontent%2Fccc%2Fresource%2Ftechnical%2Fdocument%2Fuser_manual%2F10%2Fc5%2F1a%2F43%2F3a%2F70%2F43%2F7d%2FDM001047pdf%2Ffiles%2FDM001047pdf%2Fjcr%3Acontent%2Ftranslations%2Fen.DM001047pdf

, in s

ection (6.9 Switching to another MCU)

I recommend you to use the latest version of STM32CubeMx version (V4.22) as contains enhancements implementation and fixes defects.

With Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on July 13, 2017 at 14:04

Thanks Imen - yes I tried this feature already, however you have to go and painfully find all your user code sections and copy them across from the other project, I was expecting a more streamlined process!  Also, the version V4.19 I was using would not import many of the parameters for the HRTIMER, I2C etc, with messages saying the values were not supported (even though they clearly were), and had been reset to defaults.  I'll try with V4.22 and see if that problem is fixed.

I just want to change from a STM32F334K4 to a STM32F334K6 part (more memory) - exactly the same feature set.

Posted on July 13, 2017 at 14:06

I like the sound of that hack - like you say though, you would not want to change to a MCU with a different feature set this way!

Posted on July 13, 2017 at 14:23

Merge tools also make things easy to migrate back and forth, fork the project so you don't break your starting point, and pull back in anything that Cube stomps on.

Tips, Buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Posted on July 13, 2017 at 14:33

Hi again - I tried with the new version V4.22 and found it still cannot import my project without errors.

I get these errors when I try to import a project TO AN IDENTICAL MCU!

 Some parameters can't be imported for ADC1

 Can't import parameter:Channel = ADC_CHANNEL_TEMPSENSOR, it isn't a possible value in STM32F334K4Tx, it's set to default value.

 Some parameters can't be imported for HRTIM1

 Can't import High Resolution:High Resolution to reach steps down to 217 ps (4.6GHz Equivalent Frequency) = DLLSimpleCalibration, it isn't a possible value in STM32F334K4Tx, it's set to default value.

 Can't import High Resolution:Calibration Rate, it doesn't exist in STM32F334K4Tx

 Can't import High Resolution:Timeout (in ms), it doesn't exist in STM32F334K4Tx0690X00000607JHQAY.png
Posted on July 13, 2017 at 15:57

I will raise your feedback internally to CubeMx team.

Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Jeanne Joly
Senior III
Posted on January 30, 2018 at 14:28

Hi

Marks.Sasha

,

I reproduced the issue you highlighted on the latest CubeMX release.

For your information, our development team are working on some features that will improve the Import project functionality. I can't give you any date for the moment but you will see some improvements in the future.

For the moment, the workaround is to edit the ioc file and change thePCC.PartNumber and theMcu.UserName from

STM32F334

K4Tx

to STM32F334

K6Tx.

I hope it will help you.

BR. Jeanne