cancel
Showing results for 
Search instead for 
Did you mean: 

Run automatically a code of MCU when i connected to a battery only.

KDeli.1
Associate II

Hello, hope you are all well!

I am new in this field. I am trying to do a project where I have to program a board.

The board contains the following: a) a STM32L4 module and b) an external chip.

The board that I am using for debugging is a Discovery board and it works as it is supposed to.

When I have to disconnect the board from my laptop and connect it with a powerbank (battery) the code doesn't start automatically.

Has anyone experienced something similar in the past, or knows how to trigger the code when I turn the board on?

Thank you for your time.

3 REPLIES 3
MM..1
Chief III

You i mean connect power bank to USB STLINK, then you need check:

1.is target MCU unreset maybe stlink hold reset when no connect to pc usb

2.is power on cable when you attach or you start bank with button?

3.is code flashed to flash memory before disconnect?

TDK
Guru

Custom board? Is BOOT0 tied low?

Probably the chip is in bootloader more, or is getting stuck somewhere during startup. When the chip receives power and NRST isn't low, it will run something.

If you feel a post has answered your question, please click "Accept as Solution".

Yes custom board.

BOOT0 is pull down in PCB but i didn't configure it at CubeIDE yet.

Ι look for it now..