Page 1 of 1

Clearing the security bit programmatically on a SAM4E

Posted: Tue Nov 29, 2016 5:17 am
by hraftery
Looks like I've tricked myself into thinking a Flash Erase All is equivalent to asserting the ERASE pin in so far as clearing the security bit goes. It's clear that the only way to clear the security bit is to erase the Flash, but it is not clear whether this can be done programmatically.

Has anyone found a way? I can happily perform the erase all while executing from RAM, reprogram the boot mode bit in GPNVM and perform a software reset, but when the MCU reboots it is unresponsive. Only physically asserting the ERASE bit brings it back to life.

I tried changing the ERASE pin to GPIO and asserting it that way to no avail. Has anyone tried driving the ERASE pin with a different GPIO pin?

FWIW, the issue I'm trying to solve is firmware upgrades in the field. For security reasons our release image sets the security bit, and the ERASE pin is not easily accessible. The idea was to have a PIN-protected function in the firmware which would perform the Flase Erase followed by a reboot into sam-ba, ready for re-flashing via the UART (which is easily accessible).