Hello all,
I am trying to get the address of the scanner sent a scan request to my nRF52840 running as a peripheral and advertising. I am using SDK 15.0 and I have tried SoftDevice S140 v6.0 and also v6.1. I am using the BLE_GAP_EVT_SCAN_REQ_REPORT event and trying to extract the peer address. If it matches my RPi MAC address, it is supposed to turn on the LED on the eval board, however the LED does not turn on...
Here is my setup: I have an nRF52840 USB dongle eval board running and advertising. I have a Raspberry Pi 4 that is sending active scan requests to my eval board once every 10 seconds. I know that the Raspberry Pi is successfully sending the scan request, because it is reporting the extended UUID that my nRF52840 is advertising in its scan response. However, the LED on the nRF52840 eval board is not coming on. The raspberry pi Bluetooth MAC address is DC:A6:32:xx:xx:xx.
I read the documentation, and found that the event I need is BLE_GAP_EVT_SCAN_REQ_REPORT. I started with the BLE_app_blinky example as my foundation. Here is a snippet of my code:
Here, I enable the scan_req_notification event in the advertising_init function.
Here, I have the main logic for for checking scan request peer's address, and turning on the LED if the first byte of the peer MAC address matches what I expect. First byte of my RPi MAC address is 0xDC=220 integer:
I do think that we are going into the BLE_GAP_EVT_SCAN_REQ_REPORT event handler, but the peer address reported is just not matching what I expected. If I move the "turn on the LED" line outside of the if statement that checks for peer address, the LED does come on soon after I power up the device. That's how I know that the BLE_GAP_EVT_SCAN_REQ_REPORT event is being triggered. I have the USB dongle eval board, so I am not able to see any of the NRF log items unfortunately, which limits my debugging capability greatly.
I hope you can point out what I am missing here. Thanks!