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

ble_app_hrs example crashes on startup

Hello, I am trying to get the PCA10001 evaluation board going with BLE, and am trying the ble_app_hrs example from the SDK as a start. I am developing on Mac OS with Eclipse and GCC, and have been able to run apps without the SoftDevice with no problems.

I have now loaded the BLE SoftDevice s110_nrf51822_5.2.0_softdevice.hex following the instructions at www.funwithelectronics.com/ and www.segger2.com/index.php. (I tried the 6.0.0-1.alpha first and could not get that to work at all, but that is another story.)

I then tried to run the ble_app_hrs example, but it crashes partway through startup while trying to start timers, with the following stacktrace in GDB (via Eclipse):


ble_app_hrs [GDB Hardware Debugging]	
	ble_hrs_gcc_s110_xxaa.out	
		Thread [1] <main> (Suspended : Signal : SIGTRAP:Trace/breakpoint trap)	
			0xfffffffe	
			<signal handler called>() at 0xfffffff1	
			0x11488	
			<signal handler called>() at 0xfffffff9	
			NVIC_SetPendingIRQ() at core_cm0.h:558 0x1a8dc	
			timer_list_handler_sched() at app_timer.c:324 0x1af92	
			timer_start_op_schedule() at app_timer.c:786 0x1b6dc	
			app_timer_start() at app_timer.c:1,026 0x1baac	
			application_timers_start() at main.c:517 0x14d7c	
			main() at main.c:765 0x15284	

My guess was that the timer code might be conflicting with some resources reserved for the SoftDevice, but it does not make sense that sample code should have this problem. Also, strangely, if I then stop it and restart, it seems to start up successfully, everything works fine as far as I can tell, and I can connect to it from a test app on my iPhone.

What is going on here?

  • I haven't seen this particular error before. Does the program run when you don't use the debugger? Are you sure that the softdevice have been flashed correctly? I'd recommend you to take a look at this question for more information on how to flash the softdevice. Which version of the Segger tools do you use?

    Also, with the PCA10001 ble_app_hrs, you should make sure to remove the system off from the startup, since that will easily throw off the debugger.

  • Well it seems to be working at least most of the time now, but I am not sure why. I am fairly sure that the softdevice was flashed correctly, as it tended to work successfully after stopping and restarting.

  • Hello, first time posting, I am running into the same exact situation, GCC and eclipse kepler for windows, using the examples from nrf51_sdk_v5_2_0_39364. All examples work OK, even the led_redio_examples, so hardware wise I think I am ok. Loaded the s110_nrf51822_5.2.1_softdevice.hex using nrfGO, all looks good.

    Loading the gcc version of ble_app_hrs example (I know only Keil is available but the inside code is ready for GCC by defining the GNUC, please if possible to provide a gcc working example), it loads OK into the PCA10001 via the onboard jlink, I can debug initially ok in main(), when I hit resume to run the app it crashes (same exact Stack frame as Andrew). The crash occurs at line 232

    "err_code = sd_softdevice_enable(clock_source, softdevice_assertion_handler);" in softdevice_handler.c

    which calls the SVCALL macro, that generates the SVC instruction.

    Debugging deeper, the SVC 0x10 is being executed, and going into the interrupt somewhere, but somewhere there it does not return properly and crashes. Please if you can explain more what you mean by "remove system from the startup", maybe this is my issue, or if any new updates about this example in GCC, or if there is an updated example for the GCC which solves all confusion. Is there a s110_nrf51822_5.2.1_softdevice.hex that is proven to work with the GCC ARM compiler?

    Thank you .

Related