This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF52840 Softdevice programming

I would like to program my NRF52840 device using the Keil Ulink2/pro JTAG device.  

I have been able to do a full chip erase using the Keil Ulink 2 device, but when I attempt to program it fails 

Load "..\\SoftDevice\\s140_nrf52_6.0.0_softdevice.hex"
Full Chip Erase Done.
Programming Failed!
Error: Flash Download failed - "Cortex-M4"

I found some references in the Q&A for setting up the nrf tools for a slightly different device to program the UICR registers, but I haven't been able to get that to work with this setup.  It seems to be aware of the UICR registers so I'm not sure if that is the hindrance now or not.

Any guidance would be great.  We do have a Segger Jlink at another office that I am getting sent to me, but in the meantime if I can get this to work with my existing toolset, would be preferred.

Thanks

Parents Reply Children
  • Hello again, 

    A colleague from our tools team tested Ulink in Keil and had no trouble with usage. 

    His solution was to add a preload.ini file under Configure Flash Menu Command. (Project --> Options for Target <Device> --> Utilities). This .ini file had the following:

    Load "<your path>\\s140_nrf52_6.0.0_softdevice.hex"

    Under programming algorithm, you must also add nRF52xxx SoftDevice Erase. This allows you to program or update the softdevice. 

    Please try this solution on your computer, and let me know how it went.

    Kind regards,
    Øyvind

  • So that seems to allow an erase, but causes some issues when trying to program.

    Include "<path>\\ProjectFiles\\Source\\Nrf52840\\pca10056\\ide\\arm5_no_packs\\preload.ini"
    Load "<path>\\SoftDevice\\s140_nrf52_6.0.0_softdevice.hex"
    Full Chip Erase Done.
    Flash Erase finished 10:24:56
    Load "<path>\\ProjectFiles\\Source\\Nrf52840\\pca10056\\ide\\arm5_no_packs\\_build\\nrf52840_xxaa.axf"
    Include "<path>\\ProjectFiles\\Source\\Nrf52840\\pca10056\\ide\\arm5_no_packs\\preload.ini"
    Load "<path>\\SoftDevice\\s140_nrf52_6.0.0_softdevice.hex"
    Erase Failed!
    Error: Flash Download failed - "Cortex-M4"
    Flash Load finished at 10:26:32

    I have my Keil Ulink configured like this:

    Where preload.ini is as you described.  It seems to be pulling this in correctly as can be seen with the load statements.

    Should the programming algorithms be different?

  • Yes, it seems you should remove nRF52xxx, but leave UICR and SoftDevice. 

    -Øyvnd

Related