Question
STM32G030 BOOT0 Pin not working
I'm currently developing with STM32G030K8T6 (Rev 1.1). I want to use PA14 as BOOT0 pin. So, I set option byte nBOOT_SEL as 0 using STM32CubeProgrammer (nBOOT0, nBOOT1 both option byte are set to 1). But BOOT0 pin not worked. So, I also set PA14 GPIO mode as floating input by HAL using this code
GPIO_InitTypeDef GPIO_InitStruct = {0};
__HAL_RCC_GPIOA_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_14;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);But BOOT0 pin didn't worked too. I tried to change nBOOT_SEL by HAL using this code
FLASH_OBProgramInitTypeDef OBInit;
OBInit.USERType = OB_USER_nBOOT_SEL;
OBInit.USERConfig = OB_BOOT0_FROM_PIN;
OBInit.OptionType = OPTIONBYTE_USER;
if(HAL_FLASH_Unlock() == HAL_OK) {
if(HAL_FLASH_OB_Unlock() == HAL_OK) {
HAL_FLASHEx_OBProgram(&OBInit);
if(HAL_FLASH_OB_Lock() == HAL_OK) {
HAL_FLASH_Lock();
HAL_FLASHEx_OBGetConfig(&OBInit);
if((OBInit.USERConfig & OB_BOOT0_FROM_OB) == OB_BOOT0_FROM_PIN)
{
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_SET);
}
}
}
}and when I executed this code, LED connected on PB3 turned on. But still BOOT0 pin didn't worked. Does anyone know how can I use BOOT0 pin in STM32G030K8T6?
