diff --git a/src/flash/nor/nrf51.c b/src/flash/nor/nrf51.c index 8b6a57fb8..bfa199a2f 100644 --- a/src/flash/nor/nrf51.c +++ b/src/flash/nor/nrf51.c @@ -581,6 +581,12 @@ static int nrf51_erase_page(struct flash_bank *bank, } if ((ppfc & 0xFF) == 0xFF) { + /* We can't erase the UICR. Double-check to + see if it's already erased before complaining. */ + default_flash_blank_check(bank); + if (sector->is_erased == 1) + return ERROR_OK; + LOG_ERROR("The chip was not pre-programmed with SoftDevice stack and UICR cannot be erased separately. Please issue mass erase before trying to write to this region"); return ERROR_FAIL; };