2020-04-22 09:18 AM
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:
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.
2020-04-24 08:19 AM
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.
2022-06-18 11:07 PM
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;
}