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

Problems programming nRF9160 DK with Segger Embedded Studio

For some reason I can't quite program the nRF9160 on the development board using Segger Embedded Studio (SES) when I create a new project. I must be doing something wrong as I seem to be able to run the verify function in SES just fine. When there's other code in the chip it tells me the differences and when I manually program the .hex using the USB drive that pops up or the Programmer application in the nRF connect app it succeeds.

The error that I get is 'Failed to write memory.' and 'Failed to download application. Generic Error. Please check J-Link and target connection.'

I think it must be related to the new project i created because I can program the demo just fine.

My steps:

1. Open up SES (Nordic edition V4.20a)

2. File -> New Project -> Create the project in a new solution -> A C/C++ executable for Nordic Semiconductor nRF.

3. I give the project a name and click next, on the next page I choose Target Processor -> nRF9160_xxAA

4. I leave other settings untouched, or in some cases I selected additional Output format -> .HEX (section placement is Flash as per default)

5. I Click Next -> Next -> Finish and the project is ready.

6. In the top menu I choose Build -> Build and Run. This starts building the project and the last output before the 'Failed to write memory.' error pops up is:

    Downloading Test201910191139.elf to J-Link  4.4KB in 0.0s

    Download Failed  172.3KB/s

When I build the demo project it works:

1. Again I open up Open up SES (Nordic edition V4.20a)

2. File -> Open nRF Connect SDK Project

CMakeLists.txt -> C:/nordicsources/ncs/nrf/samples/nrf9160/gps/CMakeLists.txt

Board Directory -> C:/nordicsources/ncs/zephyr/boards/arm/nrf9160_pca10090

Board Name -> nrf9160_pca10090ns

Build Directory -> C:/nordicsources/ncs/nrf/samples/nrf9160/gps/build_nrf9160_pca10090ns

Clean Build Directory -> Checked

3. Click OK, and the project is generated / loaded

4. Top menu -> Build -> Build and Run

5. Building takes some time and ends with 'Downloading merged.hex to J-Link' which opens a dialog showing the progress and working out just fine.

So my best guess is that I should configure the project to use the .HEX instead of the .elf?

For now I don't seem to be able to find where I should change this.

Regards,

Joost

Edit:

I just tried programming the generated .hex in SES using Target -> Download File -> Download Intel Hex File -> The generated.hex and it gives the same error, so the .elf instead of .hex does not seem to be the problem.

Parents Reply
  •  It is definitely possible to not use Zephyr(for example using another RTOS), though as of now Nordic only provides support for Zephyr through NCS. I tried to look up some more information/examples on it here on DevZone, but couldn't find anything...

    This also relates to the project set up. My guess is that SES as of now has more extensive support for the nRF52 and can produce the project files through a wizard, while NCS(which is based on CMake) requires the necessary prerequisites so that relevant files can be imported and the project constructed. 

    Don't know if this makes sense, but I hope it helps!

Children
Related