Re: Debugging NRF51822 (OpenOCD + GDB)


Scott Nelson <scott@...>
 

I forced an assert in radio_event_adv_prepare by setting "_radio.tocker_id_prepare = 1”. All I see is:

***** HARD FAULT *****
Executing thread ID (thread): 0x200007a8
Faulting instruction address: 0xbc76

No additional logging.

I tried setting the ISR stack size to 1024 and got the same result when explicitly triggering the assert. I’ll let it sit for a while during normal operation and see if I see the real error show up (it’s very intermittent).

-Scott

On Aug 24, 2017, at 11:55 PM, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@nordicsemi.no> wrote:

Hi Scott,

On 25 Aug 2017, at 05:23, Chettimada, Vinayak Kariappa <vinayak.kariappa.chettimada@nordicsemi.no> wrote:


On 24 Aug 2017, at 17:21, Scott Nelson <scott@scottnelson.co> wrote:

OK, I finally was able to catch the fault while I had a serial console connected and here’s what I saw:

***** HARD FAULT *****
Executing thread ID (thread): 0x20001908
Faulting instruction address: 0xbc76
Nice! May I ask if there where any preceding console messages? usually, the assert condition is printed along with the function name.
If I where to force an assert (break the design), this is how I would get (for samples/bluetooth/peripheral on my local repo):

[bt] [INF] show_dev_info: Identity: da:d7:35:42:55:80 (random)
[2017-08-25 05:28:18.771] [bt] [INF] show_dev_info: HCI: version 5.0 (0x09) revision 0x0000, manufacturer 0xffff
[2017-08-25 05:28:18.779] [bt] [INF] show_dev_info: LMP: version 5.0 (0x09) subver 0xffff
[2017-08-25 05:28:18.785] [bt] [WRN] bt_pub_key_gen: ECC HCI commands not available
[2017-08-25 05:28:18.797] [bt] [WRN] irk_init: Using temporary IRK
[2017-08-25 05:28:18.802] Bluetooth initialized
[2017-08-25 05:28:18.806] Advertising successfully started
[2017-08-25 05:28:18.913] [bt] [ERR] radio_event_adv_prepare: assert: '!_radio.ticker_id_prepare' failed
[2017-08-25 05:28:18.920] ***** HARD FAULT *****
[2017-08-25 05:28:18.922] Executing thread ID (thread): 0x200021a4
[2017-08-25 05:28:18.926] Faulting instruction address: 0xf7be
[2017-08-25 05:28:18.930] Fatal fault in ISR! Spinning...


and,

arm-none-eabi-addr2line -afie samples/bluetooth/peripheral/outdir/nrf51_pca10028/zephyr.elf 0xf7be
0x0000f7be
radio_event_adv_prepare
/Users/hemal/workspace/zephyr/subsys/bluetooth/controller/ll_sw/ctrl.c:5551

and the line in the source file:

5541
5542 void radio_event_adv_prepare(u32_t ticks_at_expire, u32_t remainder,
5543 u16_t lazy, void *context)
5544 {
5545 ARG_UNUSED(lazy);
5546 ARG_UNUSED(context);
5547
5548 DEBUG_RADIO_PREPARE_A(1);
5549
5550 LL_ASSERT(!_radio.ticker_id_prepare);
5551 _radio.ticker_id_prepare = RADIO_TICKER_ID_ADV;
5552


The faulting instruction address corresponds to the next program counter, hence the line number given is next line in c source code.


Could you please give details on how I can reproduce the hardfault, I do not have a ble_nano (16 KB RAM nRF51), but pca10028 boards should have a similar nRF51 (32 KB RAM).

Hmmmm…. I see Kconfig.defconfig.nrf51822_QFAA has:
15 config ISR_STACK_SIZE
16 default 640

Could you please use 1024 bytes, and give a try, if your observation is related to insufficient ISR call stack? (pong sample of the micro:bit uses 1024, maybe for a reason!).

-Vinayak

_______________________________________________
Zephyr-users mailing list
Zephyr-users@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users

Join users@lists.zephyrproject.org to automatically receive all group messages.