mwilliford commented on issue #44: Extended Advertisement Issues URL: https://github.com/apache/mynewt-nimble/issues/44#issuecomment-383793992 @sjanc It seems that a patch from @andrzej-kaczmarek helped me read data-status. I have also updated my test code to no longer say "BAD" because @sjanc points out that it is my responsibility to re-assemble the packet on the receive side, so I should build a buffer and wait for complete. Here are the things I did: - Reduced the test size to 256, so each byte is unique and easy to read, it should require 2 aux pdu's. - Reduced BLE_HCI_EVT_BUF_SIZE to 254, per sjanc recommendation, higher is not required. - Also ran test at 500Bytes tx and rx with full HCI debug turned on. Attached file. - I tested with and without filter_duplicates flag to see if that would de-dupe based on DID. Results: with 256byte test: - I often see a packet of aux of 226, then aux of 16 bytes (showing bytes 0x00 = 0xf1), 242 bytes of my 256 byte test pattern. Looks like the aux follows the next aux path to a "next" of 16 bytes - I would think it should fragment based on 226, 30, and fit the adv_ext sequence in 2 aux frames. - I don't see DID part of the AID, so I only see SID. I am not sure how I can re-assemble host side without DID. I understand that I can set SID to differ between sets, but shouldn't controller handle de-duplication based on adv. OH, maybe I need to turn that on? with 500 Byte test: - Similar results, test pattern harder to confirm as it wraps around, but I am pretty sure I don't receive all data. - I also see a value 0x4a in the rawheader of the hci on rx for secondaryphy, which does not seem to be right in the spec. (see attached file). 002910 [ts=22734328ssb, mod=4 level=0] rawhdr =01 20 00 01 b5 13 dc 28 91 cc 00 4a 04 7f de 00 00 00 00 00 00 00 00 00 10 ---------------- Patch applied ``` diff --git a/nimble/host/src/ble_hs_hci_evt.c b/nimble/host/src/ble_hs_hci_evt.c index 6125084..156fc5c 100644 --- a/nimble/host/src/ble_hs_hci_evt.c +++ b/nimble/host/src/ble_hs_hci_evt.c @@ -578,7 +578,7 @@ ble_hs_hci_evt_le_ext_adv_rpt(uint8_t subevent, uint8_t *data, int len) params = &ext_adv->params[0]; for (i = 0; i < num_reports; i++) { - desc.props = (params->evt_type) & 0xFF; + desc.props = (params->evt_type) & 0x1F; if (desc.props & BLE_HCI_ADV_LEGACY_MASK) { legacy_event_type = ble_hs_hci_decode_legacy_type(params->evt_type); if (legacy_event_type < 0) { @@ -587,7 +587,7 @@ ble_hs_hci_evt_le_ext_adv_rpt(uint8_t subevent, uint8_t *data, int len) } desc.legacy_event_type = legacy_event_type; } else { - desc.data_status = params->evt_type >> 8; + desc.data_status = params->evt_type >> 5; } desc.addr.type = params->addr_type; memcpy(desc.addr.val, params->addr, 6); ``` --------- debug info patch ``` diff --git a/nimble/host/src/ble_hs_dbg.c b/nimble/host/src/ble_hs_dbg.c index 646f66f..c256425 100644 --- a/nimble/host/src/ble_hs_dbg.c +++ b/nimble/host/src/ble_hs_dbg.c @@ -149,7 +149,24 @@ ble_hs_dbg_le_event_disp(uint8_t subev, uint8_t len, uint8_t *evdata) BLE_HS_LOG(DEBUG, "PHY update. handle=%u tx=%u rx=%u\n", get_le16(evdata + 1), evdata[3], evdata[4]); break; + case BLE_HCI_LE_SUBEV_EXT_ADV_RPT: + advlen = evdata[9]; + rssi = evdata[10 + advlen]; + BLE_HS_LOG(DEBUG, "\n\nLE EXT ADV Report. len=%u num=%u evtype=%x datastatus=%02x ", + len, evdata[0], get_le16(evdata+1), evdata[1] >> 5 + ); + BLE_HS_LOG(DEBUG,"addrtype=%u addr=%x.%x.%x.%x.%x.%x pphy=%u sphy=%u sid=%u txpow=%u rssi=%u advlen=%u\n", + evdata[3], evdata[9], evdata[8], evdata[7], evdata[6], + evdata[5], evdata[4], + evdata[10], evdata[11], evdata[12], evdata[13], evdata[14], evdata[24] ); + BLE_HS_LOG(DEBUG,"rawhdr ="); + for (int i = 0; i < 25; i++) { + BLE_HS_LOG(DEBUG,"%02x ",evdata[i]); + } + BLE_HS_LOG(DEBUG,"\n"); + + break; default: BLE_HS_LOG(DEBUG, "\tUnknown LE event\n"); break; ```
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services