2024-06-04 09:17 AM
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
After RDP regression i can se that the unprotected flash are is erase:
But not the protected one:
I can also not change the option bytes anymore, even RDP0 to RDP1 does not work
How can i recover from this situation ?
Solved! Go to Solution.
2024-06-06 05:28 AM - edited 2024-06-06 05:30 AM
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
2024-12-06 09:16 PM
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.
Step 4: Go to Option bytes
Step 5: Check the SPRMOD
Step 6: Successfully Enable the flash protection
Disable the SPRMOD:
Step 1: MCU has RESET switch (SW 1). Press the Switch (Hardware Reset Switch)
Step 2: Disconnect the ST_Link
Step 3: Change the Mode to Under reset and Change the Reset mode to Hardware reset.
Step 4: After Connect the MCU via ST_Link
Step 5: Change the RDP from AA to BB
Step 6: Click Apply
Step 6: Change RDP to AA and Uncheck the SPRMOD
Step 7: Click Apply
Step 8: Finally Disconnect and Connect the MCU for checking process.