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

Examples built with GCC do not work, prebuilt hex files do work but only if programmed with nRFgo Studio. Any idea why?

I'm new to the nRF51822. I've setup GCC and Make on Windows 10 and am using SDK 11. In all the examples of the SDK, flashing the newly made hex files (using GCC) with JLink, nRFgo or nrfjprog doesn't work. Even after flashing the softdevice i.e. The programming happens successfully, but the nRF51822 doesn't advertise or carry out any of the instructions.

However, if I flash the nRF51822 with nRFgo, as an application with the prebuilt hex files included in the SDK under example_name\hex, it does work. Advertising, etc.

Any idea how I can solve this issue?

P.S. The files compile successfully. So I think I've setup everything correctly.

  • the 51 series ICs comes in several different memory variants while the SDK examples are only configured for those used on the development kits. Typical symptom of incorrect memory layout is that the program fails to run as you described (leads to a hardfault exception). An overview of the different variants can be found on the infocenter here.

    Please verify that RAM and ROM settings in the. ld file invoked by the makefile are in accordance to the IC variant used on target board.

    Example of a typical memory layout for the nRF51x22_xxAC (256/32) variant:

    MEMORY
    {
      FLASH (rx) : ORIGIN = 0x18000, LENGTH = 0x28000
      RAM (rwx) :  ORIGIN = 0x20002000, LENGTH = 0x6000
    }
    

    And the same adjusted for nRF51x22_xxAA (256/16). Notice the ram length(size) is reduced - ORIGIN+LENGTH must not exceed the memory boundary.

    MEMORY
    {
      FLASH (rx) : ORIGIN = 0x18000, LENGTH = 0x28000
      RAM (rwx) :  ORIGIN = 0x20002000, LENGTH = 0x2000
    }
    
  • Have you flashed the softdevice to the nrf51?

  • Thanks! I was able to figure this out. I'm glad that you were able to explain this clearly.

Related