1
\$\begingroup\$

I am attempting to breadboard an STM32F401 using a 64-pin breakout board. I am able to both connect and upload my program successfully (via ST-LINK V2 SWD pins), but once uploaded, the program seizes to execute itself.

Oddly enough, I am able to use the st-link debugger and "step" through the program and blink an LED as expected, however, as previously mentioned, outside of using the debugger the program refuses to execute itself.

So after sleeping on this, I woke up and soldered a new chip to a new breakout board to see if I was working with a damaged chip. Since I got the exact same result with a different chip, I am thinking there must be a problem with either the software (unlikely), ST-LINK (unlikely), or the way in which I have wired up the hardware pins (likely?).

I have followed the official ST Nucleo F4 schematics for wiring up the chip for programming, hence why I am kinda stumped with this.

Any help would be appreciated!

Hardware:

  • ST-LINK V2 (official ST, brand new)
  • STM32F401RET6

Software:

  • MBED v5.14

STM32F401 Breadboard Schematic

STM32F401 Breadboard Schematic

MBED Blink Program

All this is suppose to do is Blink an LED

#include <mbed.h>

DigitalOut myled(PA_5);

int main() {
  myled.write(1);

  while(1) {
    myled.write(1);
    wait_us(100);
    myled.write(0);
    wait_us(10);
  }
}
\$\endgroup\$
  • \$\begingroup\$ did you reset the microcontroller after upload? You need to halt it to upload, and after, it needs to be told to boot \$\endgroup\$ – Marcus Müller Jan 17 at 15:16
  • \$\begingroup\$ @MarcusMüller what combination of reset/boot buttons do I need to do? hold reset down, then upload, then release? Also, I though the SDW reset pin auto-resets the device after upload \$\endgroup\$ – scottc11 Jan 17 at 15:38
  • \$\begingroup\$ If you use the PC program from ST to upload using SWD, you need to separately press Run or it will just sit waiting for further commands after flashing the firmware. Other programs may upload and run directly. But your hardware is not perfect either. Reset pin should have 100nF capacitor, and it should not have any pull-ups. The VBAT pin is also unconnected, it should be connected to VCC. \$\endgroup\$ – Justme Jan 17 at 15:50
  • 2
    \$\begingroup\$ You cannot perceive a LED blinking at 1 ms (you need an oscilloscope for that). Use myled.write(1); wait_us(500000); myled.write(0); wait_us(500000); \$\endgroup\$ – Arsenal Jan 17 at 16:28
  • 1
    \$\begingroup\$ @Arsenal this seemed to work. LED is blinking now. Thank you... \$\endgroup\$ – scottc11 Jan 17 at 16:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.