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

Migrating to SDK15, crashing at advertising_init()

I'm trying to migrate from SDK12 to SDK15, but my code always crashes at advertising_init() and goes to NRF_BREAKPOINT_COND. Even when I directly use the example from the service tutorial https://devzone.nordicsemi.com/tutorials/b/bluetooth-low-energy/posts/ble-services-a-beginners-tutorial. I'm wondering what's the issue in this case?

Also how do I define DEBUG here? I added CFLAGS += DDEBUG in makefile, but it didn't trigger the switch error ID part in app_error_default_handler function in app_error_weak.c.

I'm using Eclipse with both DK52 and DK52840. Any help is appreciated. Thanks.

Parents
  • CFLAGS += DDEBUG

    Try CFLAGS += -DDEBUG

    Also remove compiler optimization (to get expected debug results), OPT = -O0 -g3 , CFLAGS += $(OPT)

    NRF_BREAKPOINT_COND

    Try commenting out that line, //NRF_BREAKPOINT_COND;

  • Try CFLAGS += -DDEBUG

    Yes, I'm using this. I missed - in my typing.

    Also remove compiler optimization (to get expected debug results), OPT = -O0 -g3 , CFLAGS += $(OPT)

    I see OPT = -O3 -g3 and CFLAGS += $(OPT) in the makefile. Should I comment them out? It doesn't seem to run through after commenting out, it shows No source available for "main() at 0x30f62"

    Try commenting out that line, //NRF_BREAKPOINT_COND;

    There is no stopping at app_error_weak any more, but I couldn't find the device on my phone. Probably there is still error?

  • xhr0428 said:
    Should I comment them out?

    No,  change OPT = -O3 -g3 to OPT = -O0 -g3 

    xhr0428 said:
    There is no stopping at app_error_weak any more, but I couldn't find the device on my phone. Probably there is still error?

     Do you have logging enabled? (NRF_LOG_ENABLED 1 in sdk_config.h), with either UART or Segger RTT backend(NRF_LOG_BACKEND_UART_ENABLED,NRF_LOG_BACKEND_RTT_ENABLED ) ?

    Then the error code will be printed over the enabled backend.

    If it's not being printed, let the code run, and read out the CPU register values with nrfjprog --readregs

Reply
  • xhr0428 said:
    Should I comment them out?

    No,  change OPT = -O3 -g3 to OPT = -O0 -g3 

    xhr0428 said:
    There is no stopping at app_error_weak any more, but I couldn't find the device on my phone. Probably there is still error?

     Do you have logging enabled? (NRF_LOG_ENABLED 1 in sdk_config.h), with either UART or Segger RTT backend(NRF_LOG_BACKEND_UART_ENABLED,NRF_LOG_BACKEND_RTT_ENABLED ) ?

    Then the error code will be printed over the enabled backend.

    If it's not being printed, let the code run, and read out the CPU register values with nrfjprog --readregs

Children
Related