Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

crash in ble_template_app (from nRF5 SDK 15.0.0)


I've installed the ble_template_app on the nrf52832DK and the nrf52840PDK and the Adafruit nrf52 Feather (almost the same as the nrf52832DK). I've modified the configuration enough to have Segger RTT logging enabled, but no changes to main.

I'm seeing the application run for a while (30 seconds to a handful of minutes) and then an "app: Fatal error" log message comes across the console . At that point, there's no interaction with the device available (I'm using the LightBlue Explorer too). Hit the reset button - starts over as I'd expect and then the same thing will happen.

The boards will crash whether or not I connect to them. I don't see any particular pattern of crashing a consistent time after a connect or disconnect event (which I see in the logs).

The stacktrace of the crash (captured in GDB) also seems odd to me:

#0 app_error_fault_handler (id=id@entry=16385, pc=pc@entry=0, info=info@entry=536935940)
at /Users/zoo/Programming/nordic/SDK/nRF5_SDK_15.0.0_a53641a/components/libraries/util/app_error_weak.c:56
#1 0x000273f0 in app_error_handler_bare (error_code= )
at /Users/zoo/Programming/nordic/SDK/nRF5_SDK_15.0.0_a53641a/components/libraries/util/app_error.c:73
#2 0x0002d69e in ble_advertising_start (p_advertising=0x20002d78 ,
advertising_mode= )
at /Users/zoo/Programming/nordic/SDK/nRF5_SDK_15.0.0_a53641a/components/ble/ble_advertising/ble_advertising.c:663
#3 0x0002d8b2 in on_terminated (p_ble_evt= , p_ble_evt= ,
p_advertising=0x20002d78 )
at /Users/zoo/Programming/nordic/SDK/nRF5_SDK_15.0.0_a53641a/components/ble/ble_advertising/ble_advertising.c:146
#4 ble_advertising_on_ble_evt (p_ble_evt= , p_context=0x20002d78 )
at /Users/zoo/Programming/nordic/SDK/nRF5_SDK_15.0.0_a53641a/components/ble/ble_advertising/ble_advertising.c:687
#5 0x00031ad6 in nrf_sdh_ble_evts_poll (p_context= )
at /Users/zoo/Programming/nordic/SDK/nRF5_SDK_15.0.0_a53641a/components/softdevice/common/nrf_sdh_ble.c:307
#6 0x00031a82 in nrf_sdh_evts_poll ()
at /Users/zoo/Programming/nordic/SDK/nRF5_SDK_15.0.0_a53641a/components/softdevice/common/nrf_sdh.c:386
#7 SWI2_EGU2_IRQHandler ()
at /Users/zoo/Programming/nordic/SDK/nRF5_SDK_15.0.0_a53641a/components/softdevice/common/nrf_sdh.c:395
#8 0xffffffe8 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

How does the app_error_handler get called from this code (file nRF5_SDK_15.0.0_a53641a/components/ble/ble_advertising/ble_advertising.c)

661 if (p_advertising->evt_handler != NULL)
662 {
663 p_advertising->evt_handler(p_advertising->adv_evt);
664 }

