locked out from SWD on STM32F0 Discovery

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
goeck
Posts: 92
Joined: Mon Feb 11, 2013 12:00 pm

locked out from SWD on STM32F0 Discovery

Post by goeck »

Hey everyone,

today I wanted to use UART2 on my STM32F0 Disovery board and configured PA14 and PA15 to be used as TX and RX pins, which was indicated in the datasheet. Unfortunetely I missed, that PA13 is part of the SWD pin interface and so, since I uploaded that code through OpenOCD succesfully, I can't connect anymore through SWD.
Does anyone have a hint on how to overcome this issue? I searched but couldn't really find a solution right now.

Thanks for the help!

Greeting
Stefan
goeck
Posts: 92
Joined: Mon Feb 11, 2013 12:00 pm

Re: locked out from SWD on STM32F0 Discovery

Post by goeck »

OK, just found out that I can use the bootloader to push a the flash code into the chip using UART1, which is explained in AppNote AN2606 "STM32â„¢ microcontroller system memory boot mode".
Will try this with the Discovery board tomorrow since I have to desolder SB2 for that to unlock the permanent boot up from flash.
By the way, this way you can configure the chip to load program from SRAM. This means not everytime to actually flash the 1000x writable flash memory.
Here is a nice tool for such cases, including wiring for an adapter: http://www.firefly-power.de/ARM/sloadhost.html

Will keep the issue posted here.

Cheers
Stefan
mobyfab
Posts: 484
Joined: Sat Nov 19, 2011 6:47 pm
Has thanked: 21 times
Been thanked: 31 times

Re: locked out from SWD on STM32F0 Discovery

Post by mobyfab »

it's simple, press the reset button and start your stlink program.

Once the program tries to connect, release the reset button.

The program will halt the MCU at start so you'll be able to debug it.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: locked out from SWD on STM32F0 Discovery

Post by Giovanni »

The first thing to do after connecting should be a global erase.

BTW, I didn't know the reset trick, thanks.

Giovanni
goeck
Posts: 92
Joined: Mon Feb 11, 2013 12:00 pm

Re: locked out from SWD on STM32F0 Discovery

Post by goeck »

Hey everyone,

finally got this done now.
After wasting time with manually usingthe bootloader, I used the Flash Loader Demonstrator tool.
Actually the STM32 bootloader itself and it commands is described in AppNote AN3155.
For this I desoldered the SB2, which always pulled the BOOT0 pin high. I needed to be pulled down during RESET.
Then I attached a MAX232 (actually from AVR STK500) to USART1 pins and hold the USART2 RX pin low (all described in the earlier mentioned AppNote AN2606).
Then the ST tool found the STM32F051R8 and all went just fine guided by the tool (including a global erase and verifying). One can change option bits using this tool, this way it should be possible to implement this RAM/Flash programming thing.

Leaving this here for docu purposes. :!:

Thanks for the answers.
Cheers
Stefan
Post Reply