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

Unusual behaviour with specific model host (SM-T580) with nRF52

Hello there,

I am working with a peripheral device that we are testing with many different devices, and have run into a very unusual issue. With a brand new Android tablet (SM-T580) we are unable to connect to our prototype device which uses an nRF52832 with S132 v4.0.2 (SDK 13.1).

In NRF Connect we got this error: Error 22 (0x16): GATT CONN TERMINATE LOCAL HOST

And looking at the debug info from the device it looks like: nRF52_debugInfo.png

What it shows is that the device on connection attempts to negotiate ATT MTU of 249B, but for some reason, the tablet requests a data length of 100 bytes. What? This doesn't happen with any of the other devices I have tried, even devices on old spec (BT 4.0).

It gets weirder, because in the ble_template app provided in the SDK (which does not have an unusual packet length), it still fails with the same error (Error 22 (0x16)): nRF 52 ble template

Here's the kicker, the SM-T580 works fine with S130 (SDK 11) devices with 20B packet size.

All connection attempts were made with nRF Connect.

Any idea what's going on here?

Thanks!

Parents
  • Hi,

    These Galaxy TAB A tablets have been reported several times of breaking/not following the Bluetooth specification.

    With S132 v.3.1.0 (for nRF52) we added something called compatibility mode(compatibility mode 2) that can be enabled to still be able to connect to some of these devices that are not following the Bluetooth Specification. Since this tablet is working with S130, enabling this compatibility mode might not solve this specific issue, but it’s worth a try. You can enable it like this(You need to call the option-set function after you have enabled the SoftDevice, i.e after softdevice_enable(&ram_start);):

    ble_opt_t ble_opt;
    memset(&ble_opt, 0, sizeof(ble_opt));
    
    ble_opt.gap_opt.compat_mode_2.enable = 1;
    
    err_code = sd_ble_opt_set(BLE_GAP_OPT_COMPAT_MODE_2,&ble_opt); 
    APP_ERROR_CHECK(err_code);
    

    If this does not help, the problem is most likely that the tablet is not able to handle the DLE procedure (longer on-air data packets). In SDK 13 we have a GATT module that handles this. I suggest to use the default payload size (27), so that the DLE procedure is not initiated. By default, we set the DLE size to be equal the size of the ATT_MTU in the gatt module, so if we want to have a longer ATT_MTU but at the same time keep the default DLE size, we have to change this in the gatt module(nrf_ble_gatt.c).

    In the function link_init(..) change the line

    p_link->data_length_desired        = NRF_BLE_GATT_MAX_MTU_SIZE + LL_HEADER_LEN;
    

    to

    p_link->data_length_desired        = BLE_GATT_ATT_MTU_DEFAULT + LL_HEADER_LEN;
    

    and in the function nrf_ble_gatt_init(…) change the line

    p_gatt->data_length             = NRF_BLE_GATT_MAX_MTU_SIZE + LL_HEADER_LEN;
    

    to

    p_gatt->data_length             = BLE_GATT_ATT_MTU_DEFAULT + LL_HEADER_LEN;
    

    If the issue is still there after this, try to set NRF_BLE_GATT_MAX_MTU_SIZE to 100.

  • Note that migrating from S132 v4.0.2, to S132 v4.0.4 should be fairly simple. Replace the header files in the SDK(located in the folder SDK_folder\components\softdevice\s132\headers\) with the ones you download(located in folder s132_nrf52_4.0.4\s132_nrf52_4.0.4_API\include), and remember to flash the new softdevice hex(s132_nrf52_4.0.4_softdevice.hex) to your device.

Reply
  • Note that migrating from S132 v4.0.2, to S132 v4.0.4 should be fairly simple. Replace the header files in the SDK(located in the folder SDK_folder\components\softdevice\s132\headers\) with the ones you download(located in folder s132_nrf52_4.0.4\s132_nrf52_4.0.4_API\include), and remember to flash the new softdevice hex(s132_nrf52_4.0.4_softdevice.hex) to your device.

Children
No Data
Related