Unlocking

Sometimes a user error may result in a device becoming locked. When a device is locked, it’s memory cannot be written to, nor can it’s memory be read from. This is a security feature in many MCUs.

This module provides functions for unlocking a locked device.

Note

Unlocking a device results in a mass-erase. Do not unlock a device if you do not want it be erased.

pylink.unlockers.unlock(jlink, name)

Unlocks a J-Link’s target device.

Parameters:
  • jlink (JLink) – the connected J-Link device
  • name (str) – the MCU name (e.g. Kinetis)
Supported Names:
  • Kinetis
Returns:True if the device was unlocked, otherwise False.
Raises:NotImplementedError – if no unlock method exists for the MCU.
pylink.unlockers.unlock_kinetis.unlock_kinetis(*args, **kwargs)

Unlock for Freescale Kinetis K40 or K60 device.

Parameters:jlink (JLink) – an instance of a J-Link that is connected to a target.
Returns:True if the device was successfully unlocked, otherwise False.
Raises:ValueError – if the J-Link is not connected to a target.