cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F7 read out protection hangs out

devcal
Associate II
Posted on August 17, 2016 at 12:34

Hi,

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:


0xfffffffe

<signal handler called>() at 
0xfffffff1

UART5_IRQHandler() at uart.c:
1.885
0x8000a10

<signal handler called>() at 
0xfffffff9

OS_GetTime_ms() at OS.c:
179
0x80053a6

HAL_FLASH_WaitForLastOperation() at flash.c:
123
0x8001784

HAL_FLASH_OB_Launch() at flash.c:
123
0x8001984

FLASH_SetReadProtectionL1() at flash.c:
458
0x8001c28

SerialCmd_Test() at commandlib.c:
90
0x8003608

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;
HAL_FLASH_Unlock();
HAL_FLASH_OB_Unlock();
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
//NVIC_SystemReset()
HAL_FLASH_OB_Lock();
HAL_FLASH_Lock();
return
status;
}

does any one has an idea why this is happening?

Best regartds

dev.

#stm32f7-read-protection-rdp
1 REPLY 1
paulpaul9
Associate
Posted on September 07, 2016 at 18:08

Hi,

One point to note is that the STM32F7 will not run with a debugger attached if RDP Level 1 or higher is used.

This can be the case when using a ''discovery'' board having not disabled the ST-Link via jumper SB11

Hope this helps,

Paul