pylink
pylink copied to clipboard
How to set or remove read protection of stm32
Hi, When I connect a chip that has read protection set, it will throw an exception,How can I set or remove read protection like jflash?
It should happen automatically if you've specified the device correctly. There are unlock methods, but I've only implemented the unlock sequence for the Kinetis chip family.
Hi: I just fix this problem, the remove need two steps: 1、modify the pylink source code 2、
def unsecure_device_hook(title, msg, flags):
return pylink.enums.JLinkFlags.DLG_BUTTON_YES
...
jlink = pylink.JLink(unsecure_hook=unsecure_device_hook)
...
Whoops, you are correct, we by default specify NO
to unlock automatically.
Hi, I successfully cleared the read protection with @Moral-ecomo method. However, a new problem has arisen. During continuous programming, Once in every two programming, jlink.reset() does not work, but no exception is thrown. Why this problem occurs,and how can I solve it
Which exception is thrown? If you run with logging enabled, you should see more helpful messages:
import logging
logging.basicConfig(level=logging.DEBUG)
Oh. I found the reason: If the read protection is set while the debugger is still connected through JTAG/SWD, apply a POR (power-on reset) instead of a system reset (without debugger connection). So after the second programming, the chip cannot start after reset().