cancel
Showing results for 
Search instead for 
Did you mean: 

(STM32F411CE) Always in system bootloader when powering on

Jeremy1
Associate II

I have a custom board which always enters the DFU USB system bootloader when powering on, even though BOOT0 & BOOT1 pins are driven to ground. After I load a simple test program on it (via dfu-util), it runs the program just fine. However, when I remove power, it ends up back in the bootloader when I power it back on.

I've attached the schematic. It's based on another board design which works just fine.

I feel at a lost for why this could be happening. I've read the datasheet and the bootloader application note (AN2606). I've tested that the BOOT0 & BOOT1 pins are connected to ground. Is there another way that the chip could automatically go to the booloader and not execute the user program on power-up?

Thank you!

15 REPLIES 15

> it ends up back in the bootloader when I power it back on

How do you know?

What does your program do? Is it a simple loopdelay blinky?

Does momentary grounding of NRST start your program?

JW

berendi
Principal

If it accepts a firmware image through dfu-util, then we can reasonably assume that the ROM bootloader is running. Well, unless someone has programmed the MCU with an equivalent bootloader, and convinced OP to link the application at a higher address.

AFAIK the STM32F4 series doesn't have empty flash detection, but it'd be still worth trying to read back the first couple of bytes at 0x08000000. The byte at 0x08000003 should be 0x20, and the one at 0x08000007 should be 0x08 or maybe 0x00.

Is R2 really 20 Ω ?

I think the inference here is that it comes up as a DFU device.

The BOOT0 floating issue seems discounted.

Not sure the F411 is new enough to have the boot to ROM, check the FLASH has a valid image check. ie looks if erased, looks at Initial SP/PC in vectors.

Third option is that FLASH code is actively switching to ROM, say via a magic number in RAM, or a button detect.

Would start with a really simple blinky app, and then instrument to see if the FLASH enters.

Just power via USB (not on computer), and use debug pod to probe/understand what's going on internally.

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

I flashed a really basic blinky program to it. After flashing the program with dfu-util, the LED blinks as expected. When I turn it off and on, the LED no longer blinks and it shows up as a DFU device on my computer.

I'll check your other recommendations to see if it could be anything to do with the FLASH being invalid or otherwise.

The odd thing is that this board is based on a very similar one of mine with the F411 and it's the first time I've run into this issue. So far I don't see anything in the schematic which would cause this and the board design also looks clean.

R2 is actually 20k (that was just a typo in the schematic).

The F411 chip is brand new and I placed it myself. So there shouldn't be any funniness with the bootloader or flash address.

Thanks for your recommendation about reading out the flash. I'll give that a try and see.

> BOOT0 & BOOT1 pins are driven to ground

Have you measured it, directly on the pins?

Have you verified that all GND and VDD (including analog ones) are connected as intended, again directly on pins?

Is the battery connected? What constitutes "power removal"? Have you tried the NRST reset?

Can the DFU utility program a program into RAM and run out of it?

JW

Reading back the flash, 0x08000003 = 0x20 and 0x08000007 = 0x08.

I have measured directly on the pins and the ground goes to ground and VDD goes to 3.3v.

Currently it's powered through USB. I have also connected a USB battery to factor out anything my laptop is doing.

"Power removal" is either physically turning it off with the switch or unplugging it from USB.

When I perform a NRST reset it goes back into the bootloader.

I'm not sure if the DFU utility program can do that. I'm using the same flash command I use for my other board designs (dfu-util -d 0483:df11 -a 0 -s 0x08000000:leave -D build/program.bin). After flashing the program, dfu-util asks the bootloader to jump to the user program.

At this point, I am out of ideas, sorry...

JW