2023-12-06 11:38 PM - edited 2023-12-09 05:29 AM
2023-12-09 05:29 AM
This is a list of recommendations, as a reply to frustrated complaints that CubeMX sometimes messes up user's original input:
I hear your frustration, this misfortune already happened to me sometimes.
I can share my general recommendations for a reliable way of working, based on my experience :
1. never upgrade the tool to the latest version if everything already works well, unless you really need it for a specific bug fix
2. never upgrade the FW to the latest version if everything already works well, unless you really need it for a specific bug fix or if it is no more compliant with the tool version you have
3. always do regular backups of your projects, especially before doing big changes and code re-generation
4. never trust the tool when it says "it is safe to put user data here and there, they will be kept as is", it is generally not true
5. use intensively text comparison tools before/after a change, to have a control on what has been really updated
6. use a version control tool (such as git), but beware of where you put the root of your repository: never in the root of the SW project, it could be automatically wiped out in a second ! Your root repository must be at a higher level for safety.
7. always be critical about the generated code: it is not because it compiles fine that it will work on your board. You can spend many hours understanding why this peripheral does not talk to that other, if you have not checked that the order of calls is correct, if the constants used in initialization structures correspond to what you have configured in the UI, verified whether the clock values are decent numbers and match the datasheet, and more...
If you follow all these advises, it will require some additional efforts but I can assure they could save you precious hours and save your nerves also !
-- @Oskar_H