Search code examples
stm32nucleostm32f0

STM32F103C8T6 board not flashing with Keil 5


I have the following problem. Once i generate Keil project using ST CubeMX and write project into STM32F103C8 MCU, everything goes well; However, after this first flashing i'am not able to flash it anymore as it throws the following error:

Error: Flash Download failed  -  Target DLL has been cancelled

I have pulled Boot0 pin, activated it, and erased MCU. This procedure helps only for one time flashing; however, if i flash MCU with bare metal or CMSIS code (which was not generated by CubeMX) it works fine and i can flash as many times as i want without errors. Could you please advice, what could be wrong and how can i fix this?


Solution

  • Problem was in default configuration of STM CubeMx. In System core -> Sys Debug was switched off by default. After i changed it to Serial Wire it worked. enter image description here