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

Larger MTU results in HardFault

I'm running SDK 14.2 using FreeRTOS on a nrf52832.

When I increase NRF_SDH_BLE_GATT_MAX_MTU_SIZE to 158, the system ends up in Hard Fault.

Anyone have suggestions on where to being looking for the fault? The soft device has more than enough RAM, its actually telling me I can decrease it. I updated NRF_SDH_BLE_GAP_EVENT_LENGTH to 10, with no affect.

Any help is appreciated

  • no error or hardfault for me in the example atleast when i change the MTU size. But since you both are getting the same thing, i cannot overlook it. Can one of you give me your setup?

  • I was able to get it to work, but I could not find any commit clearly indicating what I changed to get it to work properly.

    I also started with the ble_app_hrs_freertos, adding a 512 byte characteristic and increased the MTU size to 158.
    I'll look a but closer at the GIT history to see if I can either reproduce with sharable code.

  • Thanks Ken, 

    Please comeback here to update us, it will be really helpful for others.

  • I also see this error with the freeRTOS example.  On Connect, the connect event propagates through the system. But quickly the chip goes into Hardfault reaching the Hardfault_c_handler().

    Logging shows:

    <info> app: HRS FreeRTOS example started.
    <debug> nrf_sdh_freertos: Enter softdevice_task.
    <info> app: Fast advertising.
    <info> app: Slow advertising.
    <debug> nrf_ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x0.
    <debug> nrf_ble_gatt: Updating data length to 251 on connection 0x0.
    <info> app: Connected
    <debug> nrf_ble_gatt: Data length updated to 27 on connection 0x0.
    <debug> nrf_ble_gatt: max_rx_octets: 27
    <debug> nrf_ble_gatt: max_tx_octets: 27
    <info> app: Data Length Event Recevied: 251
    <debug> nrf_ble_gatt: ATT MTU updated to 247 bytes on connection 0x0 (response).
    <info> app: Data Length Event Recevied: 251
    <debug> nrf_ble_gatt: Peer on connection 0x0 requested a data length of 251 bytes.
    <debug> nrf_ble_gatt: Updating data length to 251 on connection 0x0.
    <debug> nrf_ble_gatt: Data length updated to 251 on connection 0x0.
    <debug> nrf_ble_gatt: max_rx_octets: 251
    <debug> nrf_ble_gatt: max_tx_octets: 251
    <info> app: Data Length Event Recevied: 251
    <error> hardfault: HARD FAULT at 0x0002E140
    <error> hardfault: R0: 0x00000040 R1: 0x20008700 R2: 0x74007300 R3: 0x74007300
    <error> hardfault: R12: 0xA5A5A5A5 LR: 0x0002C6F1 PSR: 0x2100020E
    <error> hardfault: Cause: Data bus error (PC value stacked for the exception return points to the instruction that caused the fault).
    <error> hardfault: Bus Fault Address: 0x7400730C

    The Hardfault always seems to occur after Connection on a call to taskSELECT_HIGHEST_PRIORITY_TASK();    inside task.c.  

    My settings are: SDK15.2,  MTU 247, GAP DL 251, Len evt enabled, sdk_ble_task_depth 512

    It seems like the hardfault occurs shortly after the MTU handshaking after connection. I see service discovery occur just before everything blows up.  

  • For me everything works up to GAP DL 174 and MTU 170.  Beyond this causes hardfaults on connection

Related