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

nRF51822 for real time BLE packet capturing

Hello, I would like to know if I can use nRF51822 chip to get partial BLE packet information like Access Address, PDU before the whole packet has arrived.

If yes how and if any other simple method exists that would be great? Is it possible to modify S130 to do so?

Some directions I have been thinking along are maintaining a bit counter and when it reaches a certain threshold (enough to include access address and some other fields) raising an interrupt and servicing the data available.

Thanks in Advance.

  • Hi

    Is the use case to receive advertising packets, or do you also want to do this in a BLE connection?

    I can't imagine how you could do this when you have a SoftDevice running. When there is SoftDevice activity the SoftDevice will run it's own interrupt routines, and they are assigned the highest priority in the system. This means that you are likely to be delayed until the packet is processed by the SoftDevice, even if you are able to hook up to the radio events and start some timer that counts the bits into the packet.

    If you only need to read advertising packets then it is relatively straight forward to implement the code from scratch, without using the SoftDevice. Then you can implement the radio interrupts as you see fit, and can add a 'pre interrupt' a certain number of bits into the packet.

    One potential problem with this is that you don't know if the CRC is correct (since you haven't yet received it), so there is a possibility that you will process a packet that has bit errors in the payload.

    Best regards
    Torbjørn

  • Hi, Thank you for your reply. My aim is to sniff the conversation between two BLE agents. So, I will need to sniff even the normal packets along with the advertisement ones. But I need the access address and some other data before the whole packet is received by my sniffer. As you suggested, I can write a code from scratch by myself and also implement a CRC check. Could you provide me some links for reference. Other option, I can start from the soft device code and modify it. Which one would be easier?

    Best Regards

  • Hi So essentially you want to make a Bluetooth sniffer from scratch? If so I hope you have a lot of time available, because that sounds like a huge undertaking ;)

    The SoftDevice source code is not provided unfortunately, but there are alternative stacks out there that give you access to the source code.

    One such example is the mynewt stack:
    mynewt.apache.org/.../

  • Can you please provide some references if I plan to implement sniffer from scratch only for advertisement packets.

  • If you download the nRF5 SDK v11 there is an example called experimental_ble_app_multiactivity_beacon, which implements both advertiser and scanner on the register level.

    This example was removed from later SDK's since the SoftDevice was upgraded to support concurrent connections and advertising/scanning.

Related