2013-08-09 01:15 AM
Hi,
I accidentally configured USART2 to pins PA14 and PA15 with PA14 being also SWCLK. Now I can't upload code anymore. I read about putting the MCU into bootloader mode by setting BOOT0 to Vdd. But this doesn't work either. When reseting in this state, PA14 is also high which means the port is configured as USART by the bootloader. I found a note in AN2606: Note: After the STM32F051x6 and STM32F051x8 devices have booted in bootloader mode, the serial wire debug (SWD) communication is no more possible until the system is reset, because SWD uses PA14 pin (SWCLK) which is already used by the bootloader (USART2_RX). Is there any way to rescue my board (except of setting up a complete bootloader programming environment - or is there a simple tool doing it?) Thank you very much for any help Martin2013-08-09 01:53 AM
And why is a problem is PA14 is configured as USART on bootloader? That means you can program your board via USART (aka send mass erase command) which will make your SWD work afterwards.
2013-08-09 02:49 AM
And why is a problem is PA14 is configured as USART on bootloader? That means you can program your board via USART (aka send mass erase command) which will make your SWD work afterwards.
That's correct. To be more detailed: do the BOOT0/BOOT1 trick with a working UART connection to a PC (level shifter ?), then run the Flash Loader Demonstrator software (available from the ST site) to erase the Flash. That should get your MCU accessible again.
2013-08-09 07:43 AM
Hi,
and thanks for the answers. I didn't know about the flash loader tool and I first thought to get along faster, just put it into bootloader mode and reprogram it. Well now I learned how to work with the flash loader tool and my STM32F0 discovery kit is working again. Thanks again Martin2013-08-09 09:46 AM
This UART access in bootloader mode is supported by all STM32 MCUs, and (with differents protocols), by other Cortex M variants, too.
Therefore I suggest to keep this kind of UART hardware in a drawer for the next of those events ...