This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Broadcaster/observer low level implementation

In one of my current projects, I need:

  • to have access to more than 8 kB of RAM (which is not possible when using SoftDevice)
  • to have Observer role (which apparently is not implemented in SoftDevice)

Since I don't use any other functionality from the SoftDevice, I decided to implement the Observer and to reimplement the Broadcaster roles. After reading the specification Bluetooth Low Energy Link Layer and nRF51822 RADIO specification I developed a little firmware that makes passive scanning in the advertise channels 37, 38 and 39 using a 1 second scanWindow and 2 seconds scanInterval.

To evaluate my implementation I put BlueZ 5.x to do advertising and I checked with another BlueZ 5.x if the advertising is correct. Then I put my firmware (source code attached) to run. Although the packet are apparently received, their contents are wrong (check the attached log):

  • received packets are different in each channel
  • CRC check fails
  • invalid header fields (PDU type, TxAdd, RxAdd, ...)
  • invalid payload (it doesn't contains the advertiser address 00:1B:DC:05:4B:DF)

I tried to put a lot of comments in the source file but english is not my first language, so I apologize in advance for any linguistic mistake.

What can I do to fix my firmware?

log.txt

main.c

  • Your code looks good in general, and I suspect that the only thing you're missing is to set the data whitening initialization vector. See section 3.2 in the Core Specification, Volume 6, part B.

    Setting this on the nRF51 can be done by just setting the DATAWHITEIV register the channel number (i.e. 37 for the first advertising channel). Doing so, it seems to me that your code is working fine.

    Just out of curiosity, is there any particular reason you're using defines instead of regular functions?

  • Thank you! Setting the DATAWHITEIV register did it.

    About your question, no particular reason. In my current version, I already replaced all of them with functions.

  • Can you post up a fixed version of your main.c. Your posed code so far has been useful. I'd like to see how you did it. I'm currently setting NRF_RADIO->DATAWHITEIV = (channel << 1) + 1; but this doesn't seem to do it. also tried setting to just the channel, as suggested below and also no sucess.

  • Answering my own question.

    setting NRF_RADIO->DATAWHITEIV = (37); for say channel 37 does work correctly

  • Hi Ole

    Since the previous post, i'd like to implement the low level advertising part.

    Which one is the Nordic S110 low level library that implements low level broadcasting ? Or is there a Nordic lib else than nrf51.h or an existing documentation that i can study as a starting point, in order to understand how S110 implements low level broadcasting ?

    Thanks in advance, Arnaud

Related