writing into UICR OTP of APP core with nrfprog fails on nrf5340

I try to write data into the OTP section of the APP core with the following command line:

nrfjprog.exe -f nrf53 --program 'OTP.ihex'

ouput:

[error] [SeggerBackend] - JLinkARM.dll reported error -256 at line 736.
[error] [SeggerBackend] - JLinkARM.dll reported error -256 at line 629.
[error] [SeggerBackend] - JLinkARM.dll reported error -256 at line 3139.
[error] [SeggerBackend] - JLinkARM.dll reported error -256 at line 911.
[error] [SeggerBackend] - JLinkARM.dll reported error -256 at line 3139.
[error] [SeggerBackend] - JLinkARM.dll reported error -256 at line 3139.
[error] [SeggerBackend] - JLinkARM.dll reported error -256 at line 3139.
[error] [SeggerBackend] - JLinkARM.dll reported error -256 at line 3087.
[error] [SeggerBackend] - JLinkARM.dll reported error -256 at line 3112.
[error] [SeggerBackend] - JLinkARM.dll reported error -256 at line 3349.
[error] [SeggerBackend] - JLinkARM.dll reported error -256 at line 3160.
[error] [SeggerBackend] - JLinkARM.dll reported error -256 at line 3176.
[ #################### ] 0.116s | Program file - Done programming
WARNING: A programming operation has been performed without --verify.
WARNING: Programming can fail without error.

If I use Ozone to display the written content in a memory window I can see the data written to the OTP memory. But if I perform a power cycle the OTP section is empty again.

I also tried to use the following command for tests: nrfjprog -f nrf53 --memwr 0x00FF8100 --val 0x7E75

the same problem here: cells are empty after power cycle.

Initially I tried to use JFlash without success. This resulted in an error message even if I enable the OTP bank and disable all others

Any Hints how I can write the OTP section permanently?

  • I just recognized that I used the command "nrfprog" by accident to write the hex file ... Face palm

    If I try the same using "nrfutil" the problem still exists: after power cycle the memory section seems to be empty again. I haven't found a way to get a permanently written OTP section with nrfutil.

    Currently the solution with nrfprog is good enough for me, but for completeness I would like to mention my observation using nrfutil.

    here is what I have done:

    build\app> nrfutil.exe device program --traits jlink --firmware 'OTP.hex' --options verify=VERIFY_READ
    [00:00:00] ###### 100% [3/3 504401838] Programmed
    
    build\app> nrfutil.exe device read --address 0x00FF8100                                                                             
    504401838
    0x00FF8100: DA7A7E75                              |u~z.|
    
    ----- power cycle --------
    
    build\app> nrfutil.exe device read --address 0x00FF8100
    Error: One or more read memory tasks failed:
     * 504401838: Failed to attach to target: The Application core access port is protected (All) (NotAvailableBecauseProtection)
    
    
    The operation was unavailable for some of the devices because they had readback protection enabled. These devices might be possible to unlock using the `recover` subcommand. See `nrfutil device recover --help` for more information.

    connecting the device with ozone has shown that the OTP seems empty again after power cycle.

  • Hi,

     

    Robert said:

    If I try the same using "nrfutil" the problem still exists: after power cycle the memory section seems to be empty again. I haven't found a way to get a permanently written OTP section with nrfutil.

    The devices are not empty, they are readback protected. This happens when the firmware running on your device does not open up the access port.

     

    If you flash your device with a firmware first, then write to UICR; this should not happen.

    However, if your "OTP.hex" overwrites/overlaps with the firmware already loaded onto the nRF, this will cause similar behaviour, and it will need to be recovered.

    Robert said:
    connecting the device with ozone has shown that the OTP seems empty again after power cycle.

    Ozone and other JLink software, will detect that your device is protected and provide a pop-up asking if you would like to recover the device by issuing an erase operation.

    This will then erase UICR again, similar to nrfjprog --recover and nrfutil device recover.

     

    Kind regards,

    Håkon

Related