Parents Reply Children
  • The changes from the stock 15.0.0 SDK are shown in https://github.com/davidzuhn/nrf-test-b-a-u/commit/b25fc238fef784434be46075cd01dfa1fb7f0147.   Nothing to the source of the program itself.   Changes to the Makefile to allow me to specify a serial number to nrfjprog.   

    I have erased the chip and reflashed everything (via 'make erase && make flash_softdevice && make flash').   That didn't change anything.

    I'll upload the details from app_error_handler and the RTT log tonight.   Although the RTT log is basically just "app: Debug logging for UART over RTT started." shortly followed by "app: Fatal error".   

  • Here's the GDB session after a fresh reflash (make erase && make flash_softdevice && make flash)

    GNU gdb (GNU Tools for ARM Embedded Processors) 7.8.0.20150604-cvs
    Copyright (C) 2014 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "--host=x86_64-apple-darwin10 --target=arm-none-eabi".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>.
    Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.
    For help, type "help".
    Type "apropos word" to search for commands related to "word".
    0x0000baa4 in ?? ()
    Select SWD as target interface
    Target endianess set to "little endian"
    Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
    Selecting device: nrf52832
    Target interface speed set to 1000 kHz
    Breakpoint 1 at 0x27194: file /Users/zoo/Programming/nordic/SDK/nRF5_SDK_15.0.0_a53641a/components/libraries/util/app_error_weak.c, line 56.
    Loading section .text, size 0x995c lma 0x26000
    Loading section .sdh_soc_observers, size 0x18 lma 0x2f95c
    Loading section .sdh_ble_observers, size 0x40 lma 0x2f974
    Loading section .log_const_data, size 0x80 lma 0x2f9b4
    Loading section .nrf_balloc, size 0x18 lma 0x2fa34
    Loading section .sdh_state_observers, size 0x10 lma 0x2fa4c
    Loading section .sdh_stack_observers, size 0x10 lma 0x2fa5c
    Loading section .sdh_req_observers, size 0x8 lma 0x2fa6c
    Loading section .ARM.exidx, size 0x8 lma 0x2fa74
    Loading section .data, size 0xd8 lma 0x2fa7c
    Loading section .log_dynamic_data, size 0x40 lma 0x2fb54
    Start address 0x262d0, load size 39828
    Transfer rate: 36 KB/sec, 1991 bytes/write.
    Resetting target
    (gdb) cont
    Continuing.
    
    Breakpoint 1, app_error_fault_handler (id=id@entry=16385, pc=pc@entry=0, info=info@entry=536935476)
        at /Users/zoo/Programming/nordic/SDK/nRF5_SDK_15.0.0_a53641a/components/libraries/util/app_error_weak.c:56
    56	{
    (gdb) list
    51	/**
    52	 * Function is implemented as weak so that it can be overwritten by custom application error handler
    53	 * when needed.
    54	 */
    55	__WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info)
    56	{
    57	    __disable_irq();
    58	    NRF_LOG_FINAL_FLUSH();
    59	
    60	#ifndef DEBUG
    (gdb) print id
    $1 = 16385
    (gdb) print pc
    $2 = 0
    (gdb) p/x info
    $4 = 0x2000fc34
    (gdb) where
    #0  app_error_fault_handler (id=id@entry=16385, pc=pc@entry=0, info=info@entry=536935476)
        at /Users/zoo/Programming/nordic/SDK/nRF5_SDK_15.0.0_a53641a/components/libraries/util/app_error_weak.c:56
    #1  0x0002718c in app_error_handler_bare (error_code=<optimized out>)
        at /Users/zoo/Programming/nordic/SDK/nRF5_SDK_15.0.0_a53641a/components/libraries/util/app_error.c:73
    #2  0x0002be6a in ble_advertising_start (p_advertising=0x2000362c <m_advertising>, 
        advertising_mode=<optimized out>)
        at /Users/zoo/Programming/nordic/SDK/nRF5_SDK_15.0.0_a53641a/components/ble/ble_advertising/ble_advertising.c:663
    #3  0x0002c07e in on_terminated (p_ble_evt=<optimized out>, p_ble_evt=<optimized out>, 
        p_advertising=0x2000362c <m_advertising>)
        at /Users/zoo/Programming/nordic/SDK/nRF5_SDK_15.0.0_a53641a/components/ble/ble_advertising/ble_advertising.c:146
    #4  ble_advertising_on_ble_evt (p_ble_evt=<optimized out>, p_context=0x2000362c <m_advertising>)
        at /Users/zoo/Programming/nordic/SDK/nRF5_SDK_15.0.0_a53641a/components/ble/ble_advertising/ble_advertising.c:687
    #5  0x0002d27c in nrf_sdh_ble_evts_poll (p_context=<optimized out>)
        at /Users/zoo/Programming/nordic/SDK/nRF5_SDK_15.0.0_a53641a/components/softdevice/common/nrf_sdh_ble.c:307
    #6  0x0002d22a in nrf_sdh_evts_poll ()
        at /Users/zoo/Programming/nordic/SDK/nRF5_SDK_15.0.0_a53641a/components/softdevice/common/nrf_sdh.c:386
    #7  SWI2_EGU2_IRQHandler ()
        at /Users/zoo/Programming/nordic/SDK/nRF5_SDK_15.0.0_a53641a/components/softdevice/common/nrf_sdh.c:395
    #8  0xffffffe8 in ?? ()
    Backtrace stopped: previous frame identical to this frame (corrupt stack?)
    
    (gdb) up
    #1  0x0002718c in app_error_handler_bare (error_code=<optimized out>)
        at /Users/zoo/Programming/nordic/SDK/nRF5_SDK_15.0.0_a53641a/components/libraries/util/app_error.c:73
    73	    app_error_fault_handler(NRF_FAULT_ID_SDK_ERROR, 0, (uint32_t)(&error_info));
    (gdb) p error_info
    $5 = {line_num = 0, p_file_name = 0x0, err_code = 8198}
    
    (gdb) up
    #2  0x0002be6a in ble_advertising_start (p_advertising=0x2000362c <m_advertising>, 
        advertising_mode=<optimized out>)
        at /Users/zoo/Programming/nordic/SDK/nRF5_SDK_15.0.0_a53641a/components/ble/ble_advertising/ble_advertising.c:663
    663	        p_advertising->evt_handler(p_advertising->adv_evt);
    
    
    

    and the console log (via RTT):

    <info> app: Debug logging for UART over RTT started.
    <error> app: Fatal error

    I did not connect to the service or do anything with this device except sit and wait (~30 seconds or so) for the fatal error to occur.

Related