This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Detecting extended advertisements on nRF52840

Hello, I am working on detecting extended advertisements on the nRF52840, with the extended advertisements coming from a Google Pixel 2 phone.

I am basing my program on this example that was posted by someone else on this forum, https://github.com/nicslabdev/NRF52840-Beacon_Scanner/tree/master/Beacon_scanner/pca10056/s140/ses, and trying to print all of the data that is being advertised by my Android phone.

The strange thing is, it seems that I am only able to print the first advertisement data packet from the phone, even though both the primary and secondary PHY channels of advertisement on the phone are set to the 1MB/s PHY, and that is the PHY that my nRF52840 is scanning on. 

I am quite sure that the nRF52840 is only detecting the first packet of advertisement because the Android API's allowed me to define data to put into the advertising packet up to 1550 bytes, and I made the data so that the first 155 bytes are 0's, the next 155 bytes are 1's, etc, just so that I could tell on the nRF52840 whether it was receiving all packets or just the first.

It seems that the nrF52840 is only printing the first packet, as I can see a few bytes of advertisement followed by a lot of zeros, but no 1's or 2's, etc.

In case it helps, here is the code that I am using to print the advertisement on the nRF52840 side; perhaps I am doing something wrong here?

...

static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
{

switch (p_ble_evt->header.evt_id)
{
case BLE_GAP_EVT_ADV_REPORT:
{

NRF_LOG_INFO("Length of scan buffer: %d", m_scan.scan_buffer.len);
if (m_scan.scan_params.extended) {
NRF_LOG_INFO("The advertisement we detected was extended.");
}
NRF_LOG_RAW_HEXDUMP_INFO (m_scan.scan_buffer.p_data, m_scan.scan_buffer.len);
NRF_LOG_RAW_INFO ("----------------------------------\r\n");
}

default:
break;
}
}

...

I also think I should ask, are there any examples anyone knows of to have two nrf52840 boards exchange large amounts of information (i.e., at least more than the 31 byte limit of advertisement payload in legacy BLE) using extended advertisements? My use case is to be able to broadcast network layer packets over BLE 5 between constrained devices like the nRF52840. The main challenge that I am running into right now is actually getting all of the data advertised by extended advertising on the nrf52840.

Thank you.

Related