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

No direct advertising possible. Peer_id is always 0 after bonding.

Hello,

I'm developing a BLE Application where I use the peer manager. My Goal is to use direct advertising after disconnection if a device already has bonded. But every time I call

ble_advertising_start(BLE_ADV_MODE_DIRECTED);

it doesn't work and the device advertises with BLE_ADV_MODE_FAST. I think that is because in this function

adv_mode_next_avail_get() 

this function

addr_is_valid(m_peer_address.addr); 

always returns false.

While I initialize the peer manager I use the following security parameters:

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

While debugging I've seen that every time I try to bond from the side of the smartphone, I receive the PM_EVT_CONN_SEC_SUCCEEDED event, but when I look at the peer_id: pEvt->peer_id is always 0.

I'm thankful for any advice.

Regards Lea

Related