plainRFM69 icon indicating copy to clipboard operation
plainRFM69 copied to clipboard

868MHz frequency does not work

Open sheinz opened this issue 5 years ago • 9 comments

Hi, I have RFM69CW 868MHz modules. Trying them with unchanged "MinimalInterruptUno" example works fine. But after changing frequency to 868MHz the example stops working.

    rfm.setFrequency((uint32_t) 868*1000*1000); // set the frequency.

Any help is much appreciated.

sheinz avatar Mar 10 '20 21:03 sheinz

Hi, you can try

rfm.setFrequency(868UL*1000*1000); // set the frequency

Pablo2048 avatar Mar 11 '20 05:03 Pablo2048

Hi Pablo, I tried with no difference. I also tried setting frequency registers directly (without conversion):

    // rfm.setFrf(0x4EC000);  // 315MHz - works
    // rfm.setFrf(0x6C8000);  // 434MHz - works
    // rfm.setFrf(0xE4C000);  // 915MHz - doesn't work
    // rfm.setFrf(0xd90000);  // 868MHz - doesn't work

sheinz avatar Mar 11 '20 06:03 sheinz

Is your CPU little endian?

Pablo2048 avatar Mar 11 '20 06:03 Pablo2048

It is Arduino Pro mini, ATmega328p 16MHz, 3.3v. The Internet says it is little endian.

sheinz avatar Mar 11 '20 07:03 sheinz

Hmm, that is weird - I'm also using ATmega328p, RFM69@868MHz with no problem...

Pablo2048 avatar Mar 11 '20 07:03 Pablo2048

Setting baud rate for RFM69 module other than 4800 (which is default) fixed the problem.

    // rfm.baud4800();    // doesn't work with 868MHz
    // rfm.baud9600();    // works with 868MHz but with high packet loss
    // rfm.baud153600();  // works with 868Mhz with no packet loss
    rfm.baud300000();     // works with 868MHz with no packet loss

153600 and 300000 works reliably with 868MHz modules.

sheinz avatar Mar 11 '20 12:03 sheinz

Hmm, I can definitely see setFrequency failing, the signature is:

void setFrequency(uint32_t freq);

So any value about 32 bits will get truncated. I developed this library against the 315 or 434 MHz version... clearly. Does an arduino support uint64_ts? Because if so we should probably just change the type, that should solve the issue? If anyone can test this and file a PR that'd be much appreciated, I don't have access to this hardware anymore.

@Pablo2048 , are you sure you are setting the frequency with setFrequency on your 868 MHz unit? Because the default values for the register should be good on each unit, but setting them should cause problems :)

The setFrf function should always work if the endianness of the cpu is right. It just copies the 3 relevant bytes from the input.

Setting baud rate for RFM69 module other than 4800 (which is default) fixed the problem.

Cool! Could have had something to do with needing a higher Fdev or something at these higher frequencies. The carrier is now probably set by the default value in the register, which should be fine in general.

iwanders avatar Mar 11 '20 12:03 iwanders

Ehm, sorry for confusing - I take a look into my code and i'm not calling setFrequency...

Pablo2048 avatar Mar 12 '20 06:03 Pablo2048

Hi,

I've filed #13 , I cannot test this unfortunately. @Pablo2048 , @sheinz if you have time, could you give that branch a spin and see if that allows you to make a call to setFrequency with a high number and end up with working communication?

Thanks!

iwanders avatar Mar 14 '20 16:03 iwanders