AnsweredAssumed Answered

STM32F7 read out protection hangs out

Question asked by devcal on Aug 17, 2016
Latest reply on Sep 7, 2016 by armitt.paul


I'm implementing the read out protection for the F746 controller.

Changing it from level0 to level1 at the first start from my code.

First I realised that the level1 was setted but not saved after a power cycle. Then I realised that the HAL_libraries had an error
by modifying  the OPTCR register. Because the level was writen to the first byte address of the register and not the second one. I solved this by just replacing the HAL_libraries with the new ones (V1.1.0 / 22-April-2016) .

Now it works. The problem is that it hangs out after setting the OPTSTRT bit in OPTCR register.

After a power cycle the level is set to 1.

My problem is that even if I do a system reset by calling NVIC_SystemReset() after HAL_FLASH_OB_Launch() I will never get there since my code was interrupted and does not come back.

This is the content of my stack by the error:

02.<signal handler called>() at 0xfffffff1
03.UART5_IRQHandler() at uart.c:1.885 0x8000a10  
04.<signal handler called>() at 0xfffffff9  
05.OS_GetTime_ms() at OS.c:179 0x80053a6  
06.HAL_FLASH_WaitForLastOperation() at flash.c:123 0x8001784  
07.HAL_FLASH_OB_Launch() at flash.c:123 0x8001984  
08.FLASH_SetReadProtectionL1() at flash.c:458 0x8001c28  
09.SerialCmd_Test() at commandlib.c:90 0x8003608  
10.main() at main.c:163 0x80056f8

The content of my function FLASH_SetReadProtectionL1() is this:

HAL_StatusTypeDef FLASH_SetReadProtectionL1(void){
     HAL_StatusTypeDef status = HAL_ERROR;
     status = HAL_FLASH_OB_RDP_LevelConfig(OB_RDP_LEVEL_1);
     if(status == HAL_OK){
         status = HAL_FLASH_OB_Launch();  
 // not working since HAL_FLASH_OB_Launch() does not return
     return status;

does any one has an idea why this is happening?

Best regartds