2640 - MACHXO2: How can we recover the device from "Failed to verify the ID" when device ID is messed up?

2640 - MACHXO2: How can we recover the device from "Failed to verify the ID" when device ID is messed up?

The Device ID is always retrievable using the JTAG port. 

If, as in this case, you get the error: "Failed to verify the ID: Expected: 0x012BB043 Read: E4E4E4E4" (or some other value), try the following to recover the device.

When Device ID reports the wrong value, it may be from an inadvertent activation of the 'My ASSP' feature of the MachXO2.  This is set in the Feature Row (FR), both the enable and the value. The One-Time-Programmable (OTP) protection bits are also located in the Feature Row.  As we don't know what was done to set the 'My ASSP' feature, there exists the possibility that one or more OTP bits have also been set.   If the OTP bits are set, the device is not recoverable.

For the solution, let's assume no OTP bits are set. You will need to use the Lattice ispVM System tool (not Diamond Programmer), available for free download from our website:
You need to install ispLEVER Classic Software for ispVM tool ,as ispVM is integral part of ispLEVER Classic.

To recover the device, the FR must be erased. In ispVM, you can set the tool to ignore errors e.g. Device ID mismatch:
Project menu -> Project Settings -> check "Continue Download Even on Error"

Set the operation to 'Flash Programming Mode' and 'FLASH Erase Only' and click 'Go' to Erase the device as normal.  Click OK on any errors that occur to continue.

At this point you should have a device that reads back the correct Device ID and can be reprogrammed. If not, the OTP bits were set and the device is not recoverable.