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
  • Hello, 

    The error message Flash Download Failed - "Cortex-M4" usually indicates that the SoftDevice is present on the device. Checking the Erase Full Chip does not work in Keil. Ref. similar case.

    Please erase your device using the Programmer app in nRF Connect for Desktop or issuing the command

     nrfjprog --eraseall


    Let me know how that works for you.

    Kind regards,
    Øyvind

  • Both of those options require a Jlink.  Is there any option for use with a Ulink?

  • cyberzl1 said:
    nrfjprog --eraseall
    ERROR: There is no debugger connected to the PC.

     Thank you. This will help to find a solution with our nRF5x Command Line Tools team. 

    cyberzl1 said:
    How do I determine the SDK version?

    I assumed that you have an SDK that you are working with? If not,  what are you trying to program along with the SoftDevice? This is to replicate the issue.  

    cyberzl1 said:
    I would still like to resolve how to do this with a ULink if possible.

    Yes, we will find a solution to this.

    Kind regards,

    Øyvind

  • In regards to the SDK question, does the listed API help to answer that question?

    If not, as to what I am trying to program for an application after SoftDevice, our team (at another office) has developed an application that I am trying to help with testing on.  Their office has JLink devices, where I only have ULink at my disposal.  They did have a spare JLink that has been sent over but is still in our mail system at this time.

    This hex could be shared if that is needed, but not on this public forum.

  • In regards to the SDK question, does the listed API help to answer that question?

    No, not that I can see. But it does not matter. I have asked our team to test with a Ulink and see if there are any solutions. nRFJProg does only support Segger.

    This hex could be shared if that is needed, but not on this public forum.

    No need yet.

    I'll keep you posted.

    Kind regards,
    Øyvind

  • 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?

Reply
  • 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?

Children
Related