2025-04-14 3:46 AM
Hello ST Community,
I am currently working on programming an STM32G070RBT6 via UART using an FTDI interface connected to my PC via USB. Initially, the STM32 CUBE programmer successfully uploads the program once, but subsequent attempts to upload fail. In order to upload the program again, I need to connect via SWD, erase the full flash using the ST-Link utility, and then I can upload the program.
Here’s what I’ve verified so far:
The boot pin is high.
The nRESET pin is functioning as expected (goes low when pressed).
code:
HAL_GPIO_WritePin(TEST_GPIO_Port,TEST_Pin,GPIO_PIN_SET);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_SET);
HAL_Delay(500);
HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_RESET);
HAL_Delay(500);
}
/* USER CODE END 3 */
}
To troubleshoot, I have tested two different hex files for a simple LED blinking program:
One with the Serial Wire Port defined.
One without the Serial Wire Port defined.
Has anyone encountered a similar issue or could offer guidance on what might be causing this behavior? Any suggestions or advice would be greatly appreciated.
log file with logs on successful:
15:42:49 : STM32CubeProgrammer API v2.19.0 | Windows-64Bits
15:43:00 : UR connection mode is defined with the HWrst reset mode
15:43:00 : RTS low
15:43:00 : DTR low
15:43:00 : Serial Port COM10 is successfully opened.
15:43:00 : Port configuration: parity = even, baudrate = 115200, data-bit = 8, stop-bit = 1.0, flow-control = off
15:43:00 : Activating device: OK
15:43:00 : Board : --
15:43:00 : Chip ID: 0x460
15:43:00 : BootLoader protocol version: 3.1
15:43:05 : UPLOADING OPTION BYTES DATA ...
15:43:05 : Bank : 0x00
15:43:05 : Address : 0x1fff7800
15:43:05 : Size : 52 Bytes
15:43:05 : Bank : 0x01
15:43:05 : Address : 0x1fff7870
15:43:05 : Size : 4 Bytes
15:43:05 : UPLOADING ...
15:43:05 : Size : 1024 Bytes
15:43:05 : Address : 0x8000000
15:43:05 : Read progress:
15:43:06 : Data read successfully
15:43:06 : Time elapsed during the read operation is: 00:00:01.226
15:43:28 : MASS ERASE ...
15:43:28 : Mass erase command correctly executed.Note: if there's any flash protection, it will not be erased.
15:43:30 : UPLOADING ...
15:43:30 : Size : 1024 Bytes
15:43:30 : Address : 0x8000000
15:43:30 : Read progress:
15:43:31 : Data read successfully
15:43:31 : Time elapsed during the read operation is: 00:00:01.226
15:43:40 : Opening and parsing file: led-blink.hex
15:43:40 : Memory Programming ...
15:43:40 : File : led-blink.hex
15:43:40 : Size : 3.39 KB
15:43:40 : Address : 0x08000000
15:43:40 : Erasing memory corresponding to sector 0:
15:43:40 : Erasing internal memory sectors [0 1]
15:43:40 : Download in Progress:
15:43:41 : File download complete
15:43:41 : Time elapsed during download operation: 00:00:00.482
15:43:49 : Disconnected from device.
15:44:27 : UR connection mode is defined with the HWrst reset mode
15:44:27 : RTS low
15:44:27 : DTR low
15:44:27 : Serial Port COM10 is successfully opened.
15:44:27 : Port configuration: parity = even, baudrate = 115200, data-bit = 8, stop-bit = 1.0, flow-control = off
15:44:31 : Timeout error occured while waiting for acknowledgement.
15:44:31 : Error: Activating device: KO. Please, verify the boot mode configuration and check the serial port configuration. Reset your device then try again...
15:46:12 : UR connection mode is defined with the HWrst reset mode
15:46:12 : RTS low
15:46:12 : DTR low
15:46:12 : Error: Cannot open port COM10, it may be used by another application or port name is invalid.
15:46:23 : UR connection mode is defined with the HWrst reset mode
15:46:23 : RTS low
15:46:23 : DTR low
15:46:26 : Serial Port COM10 is successfully opened.
15:46:26 : Port configuration: parity = even, baudrate = 115200, data-bit = 8, stop-bit = 1.0, flow-control = off
15:46:30 : Timeout error occured while waiting for acknowledgement.
15:46:30 : Error: Activating device: KO. Please, verify the boot mode configuration and check the serial port configuration. Reset your device then try again...
15:47:10 : UR connection mode is defined with the HWrst reset mode
15:47:10 : RTS low
15:47:10 : DTR low
15:47:14 : Serial Port COM10 is successfully opened.
15:47:14 : Port configuration: parity = even, baudrate = 115200, data-bit = 8, stop-bit = 1.0, flow-control = off
15:47:14 : Activating device: OK
15:47:14 : Board : --
15:47:14 : Chip ID: 0x460
15:47:14 : BootLoader protocol version: 3.1
15:47:16 : UPLOADING OPTION BYTES DATA ...
15:47:16 : Bank : 0x00
15:47:16 : Address : 0x1fff7800
15:47:16 : Size : 52 Bytes
15:47:16 : Bank : 0x01
15:47:16 : Address : 0x1fff7870
15:47:16 : Size : 4 Bytes
15:47:16 : UPLOADING ...
15:47:16 : Size : 1024 Bytes
15:47:16 : Address : 0x8000000
15:47:16 : Read progress:
15:47:18 : Data read successfully
15:47:18 : Time elapsed during the read operation is: 00:00:01.226
15:47:28 : Opening and parsing file: led-blink.hex
15:47:28 : Memory Programming ...
15:47:28 : File : led-blink.hex
15:47:28 : Size : 3.39 KB
15:47:28 : Address : 0x08000000
15:47:28 : Erasing memory corresponding to sector 0:
15:47:28 : Erasing internal memory sectors [0 1]
15:47:28 : Download in Progress:
15:47:28 : File download complete
15:47:28 : Time elapsed during download operation: 00:00:00.486
log file with unsuccessful events
15:42:49 : STM32CubeProgrammer API v2.19.0 | Windows-64Bits
15:43:00 : UR connection mode is defined with the HWrst reset mode
15:43:00 : RTS low
15:43:00 : DTR low
15:43:00 : Serial Port COM10 is successfully opened.
15:43:00 : Port configuration: parity = even, baudrate = 115200, data-bit = 8, stop-bit = 1.0, flow-control = off
15:43:00 : Activating device: OK
15:43:00 : Board : --
15:43:00 : Chip ID: 0x460
15:43:00 : BootLoader protocol version: 3.1
15:43:05 : UPLOADING OPTION BYTES DATA ...
15:43:05 : Bank : 0x00
15:43:05 : Address : 0x1fff7800
15:43:05 : Size : 52 Bytes
15:43:05 : Bank : 0x01
15:43:05 : Address : 0x1fff7870
15:43:05 : Size : 4 Bytes
15:43:05 : UPLOADING ...
15:43:05 : Size : 1024 Bytes
15:43:05 : Address : 0x8000000
15:43:05 : Read progress:
15:43:06 : Data read successfully
15:43:06 : Time elapsed during the read operation is: 00:00:01.226
15:43:28 : MASS ERASE ...
15:43:28 : Mass erase command correctly executed.Note: if there's any flash protection, it will not be erased.
15:43:30 : UPLOADING ...
15:43:30 : Size : 1024 Bytes
15:43:30 : Address : 0x8000000
15:43:30 : Read progress:
15:43:31 : Data read successfully
15:43:31 : Time elapsed during the read operation is: 00:00:01.226
15:43:40 : Opening and parsing file: led-blink.hex
15:43:40 : Memory Programming ...
15:43:40 : File : led-blink.hex
15:43:40 : Size : 3.39 KB
15:43:40 : Address : 0x08000000
15:43:40 : Erasing memory corresponding to sector 0:
15:43:40 : Erasing internal memory sectors [0 1]
15:43:40 : Download in Progress:
15:43:41 : File download complete
15:43:41 : Time elapsed during download operation: 00:00:00.482
15:43:49 : Disconnected from device.
15:44:27 : UR connection mode is defined with the HWrst reset mode
15:44:27 : RTS low
15:44:27 : DTR low
15:44:27 : Serial Port COM10 is successfully opened.
15:44:27 : Port configuration: parity = even, baudrate = 115200, data-bit = 8, stop-bit = 1.0, flow-control = off
15:44:31 : Timeout error occured while waiting for acknowledgement.
15:44:31 : Error: Activating device: KO. Please, verify the boot mode configuration and check the serial port configuration. Reset your device then try again...
15:46:12 : UR connection mode is defined with the HWrst reset mode
15:46:12 : RTS low
15:46:12 : DTR low
15:46:12 : Error: Cannot open port COM10, it may be used by another application or port name is invalid.
15:46:23 : UR connection mode is defined with the HWrst reset mode
15:46:23 : RTS low
15:46:23 : DTR low
15:46:26 : Serial Port COM10 is successfully opened.
15:46:26 : Port configuration: parity = even, baudrate = 115200, data-bit = 8, stop-bit = 1.0, flow-control = off
15:46:30 : Timeout error occured while waiting for acknowledgement.
15:46:30 : Error: Activating device: KO. Please, verify the boot mode configuration and check the serial port configuration. Reset your device then try again...
15:47:10 : UR connection mode is defined with the HWrst reset mode
15:47:10 : RTS low
15:47:10 : DTR low
15:47:14 : Serial Port COM10 is successfully opened.
15:47:14 : Port configuration: parity = even, baudrate = 115200, data-bit = 8, stop-bit = 1.0, flow-control = off
15:47:14 : Activating device: OK
15:47:14 : Board : --
15:47:14 : Chip ID: 0x460
15:47:14 : BootLoader protocol version: 3.1
15:47:16 : UPLOADING OPTION BYTES DATA ...
15:47:16 : Bank : 0x00
15:47:16 : Address : 0x1fff7800
15:47:16 : Size : 52 Bytes
15:47:16 : Bank : 0x01
15:47:16 : Address : 0x1fff7870
15:47:16 : Size : 4 Bytes
15:47:16 : UPLOADING ...
15:47:16 : Size : 1024 Bytes
15:47:16 : Address : 0x8000000
15:47:16 : Read progress:
15:47:18 : Data read successfully
15:47:18 : Time elapsed during the read operation is: 00:00:01.226
15:47:28 : Opening and parsing file: led-blink.hex
15:47:28 : Memory Programming ...
15:47:28 : File : led-blink.hex
15:47:28 : Size : 3.39 KB
15:47:28 : Address : 0x08000000
15:47:28 : Erasing memory corresponding to sector 0:
15:47:28 : Erasing internal memory sectors [0 1]
15:47:28 : Download in Progress:
15:47:28 : File download complete
15:47:28 : Time elapsed during download operation: 00:00:00.486
16:11:08 : Disconnected from device.
16:11:18 : UR connection mode is defined with the HWrst reset mode
16:11:18 : RTS low
16:11:18 : DTR low
16:11:19 : Serial Port COM10 is successfully opened.
16:11:19 : Port configuration: parity = even, baudrate = 115200, data-bit = 8, stop-bit = 1.0, flow-control = off
16:11:21 : Timeout error occured while waiting for acknowledgement.
16:11:21 : Error: Activating device: KO. Please, verify the boot mode configuration and check the serial port configuration. Reset your device then try again...
Thank you in advance for your assistance!
2025-04-14 7:52 AM
Hello @yash_sangale
Could you performe a power cycle (turning the power off and then on) before the seconde upload.
2025-04-14 9:32 PM
Also tried that, still same conclusion controller is not responding to sent command by stm32cube programmer, I am currently doubting that when flashed is erased, controller enters UART Boot mode , then after that it is not.