2019-03-14 05:29 AM
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.
Solved! Go to Solution.
2019-03-14 05:34 AM
I don't see PB6/PB7 listed as usable pins
2019-03-14 05:34 AM
I don't see PB6/PB7 listed as usable pins
2019-03-14 06:05 AM
@Community member I missed that part. Thank you so much for bringing it to my notice.