Change SF for Join Request

Hey guys,

one quick question. How do i change the spreading factor for the CubeCell Plus Module/Board to SF12?
I’ve tried to set “#define EU868_DEFAULT_DATARATE” to “DR_0” in “RegionEU868.h” it works for common uplinks but the Join Request is still handled with SF7.

Hello @vino2300
i traced the code i found a bug in the function in RegionEU868.c, which defaults to DR_5 instead of the EU868_DEFAULT_DATARATE and should be updated as shown below:

     int8_t RegionEU868AlternateDr(AlternateDrParams_t *alternateDr)
    {
        int8_t datarate = 0;
        if ((alternateDr->NbTrials % 48) == 0)
        {
            datarate = DR_0;
        }
        else if ((alternateDr->NbTrials % 32) == 0)
        {
            datarate = DR_1;
        }
        else if ((alternateDr->NbTrials % 24) == 0)
        {
            datarate = DR_2;
        }
        else if ((alternateDr->NbTrials % 16) == 0)
        {
            datarate = DR_3;
        }
        else if ((alternateDr->NbTrials % 8) == 0)
        {
            datarate = DR_4;
        }
        else
        {
            // change from DR_5 to EU868_DEFAULT_DATARATE:
            datarate = DR_5;
        }
        return datarate;
    }

update to :

int8_t RegionEU868AlternateDr(AlternateDrParams_t *alternateDr)
{
    int8_t datarate = 0;
    if ((alternateDr->NbTrials % 48) == 0)
    {
        datarate = DR_0;
    }
    else if ((alternateDr->NbTrials % 32) == 0)
    {
        datarate = DR_1;
    }
    else if ((alternateDr->NbTrials % 24) == 0)
    {
        datarate = DR_2;
    }
    else if ((alternateDr->NbTrials % 16) == 0)
    {
        datarate = DR_3;
    }
    else if ((alternateDr->NbTrials % 8) == 0)
    {
        datarate = DR_4;
    }
    else
    {
        // change from DR_5 to EU868_DEFAULT_DATARATE:
        datarate = EU868_DEFAULT_DATARATE;
    }
    return datarate;
}

I hope this helps :slight_smile: and i hope Heltec Team updates their code to reflect the changes.

1 Like

Hi Jayjay,

thanks for your reply!
I saw this fuction too and replaced DR_5 with DR_0, but with this change my cubecell didnt join at all.
I’m curious, does it work for you?

hi @vino2300
i tested it before i replied and yes it works for me, make sure you’ve changed the “#define EU868_DEFAULT_DATARATE” to “DR_0” in “RegionEU868.h as well.

RegionEU868.h:
image

RegionEU868.c

Hey jayjay, thanks again.

It works now!
I had to move the “times” sign in
int8_t RegionEU868AlternateDr(AlternateDrParams_t* alternateDr) to
int8_t RegionEU868AlternateDr(AlternateDrParams_t *alternateDr)

strange… should it make a difference?

Edit: It works but join request is delayed up to 2 minutes in SF12 / DR_0.
With SF7 / DR_5 the join request is happening immediately after an reset

I don’t follow! what do you mean by:

I had to move the “times” sign in
int8_t RegionEU868AlternateDr(AlternateDrParams_t* alternateDr) to
int8_t RegionEU868AlternateDr(AlternateDrParams_t *alternateDr)

i noticed similar behavior if the channel switches to 2 for example it takes a while to join but in channel 1 it joins instantly… channel 0 takes a bit longer…channel 2 is the worst of them all…

RadioSend: size=23, channel=2, datarate=0, txpower=0, maxeirp=16, antennagain=2

PS: I’m next to the gateway so not sure if that has any effect on this…

Jay