cancel
Showing results for 
Search instead for 
Did you mean: 

why does the microcontroller lose the program when power is off?

shotkyy
Associate II

How can I avoid this?

10 REPLIES 10
Ozone
Lead II

When the code is loaded to RAM by the debugger, and executed there.

Check your project settings.

Write your program so that it resides in FLASH, rather than RAM.

Read the manuals for your toolchain to understand how to locate code.

JW

PS. Please change your username to a nomal nick.

An information packed post...

What micro-controller?

What board? A custom one?

What tools are you using to program?

How have you checked the code is lost?

What is going on with your BOOT0 pin?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

It's a STM32F446VE microcontroller used by the BlueCoin development kit.

I'am using IAR Workbench IDE and ST-LINK programmer/debugger (integrated on STM32nucleo board) ;

the firmware implements a dataLog with USB interface; after program loading (the firmware is correctly operating), i disconnect the board from my PC (board power off) and at the time of a subsequently connection of the board with usb cable to my pc, there is no program running on the mcu, and i don't see any VCP on my computer.

Thank you!

Thank you!

S.Ma
Principal

Check the power, the oscillator (if external). In your code, why not toggle a pin every 500msec to at least know the code is running?

shotkyy
Associate II

.

Hi!

Why should I check the oscillator?