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

Why can not set MAX_MTU_SIZE to 247?

On 52832, SDK V14.0.0, SD132-5.0

I tried to set NRF_SDH_BLE_GATT_MAX_MTU_SIZE to 247, as from dev-doc i saw that SD132 supports BLE V4.2 DLE.

However it returns:

ble_gatt: sd_ble_gap_data_length_update() (request) on connection 0x0 returned unexpected value 0x13.

When set MAX_MTU_SIZE to 23 this issue disappear.

  • Which example are you using? What value of maximum ATT MTU (NRF_SDH_BLE_GATT_MAX_MTU_SIZE) have you configured the SoftDevice to support? And what event length (NRF_SDH_BLE_GAP_EVENT_LENGTH)?

  • @Petter Myhre

    Thank you for replying.

    I managed to resolve it, at least it looks to. I probably misunderstood the error message, it does not have to be local resource limitation, but from limitations in peer device.

    Not using a specific example mixed with my own codes. 52 is acting as peripheral of a iPad Air 2, which according to Apple it supports v4.2. I had thought it is due to 52 local setting limits so i reverted to 23, how ever when I turned on debug log immediately i saw iPad is requesting for a packet length of 185 - i think that's why i can not set PDU size to 247 - as iPad may refuse it, probably because its support of V4.2 is partial.

    So in the end as a solution i added PDU size exchange response of 247 to peer's request - as i still have 247 set in SDK_config.h. I still got the same error message but this action seems completed the negotiation procedure and PDU size ends up be set to 185.

    LOG:

    ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x0.

    ble_gatt: Requesting to update data length to 251 on connection 0x0.

    ble_gatt: sd_ble_gap_data_length_update() (request) on connection 0x0 returned unexpected value 0x13.

    ble_gatt: ATT MTU updated to 185 bytes on connection 0x0 (response).

    Hope i am understanding the process correctly.

  • I guess some kind of error is thrown because you don't end up with the MTU you want, but it should be possible to handle this error the way you want. I'm not sure exactly which function return the 0x13 error though? Are you saying sd_ble_gap_data_length_update() returns it?

  • Yes from the log it looks sd_ble_gap_data_length_update() returned the 0x13 error. If i set the MAX_PDU_SIZE to 23, then the error message disappear, instead i can see following log:

    <debug> ble_gatt: Peer is requesting for a length of 185 on connection 0x0.
    

    but then i can only end up with a PDU of 23.

    My setting in config:

    #ifndef NRF_SDH_BLE_GAP_EVENT_LENGTH
    #define NRF_SDH_BLE_GAP_EVENT_LENGTH 3
    #endif
    
    
    // <o> NRF_SDH_BLE_GATT_MAX_MTU_SIZE - Static maximum MTU size.
    #ifndef NRF_SDH_BLE_GATT_MAX_MTU_SIZE
    #define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 247
    #endif
    
    // <o> NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE - Attribute Table size in bytes. The size must be a multiple of 4. 
    #ifndef NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE
    #define NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE 1408
    #endif
    

    Which i did not find anything wrong. The answer i concluded is the only reason i can think about.

    However, i not sure how to verify the hypthesis that max PDU size of BLE v4.2 implementation on iPAD air 2 is only 185.

  • I'm pretty sure that sd_ble_gap_data_length_update() returns the error because you have set the event length to 3 (3.75 ms) this is not enough time to transfer a packet pair with 251 LL PDUs. It needs to be minimum 4 (5 ms), and more if you want to send multiple packets in each connection interval.

Related