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 Children
  • 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

  • The codes are (sometimes) defined relative to a "base" - so the value 12290 may not appear directly in the source.

    But the documentation for sd_ble_gap_disconnect() will list its possible return codes - you should be able to work from there ...

  • That is what my question is . 

    what exactly the error wants to say.?

    sd_ble_ga_disconnect function description gives 

    @retval ::NRF_SUCCESS The disconnection procedure has been started successfully.
    * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
    * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
    * @retval ::NRF_ERROR_INVALID_STATE Disconnection in progress or link has not been established.
    */

    where  the error i am getting is not defined. or if i am  not getting it right please tell me the correct method to check the error logs. 

    Thanks and regards

  • So have you looked up those 4 codes to see if any of them has the value 12290 ?

    Or even tried putting "12290" into a forum search ... ?

    You seem to have forgotten how to post source code?

  • Hi,

    12290 or 0x3002 corresponds to BLE_ERROR_INVALID_CONN_HANDLE so seems like you are trying to disconnect with an invalid connection handle. I suggest that you check what the connection handle value is when you get the error. 

Related