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

unable to enter passkey using uart after BLE_GAP_EVT_AUTH_KEY_REQUEST event

hii team,

iam trying to pair my central app with one peripheral device which is generating random passkey while pairing .when central (my App) is sending pairing request to peripheral iam getting BLE_GAP_EVT_AUTH_KEY_REQUEST event then iam trying uart_get to take PASSKEY but when iam calling this UART_GET function my app is stucking in that function and iam unable to enter anything in my uart to get passkey which is required for pairing.please help me how to solve this problem.

thank you.

APP_code:

	case BLE_GAP_EVT_AUTH_KEY_REQUEST:
		printf("Enter 6 DIGIT Passkey \r\n");
		UART_GET(p_ble_evt);
	break;				

void UART_GET(ble_evt_t * p_ble_evt)
{
	uint8_t Passkey[10]="526453",i=0;
	ret_code_t err_code;
	printf(" in req_passkey function \r\n");
	
    while (i <6)
    {
        uint8_t cr;
        while (app_uart_get(&cr) != NRF_SUCCESS){};
        while (app_uart_put(cr) != NRF_SUCCESS){};

        if (cr != 0xD)
        {  
			Passkey[i] = cr;
			i++;
        }
	    else
	    {
		    break;
        }
    }
		
	err_code = sd_ble_gap_auth_key_reply(p_ble_evt->evt.gap_evt.conn_handle,BLE_GAP_AUTH_KEY_TYPE_PASSKEY,Passkey);
	NRF_LOG_INFO(" auth_key _reply err_code : %d \r\n",err_code);
	APP_ERROR_CHECK(err_code);
}
Parents
  • i given the case(BLE_GAP_EVT_AUTH_KEY_REQUEST) above when iam getting that case in my application iam trying to open my UART to enter PASSKEy(because my peripheral generating random PASSKEY so.)it is not allowing me to enter anything and it is not going for further events also.but if i use same function to enter PASSKEY before starting the scan it is working but during event it is not working.and if i dont enter any PASSKEY then my pairing will not be done. so please help me in this problem.Petter Myhre..

Reply
  • i given the case(BLE_GAP_EVT_AUTH_KEY_REQUEST) above when iam getting that case in my application iam trying to open my UART to enter PASSKEy(because my peripheral generating random PASSKEY so.)it is not allowing me to enter anything and it is not going for further events also.but if i use same function to enter PASSKEY before starting the scan it is working but during event it is not working.and if i dont enter any PASSKEY then my pairing will not be done. so please help me in this problem.Petter Myhre..

Children
No Data
Related