NordicSemiconductor / pynrfjprog

Python wrapper around the nrfjprog dynamic link library (DLL)
Other
74 stars 26 forks source link

NRFJPROG lib cannot find not erased error: "ERROR: The area to write is not erased." #9

Closed adison closed 6 years ago

adison commented 6 years ago

on OSX NRFJPROG lib won't pass "area is not erased error",

$ ./nrfjprog -f nrf52 --memwr 0x1000108c --val 0x12345678
Parsing parameters.
ERROR: The area to write is not erased.
def write(self, addr, data, control):
.......
    result = self._lib.NRFJPROG_write(addr, ctypes.byref(data), data_len, control)
    if result != NrfjprogdllErr.SUCCESS:
            raise APIError(result)
David-Garcia-Polo commented 6 years ago

Why is the error message not valid? Is the address to write erased?

adison commented 6 years ago

The address has to be erased (0xffffffff) for write If it had been written, it cannot be written twice.

David-Garcia-Polo commented 6 years ago

correct

David-Garcia-Polo commented 6 years ago

Are you saying that pynrfjprog write function should work as nrfjprog.exe --memwr option?

adison commented 6 years ago

Ok, then, while I tried to write the "written area", nrfjprog will give error msg, but pynrfjprog didn't

 $ ./nrfjprog -f nrf52 --memwr 0x1000108c --val 0x12345678
Parsing parameters.
ERROR: The area to write is not erased.
David-Garcia-Polo commented 6 years ago

nrfjprog.exe and pynrfjprog.write are different abstraction layers. They work differently.

adison commented 6 years ago

I can understand that, as well it is involved with libnrfjprogdll.dylib. But is it possible to submit a ticket to someone can improve libnrfjprogdll.dylib ?

David-Garcia-Polo commented 6 years ago

I could try to improve the help and documentation to describe the behaviour better, but for reasons that will take too long to explain the behaviour of the functions is not going to change.

adison commented 6 years ago

Said to hear that.. Any alternative solution to know if it failed to write?

David-Garcia-Polo commented 6 years ago

readback the address written and compare.

adison commented 6 years ago

Exactly what I did :p, I think that's it.