Nrf51x Communication

The simple-mesh seem like a great protocol for me to play with but since this is all new to me, it feels a little bit overwhelm with all of the information. Would be great to see a stripped down example of how a nrf51 communicate directly to another nrf51. This would provide a good start for someone who just beginning to experiment with the nrf line and a good basic understanding of the inner working of simple mesh.

Yes, sure, I’ll prepare some examples, keep in mind it’s not anyhow different that from what you know on the ESP RF, each device has an MAC address filter and can send and receive with freq set in a register that’s all.
The simple mesh protocol I’ve written is based on the basic functions of the Nordic’s Enhanced Shock Burst files, I had to make adaptations for the packet format, but if you understand this file, this is the lowest layer of the SW, the rest can be deduced :

On the other hand, if you want to work with Radio on nRF5x, there’s no way around reading the Datasheet of the Radio peripheral at least once, everything will become easy to understand

Page 308
6.20 RADIO — 2.4 GHz radio

then you can compare that with the packet format I defined for “simple mesh” which is a configuration of the raw RF packets

Start with that, then I’ll provide more examples on how the simple mesh is running, note the Zephyr port is not complete, I have a more complete nRF-SDK version but I’m no longer using the nRF SDK.

Here are more details about the old SensorTag using the nRF-SDK
This is the line that sends the battery value from the application

And this is the function that packs the data and send it

This is the function that does the opposite to unpack the data on reception

In the new gen based on Zephyr, I stopped messing around with binary protocols and started using json for data serdes as text, which might take more bytes in the packets but up to 250 bytes of RF packets it is no longer an issue. When I started with the first nRF24 generation I was limited to 32 bytes and then the binary protocol was necessary.
So now it’s as simple as

And with that you save the pain and effort of writing a deserialiser on your server side and you can feed this data directly your your app.

thanks. this is great information. i’ll look into it as soon as i can program my nrf51

So im having issues with my JTag. idk how to use it. and couldn’t find any information on flashing an nrf51. Do u know where can i find a very very simple code that shows how I can make a device to broadcast and another device to listen? thanks.

This does not look good, never seen this.

  • First to answer your questions, I recommand the command line tool from Nordic, you can flash with nrfjprog
  • you can also flash with the jlink here the manual, see section 5

examples here

which physical device did you actually connect, a Segger J-Link Edu mini ? Or something else ? If it does not work, it’s easy they have a forum and provide also private technical support