2024-09-13 08:58 PM
Hi,
When I updating the pin assignment information and doing code generation, I find my code, for example, USER CODE part is clear. Why? Is any setup wrong here?
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* U
STM32CubeIDE
Version: 1.16.0
Build: 21983_20240628_1741 (UTC)
MacOS: 14.2.1
2024-09-13 10:23 PM
Hello @Fei and welcome to the ST Community
Could you please attach you .ioc file and a screenshot of the issue if possible.
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-09-15 10:53 PM
My advice:
As soon as you start coding, create another CubeMX dummy project to copy new stuff from there.
Then you are safe from Cube overwriting stuff - and from unwanted HAL/LL library updates.
2024-09-16 03:20 AM
Please see the posting tips for how to properly post source code:
Where are you putting your user code?
while (1)
{
/* USER CODE END WHILE */
/*
<<< Any code here is OUTSIDE the 'User' block,
<<< so WILL get overwritten by code generation
*/
/* USER CODE BEGIN 3 */
}
/* U
2024-09-16 04:12 AM
int main(void)
{
/* USER CODE BEGIN WHILE */
// user code
/* USER CODE END WHILE */
// NOT user code. Will be deleted!
/* USER CODE BEGIN 3 */
// more user code
/* USER CODE END 3 */
}
2024-09-17 01:41 AM
@Fei - Example of correct placement of user code (see the 2nd code block):
2024-09-27 12:51 AM
@Fei if you prefer video, see this for correct placement of user code: