How to enter UART bootloader on STM32G030K6T6?
I'm trying to activate the UART bootloader after receiving input (from either a button press or from parsing a command from UART interrupt). I see from the G030x programming manual that to do so, I must set bits of the FLASH_OPTR register as nBOOT1 = 1, nBOOT_SEL = 1, and nBOOT0 = 0. The value of the boot0 pin shouldn't matter. I do this by using the following code (and HAL libraries):
SET_BIT(FLASH->OPTR, FLASH_OPTR_nBOOT1_Msk);
SET_BIT(FLASH->OPTR, FLASH_OPTR_nBOOT_SEL_Msk);
CLEAR_BIT(FLASH->OPTR, FLASH_OPTR_nBOOT0_Msk);
HAL_NVIC_SystemReset();After reset, my board resets GPIO outputs and seems to reset, but I'm not able to connect to it and program it through the UART bootloader. I am attempting to use the stm32flash tool since I am using Mac and can't run the official STM32Flasher utility.
Is this way of setting the bits correct, is the reset the correct way to enter the boot mode, or is there something else I am missing? Several sources mentioned the boot_lock bits, but from my research those bits only apply to the G0x1 MCUs...
Thanks
