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

ble_app_template always end at SVC_Handler

Hi !

I'm using an nRF52 on PCA10040 board and nRF5_SDK_11.0.0_89a8197. I want to run the peripheral ble_app_template with SEGGER Embedded Studio v2.20. I correctly set the FLASH (0x1c000) and RAM (0x20002080) START address in the linker options. J-Link correctly downloads both SoftDevice and application (checked with nRFgo Studio).

After it reaches ble_stack_init() the program hangs in SVC_Handler.

I tried both s132_nrf52_2.0.0_softdevice.hex and s132_nrf52_2.0.1_softdevice.hex with the same results.

  • PCA10040 V1.1.0 (2016.11 - 682956974) IC revision 1 which is compatible with nRF5 SDK 11.0.0 and S132 softdevice v2.0.0

  • I'm not able to reproduce this right now. The reason why you don't see the RAM settings getting printed out is probably because your program is halting before it gets to that. It is printed after sd_softdevice_enable() is called. Are you able to verify that the external LF crystal is actually starting? You can use the tasks and registers in the clock module to do it.

  • I just tried this :

    NRF_LOG_INIT();
    NRF_LOG("Hello world !\n");
    
    NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
    NRF_CLOCK->TASKS_LFCLKSTART = 1;
    while(!NRF_CLOCK->EVENTS_LFCLKSTARTED) {}
    NRF_LOG_PRINTF("LFCLK started (%X)\n",NRF_CLOCK->EVENTS_LFCLKSTARTED);
    

    and received :

    Hello world !
    LFCLK started (1)
    
  • NO_VTOR_CONFIG was missing from the Preprocessor Definitions.

    What is this definition for exaclty ?

    I restated from scratch (reinstall SES, packages and SDK) before figuring this out.

    Sorry for wasting your time.

  • From the startup file ..

    * NO_VTOR_CONFIG                                                            *
    *                                                                           *
    *   If defined, the vector table offset register will not be configured.    *
    

    and if you look at the important bits of assembler for that, leaving out the ram vectors bit

    #ifndef NO_VTOR_CONFIG
      /* Configure vector table offset register */
      ldr r0, =VTOR_REG
      ldr r1, =_vectors
      str r1, [r0]
    #endif
    

    it puts the vectors address into the SCB vector offset register which means you're using the vector table in your app and not the softdevice one which means the first SVC call goes to your SVC call handler which doesn't do anything except loop.

Related