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

Unknown error when BLE peripheral tries to disconnect the central

if(deallocate_flag)
        {
           uint32_t  periph_link_cnt=0;
           deallocate_flag = 0;
           periph_link_cnt =  ble_conn_state_peripheral_conn_count();
            #ifdef DEBUG
              printf("total links :%d\n",periph_link_cnt);
            #endif
           if(periph_link_cnt)
              {
               for( ;periph_link_cnt>0;periph_link_cnt--)
                 {
                     err_code = sd_ble_gap_disconnect(periph_link_cnt-1,BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
                      #ifdef DEBUG
                       printf("error value is %x\n",err_code);
                      #endif
                     APP_ERROR_CHECK(err_code);
                       #ifdef DEBUG
              
                        printf("count value is %d\n%d\n",periph_link_cnt,err_code);
                       #endif
                 }
//              periph_link_cnt =  ble_conn_state_peripheral_conn_count();
              if(!periph_link_cnt)
               {
                  buzzer_for_pair= 1;
                  Buzzer_on_period_for_pairing(&buzzer_for_pair);
                  #ifdef DEBUG
                    printf("deallocation success\n");
                   #endif

               }
             }
        }





ERROR 12290 [Unknown error code] at (null):0
PC at: 0x00000000

Hello,

  Please check this code for BLE disconnection.When peripheral tries to disconnect from the central , it is disconnect successfully the first time but second time it gives an unknown error and   the  whole controller resets.Please do reply to this.

Thanks & Regards,

  Suman

Parents Reply
  • Error code i am getting is 12290 which is not mentioned in any error definition file. where as in my case 

    below debug prints i have checked. :

    Peripheral link cnt:1           // Connected device 1

    Peripheral link cnt:2          //connected device 2

    key 5 long press              //Whenever key 5 pressed start disconnection of each handle
    total links :2
    error value is 0                //Disconnected device 1
    count value is 2
    0
    error value is 0
    count value is 1              //Disconnected device 2
    0
    deallocation success     //#iteration 1 success


    Peripheral link cnt:1           // Connected device 1

    Peripheral link cnt:2          //connected device 2

    key 5 long press
    total links :2
    error value is 3002
    ERROR 12290 [Unknown error code] at (null):0
    PC at: 0x00000000

    As shown in above debug strings For first  iteration of connecting devices and disconnecting them gets success . But for second time it is getting error.

    Thanks and regards

Children
Related