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

Problem with direct advertising

Hi. I need to use direct advertising option in my application to minimize the time needed to establish the connection. Firstly, I set up the connection during "normal" fast connectable indirect advertising, where central and peripheral devices are being paired and bonded together with the help of device manager and the address of central is captured for later direct reconnection (I skip the issue of whitelist on central at this moment). Both of them (I mean central and peripheral devices) are programmed in nrf51822, and these parts of programs work properly. I think so, because I check device manager events on peripheral device and after power cycling both of them (central and peripheral devices) I get an event DM_EVT_SECURITY_SETUP_COMPLETE during first connection. After bonding they are disconnected and I’m trying to reconnect them later. Peripheral device starts to advertise to address that was collected previously and at this moment I have the problem, because connection cannot be established. What's more, if I change the advertising type to connectable indirect advertising, the connection is established pretty quickly, but that is only a way around, not a solution.

sec_params for device manager module in both, central and peripheral are the same:

SEC_PARAM_BOND             1                                  
SEC_PARAM_MITM             0                                  
SEC_PARAM_LESC             0
SEC_PARAM_KEYPRESS         0                                 
SEC_PARAM_IO_CAPABILITIES  BLE_GAP_IO_CAPS_NONE              
SEC_PARAM_OOB              0                                  
SEC_PARAM_MIN_KEY_SIZE     7                                  
SEC_PARAM_MAX_KEY_SIZE     16

I collect a peer address in on_ble_evt when BLE_GAP_EVT_CONNECTED event has occurred:

addr = p_ble_evt->evt.gap_evt.params.connected.peer_addr;

I display that address and it is correct, I pass it on to SoftDevice in Little Endian notation in ble_advertising_peer_addr_reply function. I use SDK 11.0 and SD S130.

Sorry for long-winded boring essay, but I want to explain the problem and circumstances properly. Thanks for any help :).

Related