This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

nRF51 Builds, loads, does not debug

I will be happy if someone points out this is a newbie problem and not something weirder...

Running on Win7, 64 bit BTW...

I recently received the nRF51 eval kit. I have owned and used Keil for a long time on other projects (Cortex). I always step thru the "startup guide" when using a new chip / toolset though...

I believe I have followed all the steps in the startup guide for the nRF51 eval kit. I started out trying the HID mouse example, it failed. Reverted to the simple blinky example, and it failed in a similar manner to the mouse.

Specifically, the J-Link seems to think it is downloading code and running, but there is no indication that this is true. No LED's, etc.

When I try to run the debugger, I get what looks like a successful download, but there are all "0xFF"'s in memory it seems. Nothing runs and the debugging doesn't work.

Here is a screenshot of the Keil environment:

image description

I have to think I missed something about power or similar somewhere, perhaps a setting.

Anyone have any suggestions?

Thanks!

New update: Here is what the on board JLink programming algorithm looks like:

image description

That device size seems wrong, maybe that is part of the problem? Can anyone confirm that this is what they see also?

ANOTHER update.....

Going back to it, the toolset was no longer (from within Keil) recognizing it as being connected. I tried RFgo studio just to load the blinky .hex file, and that saw the board and downloaded it. It had done that before, but this time it took and the blinky program ran!

Put the computer to sleep, returned later and compiled a BT HID example. Keil now saw the board again, and though it claims it is programming it, it isn't. RFgo studio claims to be programming, but it isn't either.

So....I don't think it is a toolset issue per se, but there is something going on that is preventing me from downloading flash to the unit despite what Keil and RFgo say.

Anyone have any ideas? If not, I'll open a support request.

UPDATE:

This makes no sense.... a) Blinky project under Keil compiles, but J-link will not detect the debugger so flash download or debug doesn't work. But loading the .hex via RFgo studio allows it to operate.

b) HID mouse using S110 example compiles under Keil, says J-link is installed and "allows" flash to be programmed and verified. But it isn't real because Blinky lights / functionality never changes.

The switching back and forth was via Keil open/close project. No restarts, etc. What is it about a Keil sample or project settings that would prevent detect of the RF51 j-link? This is goofy, going to start a support ticket....

  • Have you programmed the SoftDevice? Section 6.1.4 in the user guide.

  • I will look at this.

    My understanding is that the SoftDevice was not necessary for the Blinky code though?

  • Petter.....

    Mixed results here, please check my notes and question:

    I loaded up the softdevice 7.1, which I believed I had done previously. The BLE sample (the simplest HID Mouse example) almost started to work. Debugging was still flaky / not really working. There were often reported conflicts with the "Error: Flash Download failed - Cortex M0" issue.

    I had to clean out the original SDK examples from Keil and start from scratch. At one point, I had built the projects with the device selection as the nRF51822. It turned out that building with that variant, then returning to the nRF51422 is what allowed the nRFgo to download the hex correctly, but no debugging worked. When I cleaned out the old builds, things became more stable.

    Here are my questions:

    1. Why would building the nRF51822 variant (NOT using it as the hex, just simply building it in Keil) affect the download / debug capability at all? Does this make any sense?
    2. Even though the Blinky code does not use the SoftDevice, does the evaluation board have to have a SoftDevice loaded at least once before debugging will operate?

    I'm still trying to determine what the exact process is. My first attempt at all of this was a straight blinky load, no soft device, etc. and I encountered these problems. I can continue developing at this point, but am worried about the unknowns in the toolset that I've seen so far that might bite me later on...

  • It seems you are not programming the SoftDevice before you program your application.

    Blinky doesn't require a SoftDevice to run, but you can run Blinky with the SoftDevice.

    You just need to select the correct version. I see from your project path that you have selected a version that works with the S110 SoftDevice, then the S110 SoftDevice must be on the chip.

    If your first goal is to run blinky without the SoftDevice use the blinky_blank_pca10028 project, not the blinky_s110_pca10028. Be sure to have a clean chip (do an erase all in nRFgo Studio). If you try to flash blinky_blank when the SoftDevice is present you will get "Error: Flash Download failed - Cortex M0", because you are trying to flash your project on top of the SoftDevice.

    I'm not sure what your debug problems are, but please let me know if they are still there after you have tried my suggestions.

  • Hi Petter,

    I believe there were multiple things going on that have now been resolved by reinstalling packs in Keil. There is still the outstanding strangeness that if you switch the device to the 51822 in Keil, build a project, then switch back to the 51422 and compile, Keil tools no longer see the nRF51 j-Link! I have no idea why these are tied to each other.

    Anyway, we'll close this one.

    For anyone else looking at this link, my recommendation is to follow the steps carefully, as the Keil tool might have some strangeness in it. Here is a summary:

    1. Download / extract all the tools (SDK, SoftDevice(s), RFgo Studio)
    2. Run RFgo Studio and program the SoftDevice you want to use (S110 for example)
    3. Open Keil pack manager and copy some examples using the pack structure. Use the S110 examples since you loaded the SoftDevice.
    4. Open a project, compile.
    5. Download / debug should work
Related