Hello all,
I'm working with the nRF51 SoCs, with the s130 SoftDevice and SDK12.1.0
I have a BLE Nano from Red Bear Lab that has a nRF51822 doing adv and it expose my own service, when I write a key in one of its characteristics value it opens a door, this works fine when I do this from an Android phone with the nRFConnect app.
Now I am trying to do that without the phone, so I flashed a central code to another BLE Nano that when it receives some external stimulus it starts to scan, connect, discovery, write and finally disconnect from the peripheral device that opens the door.
Using uart for debug and printing a message each time the device go to the ble_evt_dispatch() like this:
static void ble_evt_dispatch(ble_evt_t * p_ble_evt) { printf("ble_evt_dispatch\t"); printf("%x", (int)p_ble_evt->header.evt_id); printf("\r\n"); ble_tnds_c_on_ble_evt(&m_ble_tnds_c, p_ble_evt); on_ble_evt(p_ble_evt); bsp_btn_ble_on_ble_evt(p_ble_evt); ble_db_discovery_on_ble_evt(&m_ble_db_discovery, p_ble_evt); }
printing something like this:
It works well most of the time, but some times the central device start scanning, then it connects to the peripheral device, and for an unknown the next dispatch event is the BLE_GAP_EVT_DISCONNECTED, this means that for some reason it connects and then disconnects without discovering the peripheral services,
I also tried the solution to the issue explained in this question.
I was wondering if anyone could help me understand what's going on.
thanks
Edited: second image fixed, changing the numbers from decimal to hexadecimal