LowPowerLab Forum

Hardware support => Moteino => Topic started by: chalupien on March 03, 2014, 08:58:12 PM

Title: RFM69HW Bit Rate Settings
Post by: chalupien on March 03, 2014, 08:58:12 PM
Hi, What settings do I change to lower the bitrate / baud rate of the rfm69hw?

In the RFM69 Library, I can see the registers for many different bit rates, and in the function to initialize the RFM69 radio it looks like its setting the bit rate. Begin of CONFIG sent to radio

  const byte CONFIG[][2] =
  {
    /* 0x01 */ { REG_OPMODE, RF_OPMODE_SEQUENCER_ON | RF_OPMODE_LISTEN_OFF | RF_OPMODE_STANDBY },
    /* 0x02 */ { REG_DATAMODUL, RF_DATAMODUL_DATAMODE_PACKET | RF_DATAMODUL_MODULATIONTYPE_FSK | RF_DATAMODUL_MODULATIONSHAPING_00 }, //no shaping
    /* 0x03 */ { REG_BITRATEMSB, RF_BITRATEMSB_55555}, //default:4.8 KBPS
    /* 0x04 */ { REG_BITRATELSB, RF_BITRATELSB_55555},
    /* 0x05 */ { REG_FDEVMSB, RF_FDEVMSB_50000}, //default:5khz, (FDEV + BitRate/2 <= 500Khz)
    /* 0x06 */ { REG_FDEVLSB, RF_FDEVLSB_50000},

....

Which ones do I need to change and how to lower the bit rate?

Nick
Title: Re: RFM69HW Bit Rate Settings
Post by: NixHydra on March 04, 2014, 01:53:53 AM
Hi Nick,

You can change the bit rate by changing the contents of the RFM69 registers, 0x03 and 0x04.

Please see fig(a) attachment, RFM69 library syntax for setting registers 0x03 and 0x04, for a bit rate of 9600.
                  fig(b) attachment, register 0x03, RFM69HW datasheet, page 63.
                  fig(c)  attachment, register 0x04, RFM69HW datasheet, page 64.
                  fig(d)  attachment, bit rate examples, RFM69HW datasheet, page 20.

Hope this helps.

                      cheers,

Title: Re: RFM69HW Bit Rate Settings
Post by: Tomme on March 05, 2014, 04:47:06 AM
Quick question on a related subject, the RFM69 library claims the default bitrate is 4800 but what is actually used is RF_BITRATEMSB_55555(0x02) and RF_BITRATELSB_55555 (0x40) which isn't 4800bd its 55.555k. Am I missing something? If not it's worth cleaning up the comments in the code to say this OR actually use 4800 as the comments suggest.
Title: Re: RFM69HW Bit Rate Settings
Post by: Felix on March 05, 2014, 07:58:06 AM
The default power-on is 4800. Checking the datasheet is sometimes useful ;)
Title: Re: RFM69HW Bit Rate Settings
Post by: Tomme on March 05, 2014, 10:14:17 AM
Righto thanks, much appreciated!

I did check the data sheet, but I think my comment re: code comments stands.

Quote
//default:4.8 KPBS

Could be better put as:

//default power-on bitrate is 4.8 kpbs, change to 55.5 kbps.

Something to the same effect could be put in RFM69registers.h ?


Title: Re: RFM69HW Bit Rate Settings
Post by: Felix on March 05, 2014, 10:16:04 AM
Yes, a lot of the code comments could be rewritten more verbosely
Title: Re: RFM69HW Bit Rate Settings
Post by: Tomme on March 05, 2014, 10:33:10 AM
I'd be happy to help with such things if you were interested?
Title: Re: RFM69HW Bit Rate Settings
Post by: Felix on March 05, 2014, 10:48:08 AM
Thanks, I will need to revise some of the comments whenever I get some time for that, but quite low priority right now
Title: Re: RFM69HW Bit Rate Settings
Post by: Samwise on January 22, 2015, 08:07:52 AM
I'm sorry for bringing this topic up again but I'm wondering why the RFM69 library changes the default bitrate from 4800 to 55555? Probably because a higher speed is prefered, but then why not selecting one of the more regular bitrates like 57600?

Just bought 2 moteino's and I'm trying to get familiar with the code base :)
Title: Re: RFM69HW Bit Rate Settings
Post by: Felix on January 22, 2015, 08:59:33 AM
No particular reason. You can change to 57600 if you'd like.
Title: Re: RFM69HW Bit Rate Settings
Post by: TomWS on January 22, 2015, 03:01:40 PM
I'm sorry for bringing this topic up again but I'm wondering why the RFM69 library changes the default bitrate from 4800 to 55555? Probably because a higher speed is prefered, but then why not selecting one of the more regular bitrates like 57600?

Just bought 2 moteino's and I'm trying to get familiar with the code base :)
I think Felix used to have a girlfriend with '55555' for her telephone number  :)

Seriously, as Felix alluded, I think this value is pretty arbitrary.  There isn't any reason why it would need to match a standard UART baud rate (other than the fact that is does make the rest of us wonder about it)  ;)

Tom
Title: Re: RFM69HW Bit Rate Settings
Post by: LukaQ on January 31, 2018, 09:30:36 AM
Has anyone played with setting for Fdev and Bitrate or are you using what comes set? I find that low BR and high Fdev or other way around don't work, the ones that do work are around what come default with library and based on RSSI (high 40s), it doesn't get any better. Should I be testing with nodes more apart?
Title: Re: RFM69HW Bit Rate Settings
Post by: perky on January 31, 2018, 11:50:14 AM
There are rules for FDEV, BR and RXBW that need to be followed. Give that RXBW is quantised (i.e. only certain values are selectable) the BR and FDEV being variable allows a system to be optimised. Often there are additional constraints like channel widths to take into account, oscillator drift and accuracy etc. Personally I like to keep the modulation index above 2 if I can so low beta compensation is not needed, see this post:

https://lowpowerlab.com/forum/rf-range-antennas-rfm69-library/definition-of-rxbw-with-rfm69/

Mark.
Title: Re: RFM69HW Bit Rate Settings
Post by: LukaQ on January 31, 2018, 02:46:42 PM
How do you set gateway then? If you have higher speed nodes (let's say as is at 55.5k) and some low speed ones (2.4-4.8k), that let's say are far away and you need to do this because of signal strength. Can you mix such node on one gateway?
Title: Re: RFM69HW Bit Rate Settings
Post by: Felix on January 31, 2018, 04:19:04 PM
Can you mix such node on one gateway?
You could just change the settings for each bitrate to match that of the sending node, but how do you know when to listen to which one?
Title: Re: RFM69HW Bit Rate Settings
Post by: perky on January 31, 2018, 07:27:47 PM
You could just change the settings for each bitrate to match that of the sending node, but how do you know when to listen to which one?
Indeed. There are potential solutions, for example the gateway listens on one set of settings for half the time and on the other for the other half, it should completely reject packets with the incorrect settings. Retries would eventually get the packet through on the right half, but that could be costly for power so then you might want to use a real-time counter on the node to ensure it only wakes up in the correct half, and synchronises it's timer when it gets a response from the gateway. It all gets a bit hairy. An easier approach might be to just have two gateways.

Mark.
Title: Re: RFM69HW Bit Rate Settings
Post by: LukaQ on January 31, 2018, 11:49:21 PM
So, as is it now, you have to settle for one setting and stick to it? One thing would be great, if gateway app would be able to listen to more serial ports, then this could be solved even for different freq. entirely. Not something you would need for a house alone.