2023-12-10 07:18 AM
I always get an error after burning the hex file to STM32F302R8. The burning is completed through STM32 ST-LINK Utility. Below is the error log.
16:05:15 : ST-LINK SN : 0664FF515570514867174448
16:05:15 : V2J33M25
16:05:15 : Connected via SWD.
16:05:15 : SWD Frequency = 4,0 MHz.
16:05:15 : Connection mode : Connect Under Reset.
16:05:15 : Debug in Low Power mode enabled.
16:05:16 : Device ID:0x439
16:05:16 : Device flash Size : 64KBytes
16:05:16 : Device family :STM32F301x4-x6-x8/F302x4-x6-x8/F318xx
16:05:23 : Memory programmed in 1s and 594ms.
16:05:23 : Disconnected from device.
16:05:23 : Connection to device is lost: check power supply and debug connection.
16:05:23 : If the target is in low power mode, please enable "Debug in Low Power mode" option from Target->settings menu.
2023-12-10 07:20 AM
Complete error log after trying again.
16:19:29 : ST-LINK SN : 0664FF515570514867174448
16:19:29 : V2J37M26
16:19:29 : Connected via SWD.
16:19:29 : SWD Frequency = 4,0 MHz.
16:19:29 : Connection mode : Connect Under Reset.
16:19:29 : Debug in Low Power mode enabled.
16:19:29 : Device ID:0x439
16:19:29 : Device flash Size : 64KBytes
16:19:29 : Device family :STM32F301x4-x6-x8/F302x4-x6-x8/F318xx
16:19:38 : [stm32motor.hex] opened successfully.
16:19:38 : [stm32motor.hex] checksum : 0x00296C2E
16:19:45 : Memory programmed in 1s and 703ms.
16:19:45 : Verification...OK
16:19:45 : Programmed memory Checksum: 0x00296C2E
16:19:46 : Disconnected from device.
16:19:46 : Connection to device is lost: check power supply and debug connection.
16:19:46 : If the target is in low power mode, please enable "Debug in Low Power mode" option from Target->settings menu.
2023-12-10 07:27 AM
So probably something in your code explicitly disabling the debug interface, reconfiguring the the PA13/PA14 pins associated with the connection, or powering down the circuitry that connects.
Watch external clock vs HSE_VALUE definition, or setting clocks or PLL's beyond operating ranges.
2023-12-10 07:28 AM
Does your program enter low power mode or repurpose the SWD pins? Either of those will produce this result.