cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L432KC Internal bootloader issue

soorajav95
Associate

I am trying to access the STM32L432KC internal bootloader through BOOT0(PH3) pin. 

Option bytes are set as - 0x0FFFF8AA

ie.

nSWBOOT0 = 1

nBOOT1 = 1

BOR_LEV  = 000

RDP(Read protection level) = 0xAA (read protection inactive)

This is how option bytes are configured in the code---

/* Unlock Flash CR register */
  if(HAL_FLASH_Unlock() == HAL_OK)
  {
	  /* Unlock Options Byte Register */
	  if(HAL_FLASH_OB_Unlock() == HAL_OK)
	  {
		  /* Set nSWBOOT0 pin so that BOOT0 taken from PH3/BOOT0 pin */
		   SET_BIT(FLASH->OPTR, FLASH_OPTR_nSWBOOT0);
		  /* Settting nBOOT1 bit */ 
		   SET_BIT(FLASH->OPTR, FLASH_OPTR_nBOOT1);
		  /* Setting the Options Start bit OPTSTRT */ 
		   SET_BIT(FLASH->CR, FLASH_CR_OPTSTRT);
		  /* Wait for last operation to be completed */
		   FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE);
		   if(HAL_FLASH_OB_Lock() == HAL_OK)
		   {
			   HAL_FLASH_Lock(); 
			   HAL_FLASH_OB_Launch(); 
		   }
	  }
  }

On debugging, option bytes are found to be modified according to the above settings.  

On chip reset, with PH3 = HIGH, the control does not go to the application code in the flash memory but does not respond to bootloader commands(0x7F) too.

I also tried Flash loader demonstrator software, which is also not able to communicate with the board.

UART lines are taken through PB6(Tx) and PB7(Rx) pins.

Baudrate used to communicate with bootloader - 9600, parity - even, data bits - 8.

Can anybody kindly suggest what I might be missing or what I am doing wrong in the above procedure?

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
2 REPLIES 2

@Community member​ I missed that part. Thank you so much for bringing it to my notice.