{"action":"created","issue":{"url":"https://api.github.com/repos/mbedmicro/nRF51822/issues/24","labels_url":"https://api.github.com/repos/mbedmicro/nRF51822/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/mbedmicro/nRF51822/issues/24/comments","events_url":"https://api.github.com/repos/mbedmicro/nRF51822/issues/24/events","html_url":"https://github.com/mbedmicro/nRF51822/issues/24","id":93675424,"number":24,"title":"Target polling failed","user":{"login":"leibin2014","id":9861776,"avatar_url":"https://avatars.githubusercontent.com/u/9861776?v=3","gravatar_id":"","url":"https://api.github.com/users/leibin2014","html_url":"https://github.com/leibin2014","followers_url":"https://api.github.com/users/leibin2014/followers","following_url":"https://api.github.com/users/leibin2014/following{/other_user}","gists_url":"https://api.github.com/users/leibin2014/gists{/gist_id}","starred_url":"https://api.github.com/users/leibin2014/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leibin2014/subscriptions","organizations_url":"https://api.github.com/users/leibin2014/orgs","repos_url":"https://api.github.com/users/leibin2014/repos","events_url":"https://api.github.com/users/leibin2014/events{/privacy}","received_events_url":"https://api.github.com/users/leibin2014/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-08T02:31:45Z","updated_at":"2015-07-08T06:04:41Z","closed_at":null,"body":"Dear,\r\n\r\nWe are using nrf51822 for products of our company. We use mbed + nRF51822 driver + BLE_API for the BLE peripheral devices. We use OpenOCD+GDB for SWD interface as debugging tool. In OpenOCD the target is polled each 100ms. Previously everything is fine. But recently the target is always polled failed in several seconds after getting BLE_GAP_EVT_AUTH_STATUS event.\r\n\r\nThis problem is cause by updating the nRF51822 driver and BLE_API to the latest version( with softdevice s130 ver 1.0.0). If roll back to the old version with s110 v7.1.0, this problem is gone. I also tried replacing s130 with s110 v8.0.0 in the latest nRF51822 driver, the problem is still there.\r\n\r\nOur application for the peripheral device is as below:\r\n\r\n1. In debugging mode, connect peripheral device to central device.\r\n\r\n2. After getting CONNECTED events, trigger security(BLE_GAP_CONN_SEC_MODE_SET_ENC_WITH_MITM).\r\n\r\n3. Then will get BLE_GAP_EVT_CONN_SEC_UPDATE and BLE_GAP_EVT_AUTH_STATUS events. And then sending and receiving packets frequently.\r\n\r\n4. Several seconds after getting BLE_GAP_EVT_AUTH_STATUS event, the OpenOCD detect that the target can't be polled successfully. Then the OpenOCD will halt debugging. But after several seconds, the target can be polled again.\r\n\r\nSo my question is what cause this problem? Anything related SWD or debugging stuff was changed when nRF51822 driver was updated from  s110 v7.1.0 to s130 v1.0.0(or s110 v8.0.0)?\r\n\r\nIf any more information you need please feel free to let me know.\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/mbedmicro/nRF51822/issues/comments/119448457","html_url":"https://github.com/mbedmicro/nRF51822/issues/24#issuecomment-119448457","issue_url":"https://api.github.com/repos/mbedmicro/nRF51822/issues/24","id":119448457,"user":{"login":"leibin2014","id":9861776,"avatar_url":"https://avatars.githubusercontent.com/u/9861776?v=3","gravatar_id":"","url":"https://api.github.com/users/leibin2014","html_url":"https://github.com/leibin2014","followers_url":"https://api.github.com/users/leibin2014/followers","following_url":"https://api.github.com/users/leibin2014/following{/other_user}","gists_url":"https://api.github.com/users/leibin2014/gists{/gist_id}","starred_url":"https://api.github.com/users/leibin2014/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leibin2014/subscriptions","organizations_url":"https://api.github.com/users/leibin2014/orgs","repos_url":"https://api.github.com/users/leibin2014/repos","events_url":"https://api.github.com/users/leibin2014/events{/privacy}","received_events_url":"https://api.github.com/users/leibin2014/received_events","type":"User","site_admin":false},"created_at":"2015-07-08T06:04:41Z","updated_at":"2015-07-08T06:04:41Z","body":"Some more discovery:\r\nThere is a API btle_initializeSecurity() in the latest nRF51822 driver. Currently I use this API for init Security, then meet the target polling failed problem. In API btle_initializeSecurity() it calls functions pstorage_init(), sd_ble_opt_set(BLE_GAP_OPT_PASSKEY, &opts) and dm_init().\r\nThere wasn't such a API in the old code. I just called sd_ble_opt_set(BLE_GAP_OPT_PASSKEY, &opts), didn't call pstorage_init() and  dm_init(). Didn't meet this problem in the old code.\r\nSo looks like this problem is related to pstorage or device manager process. "}}