Hi Pritish, On 16 March 2017 at 23:11, Pritish Gandhi <prit...@aylanetworks.com> wrote:
> Hi Will, > I'm not building the controller lib for the image that runs on the > stm32f4Discovery board. I'm building it as a Host Only. So I build the > host, HCI, and uart transport. Broadcom's Bluetooth core is really a > BlackBox to me, I don't have any way to debug what's going on there (except > maybe using a BLE sniffer and seeing packets going out on the interface) > Thanks, > Pritish > Actually for this issue it would be nice to get air logs . The low cost way for getting it is to use Wireshark together with nRF sniffer ( https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF-Sniffer). I'm using that: https://www.adafruit.com/product/2267 but nrf51 dev board should also work. > On Thu, Mar 16, 2017 at 2:48 PM, will sanfilippo <wi...@runtime.io> wrote: > > > I do not think there is a simple way to debug this. As Chris points out, > > the first problem is a LL control procedure timeout. I think I can help > > figure some things out there. There is a function called > > ble_ll_ctrl_proc_rsp_timer_cb. If you set a breakpoint at this function > in > > the debugger when you get the first error you can examine the connection > > state machine. The parameter passed in to that function is an event and > > ev->ev_arg is a pointer to the connection state machine. In the debugger, > > just dump ev_arg after typecasting it to a connection state machine: p/x > > (struct ble_ll_conn_sm *)ev->ev_arg > > > > I presume you are OK with using gdb? I would ‘set print pretty on’ before > > dumping the connection state machine. If you send me the output of that I > > might be able to help. > > > > Thanks > > > > > On Mar 16, 2017, at 2:30 PM, Christopher Collins <ch...@runtime.io> > > wrote: > > > > > > Hi Pritish, > > > > > > On Thu, Mar 16, 2017 at 01:50:12PM -0700, Pritish Gandhi wrote: > > >> Hi All, > > >> I'm trying to run blecent on an nrf52dk and am running the bleprph > > >> application on another BLE module (stm32f4discovery talking to a > > broadcom > > >> BLE core). Anyways, when try to run blecent it seems like I > successfully > > >> connect to the peripheral and are able to discover it, however after > > that > > >> the connection seems to be timing out and then am never able to > discover > > >> the peripheral again. > > > > > > [...] > > > > > > Hmm, that is odd, indeed. The disconnect reason codes you are seeing > > > are mapped as follows: > > > > > > 546 - LMP RESPONSE TIMEOUT / LL RESPONSE TIMEOUT > > > 520 - CONNECTION TIMEOUT > > > > > > I'm afraid I don't have any ideas at the moment. Could you please > > > clarify the setup you are using? Here is my understanding: > > > > > > Device A: blecent on nRF52dk (combined host-controller) > > > Device B: > > > * bleprph on stm32f4discovery (host-only) > > > * broadcom controller > > > > > > Is that correct? If so, I assume the host and controller on device B > > > communicate via UART? > > > > > > Thanks, > > > Chris > > > > > >> > > >> 1) Connected and Discovered the bleprph: > > >> > > >> 37493:[ts=292914004ssb, mod=4 level=1] GAP procedure initiated: > > discovery; > > >> own_addr_type=0 filter_policy=0 passive=1 limited=0 > filter_duplicates=1 > > >> duration=forever > > >> > > >> 37503:[ts=292992124ssb, mod=4 level=1] GAP procedure initiated: > connect; > > >> peer_addr_type=0 peer_addr=aa:aa:aa:aa:aa:aa scan_itvl=16 > scan_window=16 > > >> itvl_min=24 itvl_max=40 latency=0 supervision_timeout=256 > min_ce_len=16 > > >> max_ce_len=768 own_addr_ty > > >> > > >> 37517:[ts=293101556ssb, mod=64 level=1] Connection established > > >> > > >> 37519:[ts=293117180ssb, mod=4 level=1] GATT procedure initiated: > > discover > > >> all services > > >> > > >> 37588:[ts=293656208ssb, mod=4 level=1] GATT procedure initiated: > > discover > > >> all characteristics; start_handle=1 end_handle=11 > > >> > > >> 37627:[ts=293960876ssb, mod=4 level=1] GATT procedure initiated: > > discover > > >> all characteristics; start_handle=12 end_handle=15 > > >> > > >> 37658:[ts=294203112ssb, mod=4 level=1] GATT procedure initiated: > > discover > > >> all characteristics; start_handle=16 end_handle=19 > > >> > > >> 37684:[ts=294406224ssb, mod=4 level=1] GATT procedure initiated: > > discover > > >> all characteristics; start_handle=20 end_handle=32 > > >> > > >> 37722:[ts=294703080ssb, mod=4 level=1] GATT procedure initiated: > > discover > > >> all characteristics; start_handle=33 end_handle=65535 > > >> > > >> 37761:[ts=295007812ssb, mod=4 level=1] GATT procedure initiated: > > discover > > >> all descriptors; chr_val_handle=14 end_handle=15 > > >> > > >> 37774:[ts=295109368ssb, mod=4 level=1] GATT procedure initiated: > > discover > > >> all descriptors; chr_val_handle=18 end_handle=19 > > >> > > >> 37786:[ts=295203112ssb, mod=4 level=1] GATT procedure initiated: > > discover > > >> all descriptors; chr_val_handle=24 end_handle=25 > > >> > > >> 37799:[ts=295304668ssb, mod=4 level=1] GATT procedure initiated: > > discover > > >> all descriptors; chr_val_handle=29 end_handle=30 > > >> > > >> 37812:[ts=295406224ssb, mod=4 level=1] GATT procedure initiated: > > discover > > >> all descriptors; chr_val_handle=37 end_handle=65535 > > >> > > >> 37825:[ts=295507780ssb, mod=64 level=3] Service discovery complete; > > >> status=0 conn_handle=1 > > >> > > >> 2) Read/Write/Subscribe for notifications. Finally fails with > reason=546 > > >> > > >> 37827:[ts=295523404ssb, mod=4 level=1] GATT procedure initiated: read; > > >> att_handle=22 > > >> > > >> 37829:[ts=295539028ssb, mod=4 level=1] GATT procedure initiated: > write; > > >> att_handle=32 len=2 > > >> > > >> 37832:[ts=295562464ssb, mod=4 level=1] GATT procedure initiated: > write; > > >> att_handle=30 len=2 > > >> > > >> 37851:[ts=295710892ssb, mod=64 level=1] Read complete; status=0 > > >> conn_handle=1 attr_handle=22 value= > > >> > > >> 37857:[ts=295757764ssb, mod=64 level=1] Write complete; status=0 > > >> conn_handle=1 attr_handle=32 > > >> > > >> 37863:[ts=295804636ssb, mod=64 level=1] Subscribe complete; status=0 > > >> conn_handle=1 attr_handle=30 > > >> > > >> 42637:[ts=333101556ssb, mod=64 level=1] disconnect; reason=546 > > >> > > >> > > >> 3) Once it disconnects, blecent gets stuck in this loop of trying to > > >> discover, but the discovery always fails: > > >> > > >> 42638:[ts=333109368ssb, mod=4 level=1] GAP procedure initiated: > > discovery; > > >> own_addr_type=0 filter_policy=0 passive=1 limited=0 > filter_duplicates=1 > > >> duration=forever > > >> > > >> 42973:[ts=335726516ssb, mod=4 level=1] GAP procedure initiated: > connect; > > >> peer_addr_type=0 peer_addr=aa:aa:aa:aa:aa:aa scan_itvl=16 > scan_window=16 > > >> itvl_min=24 itvl_max=40 latency=0 supervision_timeout=256 > min_ce_len=16 > > >> max_ce_len=768 own_addr_ty > > >> > > >> 42982:[ts=335796824ssb, mod=64 level=1] Connection established > > >> > > >> 42983:[ts=335804636ssb, mod=4 level=1] GATT procedure initiated: > > discover > > >> all services > > >> > > >> 43020:[ts=336093744ssb, mod=64 level=3] Error: Service discovery > failed; > > >> status=7 conn_handle=1 > > >> > > >> 43022:[ts=336109368ssb, mod=4 level=1] GAP procedure initiated: > > terminate > > >> connection; conn_handle=1 hci_reason=19 > > >> > > >> 43025:[ts=336132804ssb, mod=64 level=1] disconnect; reason=520 > > >> > > >> 43027:[ts=336148428ssb, mod=4 level=1] GAP procedure initiated: > > discovery; > > >> own_addr_type=0 filter_policy=0 passive=1 limited=0 > filter_duplicates=1 > > >> duration=forever > > >> > > >> 43038:[ts=336234360ssb, mod=4 level=1] GAP procedure initiated: > connect; > > >> peer_addr_type=0 peer_addr=aa:aa:aa:aa:aa:aa scan_itvl=16 > scan_window=16 > > >> itvl_min=24 itvl_max=40 latency=0 supervision_timeout=256 > min_ce_len=16 > > >> max_ce_len=768 own_addr_ty > > >> > > >> 43046:[ts=336296856ssb, mod=64 level=1] Connection established > > >> > > >> 43047:[ts=336304668ssb, mod=4 level=1] GATT procedure initiated: > > discover > > >> all services > > >> > > >> 43084:[ts=336593712ssb, mod=64 level=3] Error: Service discovery > failed; > > >> status=7 conn_handle=1 > > >> > > >> 43086:[ts=336609336ssb, mod=4 level=1] GAP procedure initiated: > > terminate > > >> connection; conn_handle=1 hci_reason=19 > > >> > > >> 43089:[ts=336632772ssb, mod=64 level=1] disconnect; reason=520 > > >> > > >> 43091:[ts=336648396ssb, mod=4 level=1] GAP procedure initiated: > > discovery; > > >> own_addr_type=0 filter_policy=0 passive=1 limited=0 > filter_duplicates=1 > > >> duration=forever > > >> > > >> 43101:[ts=336726516ssb, mod=4 level=1] GAP procedure initiated: > connect; > > >> peer_addr_type=0 peer_addr=aa:aa:aa:aa:aa:aa scan_itvl=16 > scan_window=16 > > >> itvl_min=24 itvl_max=40 latency=0 supervision_timeout=256 > min_ce_len=16 > > >> max_ce_len=768 own_addr_ty > > >> > > >> Any ideas whats going on and how to debug this further? > > >> The only way to recover seems to be to reset my bleprph device. > > >> Appreciate the help, > > >> Pritish > > > > >