2025-07-14 2:56 AM - edited 2025-07-14 3:04 AM
I have custom board with STM32C071 micro controller (I used stm32c031 before) and I can't flash it via UART (cant connect in STM32CubeProgrammer).
UART Used - USART1 (PA9/PA10) with auto baud rate (57600)
STM32CubeProgrammer - v2.20.0
Jump to boot loader mode from FW and can confirm it with st-link debug(with empty flash - dont work too).
Flashing via ST-Link works well, but it will not be available when the device is in the case, so i need UART flashing.
When i connect directly to the device and send 0x7f it doesn't respond as it should.
The only suspicion is that the device does not reassign pins from PA11 PA12 to PA9 PA10, since it uses USB on these pins, because STM32C031 on the same board flashing well, it have no USB and doesn't have this problem
STM32CubeProgrammer log:
12:52:33:798 : RTS low
12:52:33:799 : DTR Low
12:52:33:799 : Serial Port ttyUSB2 is successfully opened.
12:52:33:799 : Port configuration: parity = even, baudrate = 57600, data-bit = 8, stop-bit = 1,0, flow-control = off
12:52:33:799 : No Init bits value is : 0
12:52:33:799 : Sending init command:
12:52:33:799 : #byte 0x7F sent successfully to target
12:52:33:799 : Wait ends after 1 loop, dataready = 0, delay = 2002
12:52:33:799 : Timeout error occured while waiting for acknowledgement.
12:52:33:799 : No response from target received
12:52:33:799 : Retrying UART init connection...
12:52:33:799 : #byte 0x7F sent successfully to target
12:52:33:799 : Wait ends after 1 loop, dataready = 0, delay = 100
12:52:33:799 : Timeout error occured while waiting for acknowledgement.
12:52:33:799 : No response from target received
12:52:33:800 : Error: Activating device: KO. Please, verify the boot mode configuration and check the serial port configuration. Reset your device then try again...
12:52:33:813 : UART PORT CLOSE
2025-07-14 3:33 AM
Hello,
Please confirm you have used PA9 PA10 GPIOs for USART1 bootloader and confirm if they are effectively used: do a continuity test. You need to ensure these connections in your hardware + Boot pin = VDD then reset.
2025-07-14 3:46 AM
I am sure of the pins used and their functionality, these same pins were used when the same board had the STM32C031 chip. The fact that loading via UART worked correctly before(с031) hints that the reason is somewhere in the difference between the chip bootloaders.
2025-07-14 3:52 AM
One interesting thing I noticed during debugging when the device was in the bootloader, the UART1 registers had already set the auto baud rate, although no signal had been sent yet.
2025-07-14 6:14 AM
By default, PA9/PA10 are not mapped onto pins so you won't be able to use them for the bootloader.
If you're jumping to the bootloader, it's possible you can remap these before the jump in order for them to work.
2025-07-14 6:20 AM - edited 2025-07-14 7:21 AM
I already tried to remap the pins before going to the bootloader, but it did not give any effect, it cannot connect. The need for remap is questionable since the C031 chip used the same pins that, according to your logic, should have been remapped in advance, but it worked without it.
LL_SYSCFG_EnablePinRemap(LL_SYSCFG_PIN_RMP_PA11);
LL_SYSCFG_EnablePinRemap(LL_SYSCFG_PIN_RMP_PA12);
2025-07-14 6:50 AM - edited 2025-07-14 6:53 AM
Can you provide the full part numbers of the chips you're using?
The C031 doesn't have USB, so the bootloader remaps pins PA11/PA12 to PA9/PA10. This is not the case on C071.
2025-07-14 6:54 AM
At first I used stm32c031g6u6 and it flashed via UART without any problem. Then I changed it to stm32c071g8u6 because I need more flash memory. They have the same board and pin compatibility, but stm32c071g8u6 can't connect to STM32CubeProgrammer via UART.
2025-07-15 3:17 AM
Connected USB to these pins and flashing firmware via USB works correctly, even if you remap the pins before bootloader, flashing via USB still works. How to make UART work on these pins remains a question.
2025-07-15 6:34 AM
Sure sounds like UART is not available on those pins, as they do not get remapped.