Giter Club home page Giter Club logo

Comments (8)

MaartenJB avatar MaartenJB commented on July 22, 2024 1

Aah ok, what I read from that is the more the bit pattern differs from the preamble, the easier it is for the receiver to calibrate to the signal. And if the first part of the byte is already different, that should be sufficient for the reader to do that.

from rf24.

2bndy5 avatar 2bndy5 commented on July 22, 2024 1

Exactly. Hope you don't mind if I close this issue now.

from rf24.

2bndy5 avatar 2bndy5 commented on July 22, 2024

There's a little more to it. Arrays in C++, like an array of characters (aka string), are stored in memory using little endian. Fortunately, the nRF24L01 expects the address (& payloads) to be transferred over SPI in little endian... Essentially, "1Node" is stored is as 0x65646F4E31. This is why printDetails() (and printPrettyDetails()) outputs the addresses bytes backwards:

>>> from pyrf24 import RF24
>>> radio = RF24(22, 0)
>>> radio.begin()
True
>>> radio.openReadingPipe(1, b"1Node")
>>> radio.printPrettyDetails()
# [... omitted data for brevity ...]
TX address              = 0x65646f4e31
pipe 0 ( open ) bound   = 0x65646f5555
pipe 1 ( open ) bound   = 0x65646f4e31
pipe 2 (closed) bound   = 0x0a
pipe 3 (closed) bound   = 0xa0
pipe 4 (closed) bound   = 0x00
pipe 5 (closed) bound   = 0xab

to see it binary (again using python for brevity)

>>> address = b'edoN1'
>>> [bin(x) for x in address]
['0b1100101', '0b1100100', '0b1101111', '0b1001110', '0b110001']

so

char binary
e 01100101
d 01100100
o 01101111
N 01001110
1 00110001

Given that 1 in binary starts with a 0011, it is not as problematic as anything that starts with a 1010 or 0101.

I would be more concerned with addresses that start with T

>>> bin(b'T'[0])
'0b1010100'

from rf24.

2bndy5 avatar 2bndy5 commented on July 22, 2024

Also, note the scanner examples use the worst possible addresses (with an unofficially supported length of 2 bytes) on purpose:

# To detect noise, we'll use the worst addresses possible (a reverse engineering
# tactic). These addresses are designed to confuse the radio into thinking that the
# RF signal's preamble is part of the packet/payload.
noise_address = [
b"\x55\x55",
b"\xaa\xaa",
b"\x0a\xaa",
b"\xa0\xaa",
b"\x00\xaa",
b"\xab\xaa",
]

This why my output above has 0x55 set to pipe 0 MSB because I last ran the scanner example for testing.

from rf24.

MaartenJB avatar MaartenJB commented on July 22, 2024

wow, fast response :-) thx.

Is the letter 'e' not as problematic because only the last nibble is 0101 ? The article only mentioned to not use these four nibbles.

from rf24.

2bndy5 avatar 2bndy5 commented on July 22, 2024

Is the letter 'e' not as problematic because only the last nibble is 0101 ?

No, because it starts with a 0110. In general, anything that starts with a repeating and alternating pattern of 1 and 0. should be avoided. Recall what the datasheet says:

7.3.1 Preamble
The preamble is a bit sequence used to synchronize the receivers demodulator to the incoming bit stream. The preamble is one byte long and is either 01010101 or 10101010. If the first bit in the address is 1 the preamble is automatically set to 10101010 and if the first bit is 0 the preamble is automatically set to 01010101. This is done to ensure there are enough transitions in the preamble to stabilize the receiver.

The article that the docs link to is a bit more empirical as it is written from observations/experiments.

from rf24.

2bndy5 avatar 2bndy5 commented on July 22, 2024

Other radio's may actually use a 2-byte (or more) preamble. IIRC, the RFM69 uses 2-4 byte preambles, but they are sub-GHz transceivers (so they might require longer time to demodulate signals seen from the antenna).

from rf24.

MaartenJB avatar MaartenJB commented on July 22, 2024

Sure, thanks for the fast detailed explanation!

from rf24.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.