RAK5146 customize SyncWord

Hello,
I installed RAK5146 firmware from following RAK repo : https://github.com/RAKWireless/rak_common_for_gateway/blob/master/README.md

The PF works fine.

I wanted to change the default private SYNC WORD (0x12) of RAK5146 module.

In source code, I found the following function :

int sx1302_lora_syncword(bool public, uint8_t lora_service_sf)
{
int err = LGW_REG_SUCCESS;

/* Multi-SF modem configuration */
DEBUG_MSG("INFO: configuring LoRa (Multi-SF) SF5->SF6 with syncword PRIVATE (0x12)\n");
err |= lgw_reg_w(SX1302_REG_RX_TOP_FRAME_SYNCH0_SF5_PEAK1_POS_SF5, 2);
err |= lgw_reg_w(SX1302_REG_RX_TOP_FRAME_SYNCH1_SF5_PEAK2_POS_SF5, 4);
err |= lgw_reg_w(SX1302_REG_RX_TOP_FRAME_SYNCH0_SF6_PEAK1_POS_SF6, 2);
err |= lgw_reg_w(SX1302_REG_RX_TOP_FRAME_SYNCH1_SF6_PEAK2_POS_SF6, 4);
if (public == true)
{
    DEBUG_MSG("INFO: configuring LoRa (Multi-SF) SF7->SF12 with syncword PUBLIC (0x34)\n");
    err |= lgw_reg_w(SX1302_REG_RX_TOP_FRAME_SYNCH0_SF7TO12_PEAK1_POS_SF7TO12, 6);
    err |= lgw_reg_w(SX1302_REG_RX_TOP_FRAME_SYNCH1_SF7TO12_PEAK2_POS_SF7TO12, 8);
}
else
{
    DEBUG_MSG("INFO: configuring LoRa (Multi-SF) SF7->SF12 with syncword PRIVATE (0x12)\n");
    err |= lgw_reg_w(SX1302_REG_RX_TOP_FRAME_SYNCH0_SF7TO12_PEAK1_POS_SF7TO12, 2);
    err |= lgw_reg_w(SX1302_REG_RX_TOP_FRAME_SYNCH1_SF7TO12_PEAK2_POS_SF7TO12, 4);
}
return err;

}

The registers used in this function have defined in loragw_reg.h as follow :

#define SX1302_REG_RX_TOP_FRAME_SYNCH0_SF5_PEAK1_POS_SF5 574
#define SX1302_REG_RX_TOP_FRAME_SYNCH1_SF5_PEAK2_POS_SF5 575
#define SX1302_REG_RX_TOP_FRAME_SYNCH0_SF6_PEAK1_POS_SF6 576
#define SX1302_REG_RX_TOP_FRAME_SYNCH1_SF6_PEAK2_POS_SF6 577
#define SX1302_REG_RX_TOP_FRAME_SYNCH0_SF7TO12_PEAK1_POS_SF7TO12 578
#define SX1302_REG_RX_TOP_FRAME_SYNCH1_SF7TO12_PEAK2_POS_SF7TO12 579

How to modify the previous function to configure custom private sync into SX1303 chip ?

THX

Hello @jfgi31700 The LoRaWAN (LoRa MAC) recognized only two modes Public and Private LoRaWAN, and using the sync words 0x34 for the Public and 0x12 for the Private. If you are willing to use LoRaWAN you should use one or another. If you are willing to use the LoRa modulation and not follow the LoRaWAN specification and protocol, the sync word doesn’t matter.

As for the Semtech code, they are purposely not documenting their registers and we have only the open-source code from them to configure and work the hardware.

More info here: Relation between Sync Word, Private Network and End-Nodes - ChirpStack Community Forum

Ok i see…thanks for you reply.

Please redirect if I shouldn’t revive a year old thread, but I’m confused by this answer.
I want to use the RAK5146 in a non-LoRaWAN network. To be more specific, I want it to receive and decode Meshtastic packets that are sent with a sync_word of 0x2b. My prior experience with data radios, and the documentation from Semtech, is that receivers will only continue receiving and decoding packets with a recognizable sync-word. If the only two sync_words the RAK5146 knows to look for are 0x12 and 0x34, is it incapable of receiving/decoding packets marked with any other sync_word?

Specifically, in section 4.2.11.1 of the Semtech docs, it basically says the receiver will give up on a packet if the sync_word doesn’t match.

Thank you.

Hello,

For the RAK5146 hardware, there is no problem with using a custom sync word.
But you would need to set this custom sync word in the HAL and the Forwarder.
What I can suggest is to look at Semtech’s documentation, Semtech’s HAL documentation, and LoRa Alliance’s documentation for what changes you need to make.

Here is the HAL in GitHub: sx1302_hal/libloragw/src/loragw_sx1302.c at 4b42025d1751e04632c0b04160e0d29dbbb222a5 · Lora-net/sx1302_hal · GitHub

Best Regards

EDIT: It seems the multi-modem part of the SX1303 is clamped to 125KHz bandwidths. That pretty much makes it unusable for my application, which uses 250KHz channels.

Sure, this is the code:

    if (public == true) {
        DEBUG_MSG("INFO: configuring LoRa (Multi-SF) SF7->SF12 with syncword PUBLIC (0x34)\n");
        err |= lgw_reg_w(SX1302_REG_RX_TOP_FRAME_SYNCH0_SF7TO12_PEAK1_POS_SF7TO12, 6);
        err |= lgw_reg_w(SX1302_REG_RX_TOP_FRAME_SYNCH1_SF7TO12_PEAK2_POS_SF7TO12, 8);
    } else {
        DEBUG_MSG("INFO: configuring LoRa (Multi-SF) SF7->SF12 with syncword PRIVATE (0x12)\n");
        err |= lgw_reg_w(SX1302_REG_RX_TOP_FRAME_SYNCH0_SF7TO12_PEAK1_POS_SF7TO12, 2);
        err |= lgw_reg_w(SX1302_REG_RX_TOP_FRAME_SYNCH1_SF7TO12_PEAK2_POS_SF7TO12, 4);
    }

The problem is that I’m too stupid to understand how you can set a byte to “6” and a byte to “8” and have the radio interpret it as “0x34”. :slight_smile: Same with “2” and “4” giving you “0x12”.
Semtech is remarkably hard to get any information out of. I feel for their OEM partners like RAK that have to interpret their vagueness.

As an individual developer, I don’t have the clout to open a tech request ticket with Semtech. Is this something I could ask RAK to do in my stead? I think there’s an opportunity for non-trivial sales into the “hobbyist” market of the 5146 boards if it turns out they’re Meshtastic-compatible.