Is there a calling context restriction for sd_ble_gap_connect()? Either in the function call or where the peer address pointer is in memory?
I based my Central project off the reference one in SDK 8.1.0, specifically in \examples\ble_central\ble_app_hrs_c\main.c
but I moved the storage of the peer_addr to my own RAM and I make the call to sd_ble_gap_connect() from my while(1) loop in main.c
sd_ble_gap_connect() does not return any error but I also never see a DM_EVT_CONNECTION event in the device manager handler. Thus, no connection to the peer. And no timeout event, either.
However, if I alter the code in my example to match the SDK example, that is: to make the call to sd_ble_gap_connect() from within the BLE_GAP_EVT_ADV_REPORT event in the on_ble_event() handler, with a pointer to the peer address provided in as a parameter to that handler, it DOES connect.
What is going on here? I have been fighting this for five days and this is my first hint at solving the issue.
Thanks Nordic techs for your help. Dan