Stm32f401 hello world code

cortex-m4gpiostm32f4

I've finished designing my STM32f401 board, but I can't get the GPIO to work.
After looking for an answer on forums I still can't figure what I'm doing wrong ( Everything worked fine on the SMT32f103CEU6).

My "hello world" is just blinking a led :
http://pastebin.com/hCszBL3G

and here's the led pinout

led pinout

Any idea ?

Best Answer

From the datasheet, page 44 :

PC13, PC14 and PC15 are supplied through the power switch. Since the switch only sinks a limited amount of current (3 mA), the use of GPIOs PC13 to PC15 in output mode is limited:

  • The speed should not exceed 2 MHz with a maximum load of 30 pF.
  • These I/Os must not be used as a current source (e.g. to drive an LED).

So you managed to pick the worst possible pin for a hello world blinking LED. I don't know what happens if you actually drive a LED with this pin - hopefully you didn't kill your device.

You might want to try and disconnect the LED and measure the voltage then, but even with that you are probably above the load of 30pF.

You might want to try blinking the LED on PB8 instead. (Not on BOOT0 as I first thought, stupid me...)