A method for erasing a non-volatile memory (NVM 14), comprising: performing an erase operation on a portion of the non-volatile memory (NVM 14), using a first set of parameters; determining whether each cell in the portion of the non-volatile memory (NVM 14) passes a first margin level; if each cell in the portion of the non-volatile memory (NVM 14) does not pass the first margin level: determining (90, 94) an amount of departure in an actual value of at least one parameter associated with the erase operation from a target value of the at least one parameter for each cell in the portion of the NVM; determining a maximum amount of departure in the actual value of the at least one parameter associated with the erase operation in the portion of the NVM from the amount of departure in the actual value of the at least one parameter associated with the erase operation from the target value of the at least one parameter for each cell in the portion of the NVM; modifying a subsequent erase operation (92, 96) for the portion of the non-volatile memory (NVM 14), based on the maximum amount of departure in the actual value of the at least one parameter; performing a subsequent erase operation (92, 96) on the portion of the non-volatile memory (NVM 14); and determining whether each cell in the portion of the non-volatile memory (NVM 14) passes the first margin level after performing the subsequent erase operation; performing the erase operation on a next portion of the non-volatile memory (NVM 14), if each cell in the portion of the non-volatile memory (NVM 14) passes the first margin level. performing an erase operation on a portion of the non-volatile memory (NVM 14), using a first set of parameters; determining whether each cell in the portion of the non-volatile memory (NVM 14) passes a first margin level; if each cell in the portion of the non-volatile memory (NVM 14) does not pass the first margin level: determining (90, 94) an amount of departure in an actual value of at least one parameter associated with the erase operation from a target value of the at least one parameter for each cell in the portion of the NVM; determining a maximum amount of departure in the actual value of the at least one parameter associated with the erase operation in the portion of the NVM from the amount of departure in the actual value of the at least one parameter associated with the erase operation from the target value of the at least one parameter for each cell in the portion of the NVM; modifying a subsequent erase operation (92, 96) for the portion of the non-volatile memory (NVM 14), based on the maximum amount of departure in the actual value of the at least one parameter; performing a subsequent erase operation (92, 96) on the portion of the non-volatile memory (NVM 14); and determining whether each cell in the portion of the non-volatile memory (NVM 14) passes the first margin level after performing the subsequent erase operation; determining (90, 94) an amount of departure in an actual value of at least one parameter associated with the erase operation from a target value of the at least one parameter for each cell in the portion of the NVM; determining a maximum amount of departure in the actual value of the at least one parameter associated with the erase operation in the portion of the NVM from the amount of departure in the actual value of the at least one parameter associated with the erase operation from the target value of the at least one parameter for each cell in the portion of the NVM; modifying a subsequent erase operation (92, 96) for the portion of the non-volatile memory (NVM 14), based on the maximum amount of departure in the actual value of the at least one parameter; performing a subsequent erase operation (92, 96) on the portion of the non-volatile memory (NVM 14); and determining whether each cell in the portion of the non-volatile memory (NVM 14) passes the first margin level after performing the subsequent erase operation; performing the erase operation on a next portion of the non-volatile memory (NVM 14), if each cell in the portion of the non-volatile memory (NVM 14) passes the first margin level.