cancel
Showing results for 
Search instead for 
Did you mean: 

PCROP Not disabled after RDP Regression, Option change not possible in RDP0

aco990
Associate III

Hello everyone,

I'm experimenting PCROP activation on stm32h743 following this ST-tutorial: https://youtu.be/7Wr90XFA8_Q?si=tDpqUtMdin9Oyn-P

The activation works fine but i cannot disable PCROP using CubeProgrammer.
I did a RDP1 to RDP0 regression with DMWP1 checked but the PCROP is still active

aco990_0-1717517806630.png


After RDP regression i can se that the unprotected flash are is erase:

aco990_1-1717517520089.png

But not the protected one:

aco990_2-1717517571238.png
I can also not change the option bytes anymore, even RDP0 to RDP1 does not work

aco990_3-1717517635012.png


How can i recover from this situation ?


@Jocelyn RICARD, @Fred 

11 REPLIES 11
aco990
Associate III

Hi @Jocelyn RICARD ,

now PCROP is removed and the device is working fine! :)
If you encounter the same problem a "bank mass erase with automatic protection-removal" as described in the reference manual could help you:

 

__HAL_FLASH_CLEAR_FLAG_BANK1(FLASH_FLAG_ALL_ERRORS_BANK1);
HAL_FLASH_OB_Unlock();

SET_BIT(FLASH->PRAR_PRG1, FLASH_PRAR_DMEP);
uint32_t temp = ~((0xFFF << 0) | (0xFFF << 16));
FLASH->PRAR_PRG1 &= temp;  // Clear bits 11:0 and 27:16
FLASH->PRAR_PRG1 |=  (2 << 0);
FLASH->WPSN_PRG1 = 0xFF;

HAL_FLASH_Unlock();
SET_BIT(FLASH->CR1, FLASH_CR_BER);
SET_BIT(FLASH->CR1, FLASH_CR_START);
while (READ_BIT(FLASH->SR1, FLASH_SR_QW) > 0) {} // Wait for erase completion

 

Meenakshi
Associate III

Enable and Disable the SPRMOD check box 

 

ENABLE the SPRMOD: 

Step1: Connect the MCU via JTAG/SWD 

Step 2: Open the STM32CubeProgrammer or Download the STM32CubeProgram- Link: https://www.st.com/en/development-tools/stm32cubeprog.html 

Step 3: Open STM32CubeProgrammer and press the Connect button. 

Meenakshi_0-1733548444015.png

Step 4: Go to Option bytes 

Meenakshi_1-1733548444023.png

Step 5: Check the SPRMOD 

Meenakshi_2-1733548444026.png

Meenakshi_3-1733548444033.png

Step 6: Successfully Enable the flash protection 

Meenakshi_4-1733548444036.png

Disable the SPRMOD: 

Step 1: MCU has RESET switch (SW 1). Press the Switch (Hardware Reset Switch) 

Meenakshi_5-1733548444041.png

Step 2: Disconnect the ST_Link 

Meenakshi_6-1733548444043.png

Step 3: Change the Mode to Under reset and Change the Reset mode to Hardware reset. 

Meenakshi_7-1733548444046.png

Step 4: After Connect the MCU via ST_Link 

Meenakshi_8-1733548444047.png

Step 5: Change the RDP from AA to BB 

Meenakshi_9-1733548444048.png

Step 6: Click Apply 

Meenakshi_10-1733548444050.png

Step 6: Change RDP to AA and Uncheck the SPRMOD 

Meenakshi_11-1733548444053.png

Step 7: Click Apply 

Meenakshi_12-1733548444054.png

Step 8: Finally Disconnect and Connect the MCU for checking process. 

Meenakshi_13-1733548444057.png