Hi @LewisThin
Did you enables CSE? If yes, mass erase will not work, just in the case that the key is configured as write-protected.
If you can't establish connection via JTAG/SWD anymore and there is no code in the flash that could do that, the device is bricked.
B.R.
VaneB