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

Bonding Passkey Entry (Central display) or OOB

hi,everyone. I try to use ble urat sample for bonding by passkey entry. and connection established and to bond. i try to entry passkey by uart. but when i key the passkey and go to service discovery . it can't work correctly. (see follow attachment file), can't send string ble to device.

how to i revise this ? is the service Characteristics need to do some thing? not go to ble_nus_on_ble_evt() BLE_GATTS_EVT_WRITE event,

2.what is O.O.B? how to use this?

http://img707.imageshack.us/i/7ses.png/

code :

	
//init
#define SEC_PARAM_BOND                  1                                           /**< Perform bonding. */
#define SEC_PARAM_MITM                  1                                           /**< Man In The Middle protection not required. */
#define SEC_PARAM_IO_CAPABILITIES       BLE_GAP_IO_CAPS_KEYBOARD_ONLY  


//ble event handle			
case BLE_GAP_EVT_AUTH_KEY_REQUEST :
simple_uart_putstring("BLE_GAP_EVT_AUTH_KEY_REQUEST...\n");
while(iCount<6)
{
while (NRF_UART0->EVENTS_RXDRDY != 1)
{
// Wait for RXD data to be received
}							
NRF_UART0->EVENTS_RXDRDY = 0;
auth_key[iCount++]= (uint8_t)NRF_UART0->RXD;
}	
simple_uart_putstring("exit...\n");
err_code=sd_ble_gap_auth_key_reply(p_ble_evt->evt.gap_evt.conn_handle,BLE_GAP_AUTH_KEY_TYPE_PASSKEY ,auth_key);
APP_ERROR_CHECK(err_code);							
break;

ble_app_uart.zip

Parents
  • hi,

    i think that is interrupt priorities issue. when i try to disable the UART interrupt when the BLE_GAP_EVT_AUTH_KEY_REQUEST event. the program will be send to data to ble. but can't Receive data from RxD(because i have disable uart interrupt).

    
    //ble event handle			
    case BLE_GAP_EVT_AUTH_KEY_REQUEST :
    simple_uart_putstring("BLE_GAP_EVT_AUTH_KEY_REQUEST...\n");
    sd_nvic_DisableIRQ(UART0_IRQn);
    while(iCount<6)
    {
    while (NRF_UART0->EVENTS_RXDRDY != 1)
    {
    // Wait for RXD data to be received
    }							
    NRF_UART0->EVENTS_RXDRDY = 0;
    auth_key[iCount++]= (uint8_t)NRF_UART0->RXD;
    }	
    simple_uart_putstring("exit...\n");
    err_code=sd_ble_gap_auth_key_reply(p_ble_evt->evt.gap_evt.conn_handle,BLE_GAP_AUTH_KEY_TYPE_PASSKEY ,auth_key);
    APP_ERROR_CHECK(err_code);							
    break;
    
    
Reply
  • hi,

    i think that is interrupt priorities issue. when i try to disable the UART interrupt when the BLE_GAP_EVT_AUTH_KEY_REQUEST event. the program will be send to data to ble. but can't Receive data from RxD(because i have disable uart interrupt).

    
    //ble event handle			
    case BLE_GAP_EVT_AUTH_KEY_REQUEST :
    simple_uart_putstring("BLE_GAP_EVT_AUTH_KEY_REQUEST...\n");
    sd_nvic_DisableIRQ(UART0_IRQn);
    while(iCount<6)
    {
    while (NRF_UART0->EVENTS_RXDRDY != 1)
    {
    // Wait for RXD data to be received
    }							
    NRF_UART0->EVENTS_RXDRDY = 0;
    auth_key[iCount++]= (uint8_t)NRF_UART0->RXD;
    }	
    simple_uart_putstring("exit...\n");
    err_code=sd_ble_gap_auth_key_reply(p_ble_evt->evt.gap_evt.conn_handle,BLE_GAP_AUTH_KEY_TYPE_PASSKEY ,auth_key);
    APP_ERROR_CHECK(err_code);							
    break;
    
    
Children
No Data
Related