STM32F437 option bytes programming hangs
Hi,
On startup my STM32F437 application checks whether JTAG RDP level 1 protection is enabled. If it is not enabled then it enables it, ending with a call to HAL_FLASH_OB_Launch(), which loads option bytes and resets MCU.
This all works fine, except if I load the code from JTAG (using ST-Link or Keil U-LINKPro). In this case HAL_FLASH_OB_Launch() does not restart the MCU, it just seems to hang. If I power-cycle the MCU then the option bytes have been programmed OK.
I have seen a workaround for an STMF466 whereby the code is executed from RAM and put into standby and using WFI to wait for RTC wake-up interrupt (see STM32 Security tips - 4 RDP without POR in STM32F4 (youtube.com)). In my case this does not work. The MCU does not restart. I have also tried relying on the IWDG to timeout and restart. This appears to start the reset process but the MCU does not fully restart.
It seems that a JTAG connected at the time of launching the option bytes, requires a h/w reset to restart the MCU.
Has anyone experienced this problem and have a workaround?
Thanks
