cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F302R8 unable to use GPIO

DPrei.1
Associate II

Hi all, I am a new STM32 user migrating from Atmel/Microchip's SAMD line. I created my first project following along the tutorials here: https://www.youtube.com/watch?v=x_5rYfAyqq0&t=682s.

It's a motor driver, with some other hardware shown outside of the screenshot below, but at the moment I am just trying to get statusLED to blink. I can successfully connect to the board with an STLink, when I press debug and resume, my LED will momentarily flash which I capture on video and scope, shown in the video here.

Strangely I don't lose connection to the board or anything, and my program continues to execute, but nothing else happens. As you can see from the code it's supposed to just blink every 500ms. Does anyone have an intuition as to what might be going on?

Here's a video showing the momentary flash (The LED is in the bottom right corner of the board and I press the debug/resume buttons off camera) https://photos.app.goo.gl/BfGQbW1SX8EJT5eV8

I am using the internal clock for debug purposes, and only have Trace Asynchronous Sw debug + the statusLED set as GPIO output. My only added code is:

HAL_GPIO_WritePin (statusLED_GPIO_Port, statusLED_Pin,GPIO_PIN_SET);

HAL_Delay (500);

HAL_GPIO_WritePin (statusLED_GPIO_Port, statusLED_Pin,GPIO_PIN_RESET);

HAL_Delay (500);

Also here's the board schematic: STM32F302R8 Board Layout

Any help would be much appreciated, and let me know if there's any information I am missing that would be helpful.

1 ACCEPTED SOLUTION

Accepted Solutions
KnarfB
Principal III

BOOT0 must be pulled low for normal operation (boot from internal flash), *not* high.

NRST needs not be pulled at all, its a bidir IO. Instead, a 100nF C should connect it to GND to suppress spurious resets.

There used to be AN4206 Application note "Getting started with STM32F3 series hardware development" with reference schematics.

View solution in original post

6 REPLIES 6
AnupB
Associate II

Hi,

Check the Boot 0 and NRST connection.

For normal mode

Boot0->10K->3.3V

and

NRST->10K->3.3V

DPrei.1
Associate II

Hi Anup,

I just double checked the voltages and pull up resistors for Boot0 and NRST and they both appear to be properly pulled up to 3v3 with 10k resistors. The schematic is here: STM32F302R8 Board Layout. Any other ideas? Thanks for your quick response!

Dave

KnarfB
Principal III

BOOT0 must be pulled low for normal operation (boot from internal flash), *not* high.

NRST needs not be pulled at all, its a bidir IO. Instead, a 100nF C should connect it to GND to suppress spurious resets.

There used to be AN4206 Application note "Getting started with STM32F3 series hardware development" with reference schematics.

DPrei.1
Associate II

Hi KnarfB,

Wow thank you so much for clarifying there but you are absolutely right - switching to a Boot0 pulldown has everything working. I think I must have heard that pulling up Boot0 is what you would do to use a bootloader, intended to use a bootloader, and then forgotten that detail. Fortunately this is just rotating a resistor on my board so I am operational now.

Sorry for the simple mistake, and thanks again!

For normal mode

Boot0->10K->3.3V (By mistake I have written 3V3 instead of GND)

and

NRST->10K->3.3V

Correction

For normal mode

Boot0->10K-> GND

and

NRST->10K->3.3V

Hmm.

> NRST->10K->3.3V

Please cite a trustworthy* source for that.

__

*) not the blue pill schematics