Skip to main content
markpow
Senior
December 11, 2023
Solved

How to use MX to avoid destroy of code

  • December 11, 2023
  • 3 replies
  • 1490 views

I downloaded Seeed-Studio LoRaWan-E5-Node, and all works fine till I use the MX component to set up microcontroller configuration (for example, set up LoraWAN or I2C). When I use the MX component and decide to generate code after changes to LoraWAN or I2C components, I always get many build errors. How to avoid such a situation?

I work with STM32CubeIDE Version: 1.14.0. Stm32 Cube MX version 6.10.0.

Best answer by markpow

I found a solution. Download the latest "https://github.com/STMicroelectronics/STM32CubeWL" and use the LoraWAN end node application. All work great now.

3 replies

TDK
December 12, 2023

Only put code within USER CODE BEGIN and USER CODE END sections.

 

"If you feel a post has answered your question, please click ""Accept as Solution""."
markpow
markpowAuthor
Senior
December 12, 2023

No, it destroys its code, not mine. I downloaded the code from Seeds Studio Git Hub.

I imported the project to the Stm32CubeIDE:

 

markpow_0-1702392553935.png

Next, I imported it into Stm32CudeIDE. I built it without any problems or any changes.
Next, I opened the MX component and made some changes to the microcontroller configuration. I double-clicked on the LoRaWAN_End_Node.ico, and made changes to the LORAWAN settings.

markpow_1-1702392637326.png

 

markpow_2-1702392665276.png

markpow_3-1702392707099.png

 

Upon closing the MX component, it asked me to generate code. I answered yes.

markpow_4-1702392749386.png

 

I tried to build the project, and I got several unexpected build errors.

markpow_5-1702392804802.png

I didn't do any manual changes to the code.

What is responsible for that situation?

@TDK 

 

markpow
markpowAuthor
Senior
December 12, 2023

WTF?

After saving code from MX I see:

markpow_0-1702396447554.png

 

TDK
December 12, 2023

 

Not real sure, probably just isn't set up for that functionality right now.

"If you feel a post has answered your question, please click ""Accept as Solution""."
markpow
markpowAuthorBest answer
Senior
December 16, 2023

I found a solution. Download the latest "https://github.com/STMicroelectronics/STM32CubeWL" and use the LoraWAN end node application. All work great now.