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

Usage of BLE_GAP_OPT_COMPAT_MODE ?

Hello all, During testing of my nRF51 based device some Android based phones unable to connect or at least connect from the first time. The same device connects perfectly for others Android phones. In SD 110 8.0.0 ble_gap.h I found BLE_GAP_OPT_COMPAT_MODE option to enable

Compatibility mode 1 enables interoperability with devices that do not support 
 *         a value of 0 for the WinOffset parameter in the Link Layer CONNECT_REQ packet.

It seems to be a my case. And I tried to set the Compatibility mode 1. However, firmware stuck at sd_ble_opt_set call. My code:

ble_opt_t      opt;
uint32_t                err_code;
memset(&opt,0x00,sizeof(ble_opt_t));
opt.gap_opt.compat_mode.mode_1_enable=0x01;
err_code = sd_ble_opt_set(BLE_GAP_OPT_COMPAT_MODE,&opt);  //<- stuck here
if(err_code) DBG("sd_ble_opt_set BLE_GAP_OPT_COMPAT_MODE: %d\n",err_code  );

Than I tried to read this field:

memset(&opt,0x00,sizeof(ble_opt_t));
err_code = sd_ble_opt_get(BLE_GAP_OPT_COMPAT_MODE,&opt);
DBG("sd_ble_opt_get BLE_GAP_OPT_COMPAT_MODE: %d\n",err_code  ); 

The error occured: NRF_ERROR_INVALID_PARAM What I did wrong? Please help.

P.S. These all were called after sd_softdevice_enable and sd_ble_enable.

Parents
  • Yes, I call sd_ble_opt_set() and sd_ble_opt_get() before advertising.
    The sd_ functions called before are:

    sd_softdevice_enable();
    sd_ble_enable();
    sd_nvic_EnableIRQ();
    sd_power_ramon_set();
    sd_ble_opt_get(); //<- here NRF_ERROR_INVALID_PARAM result. 
    

    Please check it out, if possible. I will be happy if it work. The problem is on Huawei P8lite (Android 5.0.1) I am not shure if compatibility mode will solve the problem, but it is nice chance to check. Sincerely yours,

Reply
  • Yes, I call sd_ble_opt_set() and sd_ble_opt_get() before advertising.
    The sd_ functions called before are:

    sd_softdevice_enable();
    sd_ble_enable();
    sd_nvic_EnableIRQ();
    sd_power_ramon_set();
    sd_ble_opt_get(); //<- here NRF_ERROR_INVALID_PARAM result. 
    

    Please check it out, if possible. I will be happy if it work. The problem is on Huawei P8lite (Android 5.0.1) I am not shure if compatibility mode will solve the problem, but it is nice chance to check. Sincerely yours,

Children
No Data
Related