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.
2025-08-25 5:24 AM - edited 2025-08-25 6:12 AM
This is my first project with STM32Cxxx processor. I used in the past 15 years nearly all other STM32 families and I had never this huge problems. It is the first processor I use where Boot 0 is shared with Serial Wire Clock. (Maybe not the best idea)
Problem 1:
Because PA14 is shared with BOOT0 Pin and Serial Wire Clock, we have a new situation in Boot0 reading. If SWD once was active, a reset of CPU will not bring PA14 to his default state: GPIO_IN/BOOT0. Only by removing the full power from CPU will bring back PA14 to his GPIO_IN/BOOT0 state. This was the reason always application was starting up. Because Boot0 was read wrong at startup.
Problem 2:
When I respect problem 1, I can always make the processor not start up the application. I remove full power. I set Boot0 Pin to high level and reset the uP with a low going impulse on nRST Pin.
Sometimes I can program the uP now, but in 90% of the cases the processor is not answering on his TX Pin (PA9)
This is the case serial download is working: blue is the character from Computer. Red is the answer from built in bootloader.
This is the case with a download fail. TX Pin (red) is always low, even with Character on RX Pin. So I think internal bootloader is not running or it is running on a wrong interface.
I'll also tried the newest STM32Programmer V2.20.0. Result same failure rate.
I replaced all my cables between STM32C092 board and USB Port of computer. There is no difference. I'm sure there is no failure of cable and electronic. As standard I use FTDI serial to USB converter. But I have same failure rate with a Prolific serial to USB converter.
I use my tools since longer time. I made a bigger 2 digit number of designs with several STM32 uC. And every design, I implement a serial loader with built in bootloader for the mass production line. This C092 is the first project, on which bootloader is not really working with my proofed tools. I plan another design with STM32G071, and this uP has the same sharing of PA14-Boot0 and SWDCLK. Solution is very important.