Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lowlevel api sector erase may fail silently #30

Open
jmalangoni opened this issue Apr 25, 2023 · 0 comments
Open

lowlevel api sector erase may fail silently #30

jmalangoni opened this issue Apr 25, 2023 · 0 comments

Comments

@jmalangoni
Copy link

jmalangoni commented Apr 25, 2023

I have been using your low-level API to reflash devices for some time now, but recently found that sector erase + programming can fail if the device is not first reset and halted. Not sure if this is due to an update in pynrfjprog, jlink dll, or even the firmware running at the time of reprogramming.

The code below will raise pynrfjprog.APIError.APIError: An error was reported by NRFJPROG DLL: -102 JLINKARM_DLL_ERROR from program_file method

with pynrfjprog.LowLevel.API() as api:
    api.connect_to_emu_without_snr()
    #api.sys_reset()
    #api.halt()
    api.erase_file(img_path, pynrfjprog.LowLevel.EraseAction.ERASE_SECTOR)
    #api.sys_reset()
    #api.halt()
    api.program_file(img_path)
    api.disconnect_from_emu()

Uncommenting only the first set of sys_reset and halt commands will fix the issue and result in successful reflashing.

Uncommenting only the second set of sys_reset and halt commands will cause the reflashing to fail silently.

I assume this is due to failure to sector erase before programming, however I was not expecting the failure to be silent.

Post-reflashing verification with an api.verify_file(img_path) does of course catch the issue.

*pynrfjprog version 10.19.0
*jlink dll version V7.84a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant