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