Lora-net / sx1302_hal

SX1302/SX1303 Hardware Abstraction Layer and Tools (packet forwarder...)
Other
219 stars 272 forks source link

How to set Syncword value for proprietary #59

Closed pauldeng closed 2 years ago

pauldeng commented 2 years ago

Dear @mcoracin,

In LoRaWAN, the Syncword value 0x34 is for public and 0x12 is for private.

In SX130, the Syncword is defined in loragw_hal.c. It is easy to identify and understand at here.

In SX1302, it is defined in loragw_sx1302.c at here. However, it is not that easy to understand. It looks to me:

Can I ask what is the algorithm behind it? Is that 0x68 = 0x34 2 or 0x6,0x8 = 0x3 2, 0x4 * 2.

If I would like to set a proprietary value e.g. 0x2B what should I set here? 0x56 = 0x2B 2 or 0x4, 0x16 = 0x2 2, 0xB * 2

Thanks for your support.

Cheers, Paul

cstratton commented 2 years ago

The recommended syncwords are carefully chosen for distinctness, attempting to use arbitrary values is unlikely to yield good results, especially values chosen without deep understanding of the mechanisms in play.

At a basic level it would appear that the nibbles are being left shifted one position, but there may be more to it than that.

If you really wanted to try other syncwords, you should first read the information about them in all available data sheets, particularly that of the sx126x, sx127x and anything in the less detailed sx1302 and sx1301 sheets.

Then you should probably run some automated tests to see what kind of success rates you get. Likely you'll want to evaluate not only success at picking up the intended synword, but also the number of intentionally mismatching values that leak through (even the traditional public vs private syncwords are likely to see the occasional mismatched packet leak through - it's basically a crude spam filter to avoid wasting decoder, backhaul, and processing bandwidth, the real check is if the packet matches a known node)

And really you should do this with a node that has a 50 ohm resistor in place of an antenna, so that you can reasonably try a lot of packets per unit time without bothering others.

But really, just use the recommended private syncword and depend on the software filtering to distinguish your traffic from other people's.

pauldeng commented 2 years ago

Hi @cstratton ,

Shift 1 bit left does not really work. Checked the datasheets, not much detail about it.

Yeah, I think I need to contact Semtech for support to understand the details behind these carefully selected value.

Thanks for your comprehensive response.

Cheers mate.