2025-08-22 7:17 AM - last edited on 2025-08-22 7:27 AM by mƎALLEm
Hi
I modified nBOOT_SEL Bit, but still the PA14-BOOT0 Pin level has no effect. The CPU starts always on in Main flash memory. I have these 2 situations (RM0490 Rev 5 page 53)
If PA14 is low level: Main flash starts. This is ok
If PA14 has high level: System memory (Internal Bootloader) should start. This is not working. Always application on flash memory starts.
This is the Flash_OPTR content:
This is the board schematic:
J13 is JTAG: this is working
J12 is access to serial USART loader. RX and TX is connected to PA9/PA10.
J12 serial loader is working in case flash is empty.
This is the routine for modify the Option Byte:
HAL_StatusTypeDef ClearnBootSel()
{
FLASH_OBProgramInitTypeDef OB;
HAL_FLASHEx_OBGetConfig(&OB);
/* OB.USERConfig returns the FLASH_OPTR register */
// Use it to check if OB programming is necessary
if (OB.USERConfig & FLASH_OPTR_nBOOT_SEL)
{
HAL_FLASH_Unlock();
HAL_FLASH_OB_Unlock();
OB.OptionType = OPTIONBYTE_USER;
OB.USERType = OB_USER_NBOOT_SEL;
OB.USERConfig = OB_BOOT0_FROM_PIN;
if ( HAL_FLASHEx_OBProgram(&OB) != HAL_OK )
{
HAL_FLASH_OB_Lock();
HAL_FLASH_Lock();
return HAL_ERROR;
}
HAL_FLASH_OB_Launch();
/* We should not make it past the Launch, so lock
* flash memory and return an error from function
*/
HAL_FLASH_OB_Lock();
HAL_FLASH_Lock();
return HAL_ERROR;
}
return HAL_OK;
}
Where is the problem?
Thanks for hints.
Franz
2025-08-22 8:26 AM
Your BOOT0 pin is connected to various things. Perhaps one of these is pulling it low.
The chip itself is likely behaving as described. Option bytes seem set appropriately.
2025-08-22 8:39 AM
I tried also with direct connection of PA14 to GND and to 3.3V. Same issue. And levels are in green range.