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
  • Hello,

    I think I'm facing a similar issue. In fact, when I call the sd_ble_opt_set(BLE_GAP_OPT_COMPAT_MODE, &opt); function it returns NRF_ERROR_INVALID_PARAM! and then when I call the sd_ble_opt_get(BLE_GAP_OPT_COMPAT_MODE, &opt); it returns NRF_SUCCESS but mode_1_enable is equal to 0x0 which mean that compatibility option wasn't enabled yet!

    following is the functions call sequence:

    uint32_t err_code2;
    
    int main(void)
    {
      ble_opt_t opt;
        
      ble_stack_init();
    	
      memset(&opt,0x00,sizeof(ble_opt_t));
      opt.gap_opt.compat_mode.mode_1_enable = 0x01;
      err_code2 = sd_ble_opt_set(BLE_GAP_OPT_COMPAT_MODE, &opt);
    	
      memset(&opt,0x00,sizeof(ble_opt_t));
      err_code2 = sd_ble_opt_get(BLE_GAP_OPT_COMPAT_MODE, &opt);
    

    Is this a correct behavior?

    How could I be sure that the compatibility mode has been enabled ?

    I'm using s130_1.0 and SDK 10 on nRF51822_CEAA (256 Ko Flash/ 16 Ko RAM).

    Thanks.

Reply
  • Hello,

    I think I'm facing a similar issue. In fact, when I call the sd_ble_opt_set(BLE_GAP_OPT_COMPAT_MODE, &opt); function it returns NRF_ERROR_INVALID_PARAM! and then when I call the sd_ble_opt_get(BLE_GAP_OPT_COMPAT_MODE, &opt); it returns NRF_SUCCESS but mode_1_enable is equal to 0x0 which mean that compatibility option wasn't enabled yet!

    following is the functions call sequence:

    uint32_t err_code2;
    
    int main(void)
    {
      ble_opt_t opt;
        
      ble_stack_init();
    	
      memset(&opt,0x00,sizeof(ble_opt_t));
      opt.gap_opt.compat_mode.mode_1_enable = 0x01;
      err_code2 = sd_ble_opt_set(BLE_GAP_OPT_COMPAT_MODE, &opt);
    	
      memset(&opt,0x00,sizeof(ble_opt_t));
      err_code2 = sd_ble_opt_get(BLE_GAP_OPT_COMPAT_MODE, &opt);
    

    Is this a correct behavior?

    How could I be sure that the compatibility mode has been enabled ?

    I'm using s130_1.0 and SDK 10 on nRF51822_CEAA (256 Ko Flash/ 16 Ko RAM).

    Thanks.

Children
No Data
Related