HCI UART simultaneous advertising and scanning MPU fault

I'm getting an occasional MPU fault on the nRF52840 on the Thingy91 when starting scanning:

[30:48:55.021,636] <err> os: ***** MPU FAULT *****
[30:48:55.021,636] <err> os:   Data Access Violation
[30:48:55.021,667] <err> os:   MMFAR Address: 0xc
[30:48:55.021,667] <err> os: r0/a1:  0x00000008  r1/a2:  0x00000007  r2/a3:  0x00004e0a
[30:48:55.021,667] <err> os: r3/a4:  0x00000008 r12/ip:  0x00000000 r14/lr:  0x00002ae3
[30:48:55.021,667] <err> os:  xpsr:  0x21000000
[30:48:55.021,667] <err> os: Faulting instruction address (r15/pc): 0x0001c8d6
[30:48:55.021,697] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0

Running arm-none-eabi-addr2line leads me to 

buf->len -= len;

in this call below:

void *net_buf_simple_pull(struct net_buf_simple *buf, size_t len)
{
	NET_BUF_SIMPLE_DBG("buf %p len %zu", buf, len);

	__ASSERT_NO_MSG(buf->len >= len);

	buf->len -= len;
	return buf->data += len;
}

Which is the cal to net_buf_pull in tx_isr of the hci_lpuart code. 

It's only occasionally (happens > 24hours of constant use). The biggest change in bluetooth functionally was the addition of periodic advertisements. 

Here are the scan settings:

    struct bt_le_scan_param scan_param = {
        .type = BT_LE_SCAN_TYPE_ACTIVE,
        .options = BT_LE_SCAN_OPT_NONE,
        .interval = BT_GAP_SCAN_FAST_INTERVAL,
        .window = BT_GAP_SCAN_FAST_WINDOW,
    };

    struct bt_scan_init_param scan_init = {
        .connect_if_match = 0,
        .scan_param = &scan_param,
        .conn_param = NULL,
    };

Here are the advertising settings:

/* Advertising parameters */
struct bt_le_adv_param param_conn = BT_LE_ADV_PARAM_INIT(BT_LE_ADV_OPT_CONNECTABLE |
                                                             BT_LE_ADV_OPT_USE_NAME,
                                                         BT_GAP_ADV_SLOW_INT_MIN,
                                                         BT_GAP_ADV_SLOW_INT_MAX, NULL);

We're running NCS 1.9.1. I also scoured the issues on Zephyr's Github but didn't find any pertinent issues that match this one.

Any suggestions would be greatly appreciated.

Thanks!

Parents
  • Hi,

    Any suggestions would be greatly appreciated.

    Could you try to double CONFIG_ISR_STACK_SIZE , and see if it fixes the issue ?

  • Another update! 

    So far, no faults on the nRF52. Did get one on the nRF9160 side:

    [19:48:18.956,115] <err> os: Exception occurred in Secure State
    [19:48:18.956,115] <err> os: ***** HARD FAULT *****
    [19:48:18.956,115] <err> os: Fault escalation (see below)
    [19:48:18.956,115] <err> os: ***** BUS FAULT *****
    [19:48:18.956,146] <err> os: Precise data bus error
    [19:48:18.956,146] <err> os: BFAR Address: 0x50008158
    [19:48:18.956,146] <err> os: r0/a1: 0x2002cac1 r1/a2: 0x00000000 r2/a3: 0x00000001
    [19:48:18.956,176] <err> os: r3/a4: 0x00000000 r12/ip: 0x0000f9c0 r14/lr: 0x0002db4f
    [19:48:18.956,176] <err> os: xpsr: 0x21000000
    [19:48:18.956,176] <err> os: Faulting instruction address (r15/pc): 0x0002db38
    [19:48:18.956,207] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
    [19:48:18.956,237] <err> os: Current thread: 0x2000dd48 (BT TX)

    Looks like it happened in the BT TX thread

    I tracked it down again using addr2line and got essentially the same places related to the net buffer

    app on  final-tweaks [$!+] 
    ❯ arm-none-eabi-addr2line -e nrf9160/build/zephyr/zephyr.elf 0x0002db38
    /Users/jaredwolff/Git/broodminder/zephyr/drivers/bluetooth/hci/h4.c:435
    
    app on  final-tweaks [$!+] 
    ❯ arm-none-eabi-addr2line -e nrf9160/build/zephyr/zephyr.elf 0x0002db4f
    /Users/jaredwolff/Git/broodminder/zephyr/include/net/buf.h:2072

    I'm going to increase the ISR_STACK_SIZE on the nRF91 side as well. Let me know if you have any other insights/suggestions.

Reply
  • Another update! 

    So far, no faults on the nRF52. Did get one on the nRF9160 side:

    [19:48:18.956,115] <err> os: Exception occurred in Secure State
    [19:48:18.956,115] <err> os: ***** HARD FAULT *****
    [19:48:18.956,115] <err> os: Fault escalation (see below)
    [19:48:18.956,115] <err> os: ***** BUS FAULT *****
    [19:48:18.956,146] <err> os: Precise data bus error
    [19:48:18.956,146] <err> os: BFAR Address: 0x50008158
    [19:48:18.956,146] <err> os: r0/a1: 0x2002cac1 r1/a2: 0x00000000 r2/a3: 0x00000001
    [19:48:18.956,176] <err> os: r3/a4: 0x00000000 r12/ip: 0x0000f9c0 r14/lr: 0x0002db4f
    [19:48:18.956,176] <err> os: xpsr: 0x21000000
    [19:48:18.956,176] <err> os: Faulting instruction address (r15/pc): 0x0002db38
    [19:48:18.956,207] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
    [19:48:18.956,237] <err> os: Current thread: 0x2000dd48 (BT TX)

    Looks like it happened in the BT TX thread

    I tracked it down again using addr2line and got essentially the same places related to the net buffer

    app on  final-tweaks [$!+] 
    ❯ arm-none-eabi-addr2line -e nrf9160/build/zephyr/zephyr.elf 0x0002db38
    /Users/jaredwolff/Git/broodminder/zephyr/drivers/bluetooth/hci/h4.c:435
    
    app on  final-tweaks [$!+] 
    ❯ arm-none-eabi-addr2line -e nrf9160/build/zephyr/zephyr.elf 0x0002db4f
    /Users/jaredwolff/Git/broodminder/zephyr/include/net/buf.h:2072

    I'm going to increase the ISR_STACK_SIZE on the nRF91 side as well. Let me know if you have any other insights/suggestions.

Children
No Data
Related