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

Issues programming my nRF51822 for the first time

Hello All,

I'm trying to program a NRF51822 module for the first time. I'm using the Jlink for ARM from IAR which is segger rebranded. It supports JTAG and SWD.

We got a module from Raytac. The module mfg recommended a 12K ohm pulldown resistor tied to the SWCLK pin. I went ahead and added the pull down.

Using Keil, when I try to program I get an error message saying that "Erase Failed!" but if I go on Keil and do a "Full Erase" it works fine. I know that if the full erase worked my Softdevice is gone but at this point I just need to overcome the programming issue then I will program the Softdevice back.

Please see below. Any clues?

Load "C:\Nordic Semiconductor\nRF51 SDK_v6.1.0.0\Nordic\nrf51822\Board\pca10001\blinky_example\arm\_build\blinky_arm.axf" Set JLink Project File to "C:\Nordic Semiconductor\nRF51 SDK_v6.1.0.0\Nordic\nrf51822\Board\pca10001\blinky_example\arm\JLinkSettings.ini"

  • JLink Info: Device "NRF51822_XXAA" selected (257 KB flash, 16 KB RAM).

JLink info:

DLL: V4.92 , compiled Sep 30 2014 09:33:42 Firmware: J-Link ARM V7 compiled Jun 20 2012 19:45:53 Hardware: V7.00 S/N : 157001765 OEM : IAR

  • JLink Info: Found SWD-DP with ID 0x0BB11477
  • JLink Info: Found Cortex-M0 r0p0, Little endian.
  • JLink Info: FPUnit: 4 code (BP) slots and 0 literal slots ROMTableAddr = 0xE00FF003

Target info:

Device: nRF51822_xxAA VTarget = 3.377V State of Pins: TCK: 0, TDI: 0, TDO: 1, TMS: 0, TRES: 1, TRST: 0 Hardware-Breakpoints: 4 Software-Breakpoints: 8192 Watchpoints: 2 JTAG speed: 9600 kHz

Erase Failed! Error: Flash Download failed - "Cortex-M0"

Parents Reply Children
  • Thanks Nguyen,

    I made some progress but still have a problem. For a quick and dirty test I built Blinky and I was trying to program the module without the S110. But After some attempts changing the SW mode all the way down to 100KHz and no progress I decided to try the build version nrf51822_xxaa_s110 and I was able to program the nRF. Please see below.

    So why does it work with S110 and it does not without S110? it has to do with the memory setup then but I looked at my addresses and they seem right, can you please confirm?

    for NO softdevice Blinky address settings are:

    IROM1: Start: 0x0 Size:0x40000 IRAM1: Start: 0x20000000 Size: 0x4000

    JLink info:

    DLL: V4.94c, compiled Oct 31 2014 19:59:57 Firmware: J-Link ARM V7 compiled Jun 20 2012 19:45:53 Hardware: V7.00 S/N : 157001765 OEM : IAR

    • JLink Info: Found SWD-DP with ID 0x0BB11477
    • JLink Info: Found Cortex-M0 r0p0, Little endian.
    • JLink Info: FPUnit: 4 code (BP) slots and 0 literal slots ROMTableAddr = 0xE00FF003

    Target info:

    Device: nRF51822_xxAA VTarget = 3.377V State of Pins: TCK: 0, TDI: 0, TDO: 1, TMS: 0, TRES: 1, TRST: 0 Hardware-Breakpoints: 4 Software-Breakpoints: 8192 Watchpoints: 2 JTAG speed: 1000 kHz

    Full Chip Erase Done. Programming Done. Verify OK. Application running ...

  • I think I see the problem. The module may have the S110 already flashed in and protected. You'll need the nRFGo to completely erase it first before you can load other programs to address 0.

  • That helped with the issue. So I thought that "Erase All" from within Keil would erase the whole flash without having to go to nRFgo Studio.

Related