Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

868MHz frequency does not work #12

Open
sheinz opened this issue Mar 10, 2020 · 9 comments
Open

868MHz frequency does not work #12

sheinz opened this issue Mar 10, 2020 · 9 comments

Comments

@sheinz
Copy link

sheinz commented Mar 10, 2020

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.

@Pablo2048
Copy link

Hi,
you can try

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

@sheinz
Copy link
Author

sheinz commented Mar 11, 2020

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

@Pablo2048
Copy link

Is your CPU little endian?

@sheinz
Copy link
Author

sheinz commented Mar 11, 2020

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

@Pablo2048
Copy link

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

@sheinz
Copy link
Author

sheinz commented Mar 11, 2020

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.

@iwanders
Copy link
Owner

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.

@Pablo2048
Copy link

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

@iwanders
Copy link
Owner

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants