cancel
Showing results for 
Search instead for 
Did you mean: 

Using UART bootloader on STM32G030J6

DBong.1
Associate II

I am attempting to activate the bootloader mode on the STM32G050J6 (SO8N package). It is unclear to me from the documentation which pins are to be used. Currently, I am using pins 1 and 8 (USART1_RX and USART1_TX in the documentation respectively) as USART pins. Additionally, I am using pin 8 as BOOT0 pin. So what I do is as follows:

  • Short RST to 0V net
  • Short BOOT0 to 3.3V net
  • Connect RX and TX pins to USB to UART adapter
  • Apply power to the board and the adapter at the same time
  • Remove short from RST
  • Remove short from BOOT0 (which is also USART1_TX)

Then when I attempt at activating the bootloader through the STM32CubeProgrammer app, I get an error saying that the program did not receive an acknowledge and the bootloader could not be activated.

Alternatively, I have access to a ST-LINK v2 device. My objective really is to program the micro and be able to use UART, but the UART pins conflict with the SWD pins.

11 REPLIES 11

Hi,

well, to the TSSOP20 it definitely applies. I have to admit, I am not sure, how it works with the bigger packages. With the native PA9/PA10 it should work and maybe also with those remapped (but this is not validated answer, just my guess). Anyway I would recommend to use native ones or preferably USART2 on PA2/PA3, which are available on bigger packages.

Have a nice day.

Clear nBOOT_SEL bit in OPTION to enable BOOT pin, here is code for first upload:

#include "stm32g030xx.h"
 
// clear OPTION.nBOOT_SEL bit
int main(){
	// check if nBOOT_SEL bit is set
	if(FLASH->OPTR & FLASH_OPTR_nBOOT_SEL){
		// unlock flash/option
		FLASH->KEYR    = 0x45670123;
		FLASH->KEYR    = 0xCDEF89AB;
		FLASH->OPTKEYR = 0x08192A3B;
		FLASH->OPTKEYR = 0x4C5D6E7F;
 
		while(FLASH->SR & FLASH_SR_BSY1);
 
		// clear nBOOT_SEL bit
		FLASH->OPTR &= ~FLASH_OPTR_nBOOT_SEL;
 
		// write
		FLASH->CR   |= FLASH_CR_OPTSTRT;
		while(FLASH->SR & FLASH_SR_BSY1);
	}
 
	while(1);
 
	return 0;
}