LowPowerLab Forum

Hardware support => RF - Range - Antennas - RFM69 library => Topic started by: sid1202 on August 21, 2016, 08:28:50 PM

Title: Changing the RMF69 radio configuration [+300kbps settings]
Post by: sid1202 on August 21, 2016, 08:28:50 PM
Hi guy's,

I'm pretty new at all this but I'm learning pretty fast.

I have a project that uses the radio with it's default config quite happily, but there is one thing I'd like to implement sporadically and it's the ability to have push to talk communication between 2 of my nodes.

I was thinking of setting the radio on continuous mode and pumping my sampling directly to the transceiver via DIO2 for as long as the button is pushed (either side) and then go back to the default config. The transceiver needs to be at a bit rate greater than 64kbps for that moment.

I've been reading the datasheets and I think it can be done. Of course the range will be short for PTT but it doesn't need to be far, just a couple of hundred feet.

I found some of the registers I need to change and how I would wire this up, but implementing it in the code is a little beyond my current understanding.

Can anyone give me some hints on how to implement this ?

I'm using a Adafruit Feather 32u4 RMF69HCW with the Arduino IDE and LowPowerLab's librarie.

Thank you !

Sidney
Title: Re: Changing the RMF69HCW configuration and back
Post by: sid1202 on August 22, 2016, 12:10:20 PM
The question is RFM69HCW specific and not MCU specific. Configuring the radio uses the library calls to set the radios registers and the library is not supported by Adafruit.
Title: Re: Changing the RMF69HCW configuration and back
Post by: emjay on August 22, 2016, 12:52:26 PM
@sid1202,

Unfortunately, streaming data like that is a violation of the usage rules in the ISM band - have a look at the section on duty cycle.
Title: Re: Changing the RMF69HCW configuration and back
Post by: Felix on August 22, 2016, 06:59:39 PM
Ok I think what you're looking for is a custom set of settings. There are certain relationships between settings when you change the basic settings like bitrate, bandwidth, frequency etc. These are covered in the datasheet but it's tedious work. I provide a good all-around set of settings in the library, otherwise the library is AS-IS and comes with no strings attached.

If you write to registers you should not have to reset anything. I don't think you should worry about bricking.
Usually changing from a radio mode to another will cause the changes to take effect.
Title: Re: Changing the RMF69HCW configuration and back
Post by: sid1202 on August 22, 2016, 09:10:38 PM
Ok I think what you're looking for is a custom set of settings. There are certain relationships between settings when you change the basic settings like bitrate, bandwidth, frequency etc. These are covered in the datasheet but it's tedious work. I provide a good all-around set of settings in the library, otherwise the library is AS-IS and comes with no strings attached.

If you write to registers you should not have to reset anything. I don't think you should worry about bricking.
Usually changing from a radio mode to another will cause the changes to take effect.

That's exactly it. Being fairly new to this, I'm having a hard time understanding the relationships. I understand most of the individual settings, but that's it.

Heres what I got so far

RegDataModul (0x02)   01100000 -> Set to Continuous mode

RegBitrateMsb and RegBitrateLsb have multiple choices but thease are the ones I think make most sense

BitRate   BitRate   (G)FSK
(15:8)    (7:0)    (G)MSK

0x01    0xA1    76.8 kbps
0x01    0x16    115.2 kbps

RegDioMapping defaults maps DIO2 to data all the time

But  just realized that althought I can trigure the mode change when the button is push on both sides, I'm not sure how I can inform the receiver the the button has been release on the sending side.

This bring me to another possibility, simply increase the BR to 115.2 kbps and send the audio in packets with a control byte at one end

What do you think ?

BTW, is it ok to just set the bit rate to 115.2 kbps or do I have to figure out the bandwidth and frequency that goes with it ?

Sidney
Title: Re: Changing the RMF69HCW configuration and back
Post by: sid1202 on August 25, 2016, 06:18:56 AM
I provide a good all-around set of settings in the library, otherwise the library is AS-IS and comes with no strings attached.

I've been going at this for a month, reading datasheets and code and now I'm a little lost. If you would be kind enough to point me to where those settings are and how to use them I'd greatly appreciate it.

Thank you,
Sidney
Title: Re: Changing the RMF69HCW configuration and back
Post by: sid1202 on September 08, 2016, 06:47:12 AM
It's crazy. I've been looking to find which other registers to change and at what value to get the highest transfer rate  possible and I can't get an answer anywhere.

I understand the procedure to implement it, I just don't know the values. The highest transfer rate  I managed to achieve is about 16 kb/s with the BR set at 250

There is something I don't understand about the configuration procedure and no matter where i look all a get is basically just a list of settings but not the relationship between them.

one example is deviation. Should I configure it low (5kHz) or high (closer to 500 kHz).

I know that by reducing the amount of control bytes and increasing the payload I'll get faster transfers, but the difference is to high at the moment to make any real difference.

To maximize the I.m pretty sure I need to tweak the bit rate (reg 0x03 & 0x04)  but that needs to be matched by changes to the bandwidth (0x19), the frequency deviation (0x05 & 0x06) and the Channel Filter BW control (0x1A). Also may be required to tweak the Packet mode settings (0x37) and the Data operation mode and Modulation settings (0x02)

I'm just amazed no one tried to push the transfer rate before. If someone did I can't find the info anywhere.

I don't know if I express my self badly in English or what but I seams to get a lot of dead air when I ask questions. If I do come across as "different" please accept my apologies, English is not my native language.

Regards,

Sidney
Title: Re: Changing the RMF69HCW configuration and back
Post by: perky on September 08, 2016, 08:27:36 AM
Have you seen this thread?
https://lowpowerlab.com/forum/rf-range-antennas-rfm69-library/definition-of-rxbw-with-rfm69/

It details the relationship between frequency deviation, bit rate and receiver bandwidth. Your goal to get maximum range is to have the smallest allowable receiver bandwidth for a given bit rate. Of course you might want to have high bit rate to reduce transmission time to save battery power so these settings then become a compromise between range and battery use.

In summary the rules are:
1)  0.5 <= 2 * Fdev/BR <= 10    (modulation index, MI)
2)  BR < 2*RxBw     (bit rate)
3)  RxBw >= Fdev + BR/2   (receiver bandwidth)
4)  RxBwAfc >=  Fdev + BR/2 + LOoffset (receiver AFC bandwidth)
5)  Fdev + BR/2 < 500kHz  (maximum RxBw setting)

Mark.
Title: Re: Changing the RMF69HCW configuration and back
Post by: sid1202 on September 08, 2016, 12:38:47 PM
I did. but its been a few weeks since I read it and I've learned a lot since then. But there are a few things in this thread that I don't understand and I would need someone to clarify a few things. I will go through this thread a few more times.

My work load goes down in the winter. I think I will write a tutorial.  If some other people are willing to help revise and correct it as I go they will be most welcome.

Sid
Title: Re: Changing the RMF69HCW configuration and back
Post by: sid1202 on September 08, 2016, 07:59:45 PM

It details the relationship between frequency deviation, bit rate and receiver bandwidth. Your goal to get maximum range is to have the smallest allowable receiver bandwidth for a given bit rate. Of course you might want to have high bit rate to reduce transmission time to save battery power so these settings then become a compromise between range and battery use.


Mark.

That's just it, these to node will be plugged in and act as a bridge between 2 sub nets. My shop is to fare for wireless unless I got high end which is very costly. Wired, which I try to avoid. The house sensors will all send data to a local interface. It will "massage" the data and send it to the shop's interface through the bridge and vise versa. This way whether I'm at the shop or the house I can the state of all my sensors. I'll also have one device as a remote interface. This one will be low speed for greater range and will only give me critical information unless I explicitly request it to get detailed information for a particular system.

Each subnet will be layered. I'll have a coupe of complex enclosed system that will have a few nodes wired together with one node as a gateway. All nodes in a room will communicate through IR to a higher level gateway. Each room/area's gateways will communicates to the interface via radio (more economical than Bluetooth or wifi too) I'd like to be able to transmit security images from the shop to the house, and be able to speak to customers or intruders at the shop from the house.

I breadboarded several systems. I've sent and received data sturtures both ways successfully. Even tested my remote to over 1000 feet with just a wire antenna and in the middle of the house at ground level. So with a external antenna on the roof, I should get really good coverage. But and when I calculate the time it would take to transfer a jpeg, the radio's would be pegged for to long. Also, If I want to send speach I need to get 57.x kp/s minimum. Ideally 64kp/s.

Since most people using the radios are most interested in range and precise transmission, finding how to configure for that is easy. There are even many tweaks on the web for many particular situation. I found one than communicates with a micro satellite at very low bandwidth. On the other hand, I haven't found any projects that *successfully* used the full bandwidth capacity of the radio in short range when power is no object. so finding the right settings, at the very least close enough, has been a nightmare.

When we buy a car, we don't necessarily want to control the chemistry that is happening in our catalytic converter's but we want to be able to go slow or fast as the needs appear. When I bought these radio's I expected to have to know a little more that just turn a knob, but I did not expect to have to become a radio engineer. It's as if you buy a car with a bag of gears in the trunk of different sizes and they tell you to go fast change the gears in the transmission.

I digress.... and a little annoyed of the one sided information available for this radio.

I've been at this problem for to long without progress. I'm starting to look at other solutions, albeit more expensive and more complicated, that might be possible to implement. Maybe using IoT and or installing parabolic wifi antennas.

Anyway, I had a hard days at work and I think I need to rest. I'll look at this with a fresh eye tomorrow.

Thank you,
Sidney
Title: Re: Changing the RMF69HCW configuration and back
Post by: sid1202 on September 10, 2016, 07:51:53 AM
Thanks Mark for getting me to read this thread again.  :)

I'm still overwhelmed by the volume of information and relationships between all the parameters, I am starting to understand a little more.

Since this part of my project will be hardwired, battery usage is not an issue. Also range is no as important but not negligible.  I've managed to get the Semtech starter kit running but there are still some aspects of relationships that are still foggy. For example for a given bitrate, lets say 250 kbps, there is a range of valid FDev values but I don't quite get which way does what.  what is the impact of having a Fdev value on the low side compared to having it on the high side of the valid Fdev range.

What I'm also struggling with is what to concentrate on first. There are many parameters to consider. Am I correct that I should learn in the order of the rules ?

Here what I understand and are some of the questions I'm trying to answer:

Rule 1)  0.5 <= 2 * Fdev/BR <= 10    (modulation index, MI)
This is for transmitting ?, do I want to be closer to 0.5 or to 10 ?

Rule 2)  BR < 2*RxBw     (bit rate)
This determines the  maximum biterate relationship between the transmitter and the receiver. Having the BR closer to 2*RxBw rather than further away will have what consequences ?

Rule 3)  RxBw >= Fdev + BR/2   (receiver bandwidth)
Pretty sure this sets the receiver settings limits. Should it be set as close to the limit as possible ?

Rule 4)  RxBwAfc >=  Fdev + BR/2 + LOoffset (receiver AFC bandwidth)
This rule is only applicable if AFC is enabled. I haven't looked into that much yet, so I'm not sure what AFC does except for the basic definition. But I think I can look into that last.

Rule 5)  Fdev + BR/2 < 500kHz  (maximum RxBw setting)
This one a simply a hard limit to the RxBw setting. I think that this rules means that what ever values you choose in the 4 previous rules This rule can't be broken.

What should I try to figure out first ?
Title: Re: Changing the RMF69HCW configuration and back
Post by: sid1202 on September 10, 2016, 08:18:42 AM
I also found a related thread about optimizing power here https://lowpowerlab.com/forum/rf-range-antennas-rfm69-library/optimizing-radio-settings-for-power-(rfm69whw)/ (https://lowpowerlab.com/forum/rf-range-antennas-rfm69-library/optimizing-radio-settings-for-power-(rfm69whw)/)that is pretty interesting. When I first went through the forum and I saw this title, I skip it thinking it was something about batteries. This time I caught on and read the tread.

Sid
Title: Re: Changing the RMF69HCW configuration and back
Post by: perky on September 10, 2016, 09:33:37 AM
All the rules really need to be understood if you are going to set your own values  ;).

Quote
Rule 1)  0.5 <= 2 * Fdev/BR <= 10    (modulation index, MI)
This is for transmitting ?, do I want to be closer to 0.5 or to 10 ?
Modulation index really shapes the energy distribution in the transmitted signal bandwidth. A high MI spreads the energy into two that have peaks around the two modulation frequencies (i.e. Fc + Fdev, and Fc - Fdev where Fc is the centre frequency). The higher the index the more energy is centred, but spread more, around those two regions with not much in the centre. A low MI makes the energy peak around the centre frequency. This can be important when considering that the receiver bandwidth RxBw has to cover (practically) all the signal bandwidth, a low MI essentially reduces the sidebands and allows the receiver bandwidth to be smaller. The limits of 10 to 0.5 are set by the radio's ability to demodulate them.

To illustrate that, take the two equations from the rules:
1) MI = 2 * Fdev/BR, and
3) RxBw >= Fdev + BR/2.

We can find Fdev in terms of BR from 1):
Fdev = MI * BR/2, and substitute into 3):
RxBw >= (MI * BR/2) + BR/2.
Note that for smaller MI values RxBw is also smaller. So if your goal is to get long range and have a low RxBw you'd be better off using a low MI (MI is also known as beta). However, there are complications with very low beta signals because of the way the RxBw filter actually works in the radio (without getting too technical there's a 'notch' in the centre and that is where most of the energy is).
If you want more details see www.nxp.com/files/rf_if/doc/app_note/AN4983.pdf

Quote
Rule 2)  BR < 2*RxBw     (bit rate)
This determines the  maximum biterate relationship between the transmitter and the receiver. Having the BR closer to 2*RxBw rather than further away will have what consequences ?
I think this is a natural limit that drops out of other equations, if you had very small Fdev or equal to zero  then rule 3) would become:
RxBw >= BR/2.

Quote
Rule 3)  RxBw >= Fdev + BR/2   (receiver bandwidth)
Pretty sure this sets the receiver settings limits. Should it be set as close to the limit as possible ?
Yes, this is derived from Carson's rule for the bandwidth of a transmitted FM signal and represents 98% of the energy of the signal. You should make RxBw as small as possible while still meeting this equation.

Quote
Rule 4)  RxBwAfc >=  Fdev + BR/2 + LOoffset (receiver AFC bandwidth)
This rule is only applicable if AFC is enabled. I haven't looked into that much yet, so I'm not sure what AFC does except for the basic definition. But I think I can look into that last.
See the above link for a really good discussion on AFC, that Freescale chip uses a rebadged sx1231 silicon.

Quote
Rule 5)  Fdev + BR/2 < 500kHz  (maximum RxBw setting)
This one a simply a hard limit to the RxBw setting. I think that this rules means that what ever values you choose in the 4 previous rules This rule can't be broken.
Correct.

Title: Re: Changing the RMF69HCW configuration and back
Post by: sid1202 on September 10, 2016, 02:06:07 PM
Quote
All the rules really need to be understood if you are going to set your own values  ;).

I see that, everything is inter dependent...

Quote
Modulation index really shapes the energy distribution in the transmitted signal bandwidth. A high MI spreads the energy into two that have peaks around the two modulation frequencies (i.e. Fc + Fdev, and Fc - Fdev where Fc is the centre frequency). The higher the index the more energy is centred, but spread more, around those two regions with not much in the centre. A low MI makes the energy peak around the centre frequency. This can be important when considering that the receiver bandwidth RxBw has to cover (practically) all the signal bandwidth, a low MI essentially reduces the sidebands and allows the receiver bandwidth to be smaller. The limits of 10 to 0.5 are set by the radio's ability to demodulate them.

To illustrate that, take the two equations from the rules:
1) MI = 2 * Fdev/BR, and
3) RxBw >= Fdev + BR/2.

We can find Fdev in terms of BR from 1):
Fdev = MI * BR/2, and substitute into 3):
RxBw >= (MI * BR/2) + BR/2.
Note that for smaller MI values RxBw is also smaller. So if your goal is to get long range and have a low RxBw you'd be better off using a low MI (MI is also known as beta). However, there are complications with very low beta signals because of the way the RxBw filter actually works in the radio (without getting too technical there's a 'notch' in the centre and that is where most of the energy is).
If you want more details see www.nxp.com/files/rf_if/doc/app_note/AN4983.pdf

This is the one part that is the hardest to wrap my mind around. I took a quick look at the document and it very clear. I'll read it through. If I can get this rule down pat, the rest will slide. But with waht you stated I understand the the MI is basically how loud the signal is. If the MI is to low, the receiver can't "hear" properly but is its to loud, the message gets distorted. Like putting a cheap stereo at high.

This feels like I finally found the wiper control while driving in a storm.

Thank you so much. I'll go through the document this weekend.

Sid
Title: Re: Changing the RMF69HCW configuration and back
Post by: perky on September 10, 2016, 03:26:29 PM
OK, this modulation index is a little difficult to get to grips with. This paper might shed more light:
www.silabs.com/Marcom%20Documents/Resources/FMTutorial.pdf

If you look at figure 2 you'll see a table showing the number of sidebands and their relative amplitudes for different betas (i.e. modulation indices). Look carefully at the coefficients and you'll see at high MI there are two energy peaks with the amount of energy near the centre frequency getting less and less as MI increases, and the number of sidebands increases, increasing the bandwidth. For eample with a beta of 5, the fourth sideband  J4 has an amplitude of 0.39 whereas the centre frequency J0 itself only has -0.18, so there are two peaks, one either side of the centre frequency (like a double humped camel).  The shape for a beta of 1 though only has one peak at the centre and far fewer sidebands (like a single humped camel).
 
Mark.
Title: Re: Changing the RMF69HCW configuration and back
Post by: sid1202 on September 10, 2016, 05:25:17 PM
I'm starting to understand what is throwing me off. Its the side bands.

I learned about FM was you have a carrier wave at a given amplitude that never changes. To transfer information you change the frequency of the carrier wave (which now Fdev makes perfect sense)  and MI being the ratio between how far off from the center frequency the bits are represented and how fast they the value changes. But I don't understand where the side bands are coming from. If there is other carrier waves that are very close to the main one, it would definitely make demodulation more difficult.

How are those side bands created in the first place. Are the wanted and produced, or are they a side effect  (echo) of the antenna ?

Sid.

[edit] I see later that we create those side bands and it is part of what makes the bandwidth.... Still reading ...

[edit] On page 3 right below figure 2, the document states
Quote
For instance, if β=0.25, only one sideband is needed; while if β=5, eight sidebands are required
, and a few phrases later
Quote
The bandwidth is equal to the number of discrete spectral tones multiplied by the frequency spacing set by the message signal frequency
explaining that the side bands are required and how to determine the number of sidebands but How are the side bands used ? do they contain parallel data ?
Title: Re: Changing the RMF69HCW configuration and back
Post by: perky on September 10, 2016, 06:12:57 PM
Whenever you modulate signals you get sidebands which are frequencies at either side of the centre frequency. Amplitude modulation is relatively easy to determine as its simply a multiplication of the modulation signal and a fixed carrier (and if you remember your maths two sines multipled together have sines with the sum and difference frequencies), but FM is more complex and requires Bessel functions to calculate.
This might explain it a bit better:
http://www.radio-electronics.com/info/rf-technology-design/fm-frequency-modulation/spectrum-bandwidth-sidebands.php

As an interesting note this says "The total spectrum can be seen to consist of the carrier plus an infinite number of sidebands spreading out on either side of the carrier at integral multiples of the modulating frequency". So what is the maximum frequency you can modulate these radios at to determine your maximum used bandwidth? Well it's an alternating sequence of 1's and 0's, the frequency of that is the bitrate divided by 2. This is where the BR/2 factor comes in.
Title: Re: Changing the RMF69HCW configuration and back
Post by: sid1202 on September 10, 2016, 06:50:32 PM
In this reference it states
Quote
As the modulation index increases it is found that other sidebands at twice the modulation frequency start to appear.
So the side bands are a resonances effect of the frequency deviation and the signal frequency and are not wanted ??? or are they required ... I'm lost...

On the other hand everything else is making more sense.
Title: Re: Changing the RMF69HCW configuration and back
Post by: perky on September 10, 2016, 08:47:08 PM
The sidebands are part of the signal. They are what you get when you FM modulate a carrier and look at the resulting signal's frequency content, you can't escape them they are just there. What you have to do is make the receiver bandwidth big enough to get as much of the signal energy (i.e. as much of the sidebands as needed) to get a good enough SNR to demodulate it, and that is given by the RxBw >= Fdev + BR/2 equation.
Mark,
Title: Re: Changing the RMF69HCW configuration and back
Post by: sid1202 on September 11, 2016, 03:35:47 AM
Now I understand. The sidebands are an side defect from the modulation and reflect the main carrier wave and its part of the package. So the more of the energy you target at the receiver the better the reception. (within limits). Man this one was hard to wrap my mind around. 

Ok time to start over reading the documents. There is still a few thing I want to clarify....

I greatly appreciate this guidance guys, thank you

Sid
Title: Re: Changing the RMF69HCW configuration and back
Post by: sid1202 on September 11, 2016, 11:40:55 AM
So This is what I understand now. When you configure the radio, parameters are set in steps. I want to target a MI of 5 but the parameters my not let me get a perfect 5, I try to stay as close to a MI of 5 as possible (based on commercial FM settings
Quote
in North
America, the maximum frequency deviation, f∆ , is 75 kHz for commercial FM broadcasting. If the maximum message frequency is equal to 15 kHz for audio, then 51575 == kHzkHzβ


To set up a 300 kbsp connection,

From rule 1, I can find my ideal  target Fdev with Fdev = MI  * BR/2 = 5 * 300/2 = 750

Use rule 3 to get RxBw: RxBw >= Fdev + BR/2 = 750 + 300/2 = 900 or more

Verify that it within limits with rule 2: BR < 2*RxBw == 300 < 2*900 == 300 < 1800 == TRUE

Confirm I'm within hard limits for RxBw with rule 5: Fdev + BR/2 < 500kHz  == 900 < 500 == FALSE

Since I want to use 300kbps, the only variable left to change is the MI, I need to lower it no lower that 0.5 and satisfy rule 5. To satisfy rule 5 RxBw can not be higher that 500 - 150 = 350

Get new Fdev from rule 3: RxBw >= Fdev + BR/2 == Fdev <= RxBw - BR/2 == 350 - 300/2 = 200

Verify Rule 1 with rule 1 if MI is within limits: 2 * Fdev/BR = 2 * 200 / 300 = 1

So to set up a 300 kbps connection
BR=300
Fdev=200
RxBw=350

The only parameter left to figure out is RxBwAfc. I've read a little about AFC and seems that the RFM69 AFC is pretty fast so it wont really slow down the connection and according to NXP document there is a lot of advantages to using AFC.

On the other hand I haven't seen a register for RxBwAfc. Section 3.5.15 of the sx1231 talks about turning it on and 3.5.16 using Optimized Setup for Low Modulation Index Systems by setting the appropriate bits. But I'll have to read on to figure out the details.

Sid

[edit] From the "Definition of RxBw with RFM69"discusion I figured that @ 915 Mhz the LOoffset is a factor 20ppm = 18.3 Khz. What does ppm stand for here. Can't be parts per million... lol

RegAfcBw
(0x1A)
7-5 DccFreqAfc rw 100 DccFreq parameter used during the AFC => RxBwAfc value goes here ?
4-3 RxBwMantAfc rw 01 RxBwMant parameter used during the AFC
2-0 RxBwExpAfc rw 011 * RxBwExp parameter used during the AFC


Title: Re: Changing the RMF69HCW configuration and back
Post by: perky on September 11, 2016, 01:05:03 PM
I would have selected the RxBw first as these are only available in disrete steps. For example the nearest one to 350kK is 333kHz. Also for AFC this has to include the offset between the transmitter frequency and the receiver frequency, which is set by the ppm difference between the two crystals and scaled to the frequency band your using.

So, let's assume it's 868MHz and the crystals are +/- 10ppm. This means the transmitter might be at +10ppm and the receiver at -10ppm or the other way round, so LOoffset is 20ppm of 868MHz, or about 17.4kHz.

I'd set RxBwAfc at 333kHz, and my actual needed RxBw is (333-17.4)kHz, i.e. 315.6kHz, so I'd also set that to 333kHz as the next one down is 250kHz and is too low.

Then I'd use rules 1 and 3 to get two equations for Fdev and BR so I can solve it for both variables, with a goal of a high BR. Let's make MI of 1.5 (i.e. 3/2), that won't require low beta stuff which is a complication.

So:
MI = 2 * Fdev/BR = 3/2, i.e. Fdev = BR * 3/4, or
A) Fdev = BR * 0.75.

Now from equation 3:
RxBw >= Fdev + BR/2. We've already said RxBw is 315.6kHz, so:
315.6 >= Fdev + BR/2, substituting A) we get:

B) 315.6 >= BR * 3/4 + BR/2, or 315.5 = BR * 5/4.

So: BR = 252.5KHz. Let's say 250kHz (a little smaller)

This means Fdev is 189.3KHz. Let's say 185kHz (a little smaller)

So with Fdev = 250kHz and BR = 185kHz let's check all the rules:
1)  0.5 <= 2 * Fdev/BR <= 10
2 * Fdev/BR is 1.48. So OK.

2)  BR < 2*RxBw
250 < (2 * 185) , so OK.

3) RxBw >= Fdev + BR/2
333 >= (185 + 125), so OK.

4) RxBwAfc >=  Fdev + BR/2 + LOoffset
333 >= (185 + 125 + 17.4), so OK.

5) Fdev + BR/2 < 500kHz
(250 + 125) < 500, so OK.

Final settings:
BR = 250kHz
Fdev = 185kHz
RxBw = 333kHz
RxBwAfc = 333kHz

If you wanted a higher BR follow the same process as above, but choose 400kHz or 500kHz as your RxBw values.

BTW the RxBwAfc is in register 0x1A.

Title: Re: Changing the RMF69HCW configuration and back
Post by: sid1202 on September 11, 2016, 05:55:46 PM
Got it. I think, lol

My radio is 915 Mhz the LOoffset is a factor 20ppm = 18.3 kHz then.

So I use table 13 and 14 to set RxBwAfc as we do for the the RxBw register I assume.

This means that when our RxBw start to get high, basicly the RxBwAfc = RxBw...

Ok so, lets see if I can do the math and lets try to get the numbers starting from 500kHz RxBw and see if it works.

This means RxBw and RxBwAfc will be 500 since the next lower step is 400.

A) If we choose an MI of 1.5 to avoid low beta stuff we have Fdev = BR * 3/4

B) 481.7 >= BR * 5/4 = 385.36 >> 384 ?

C) so Fdev is 192.68 >> 192 ?

1)  0.5 <= 2 * Fdev/BR <= 10
2 * 192 / 384 is 1 so OK

2)  BR < 2*RxBw
384 < (2 * 192 ) , so is it OK is its equal ?

3) RxBw >= Fdev + BR/2
500 >= (192 + 192), so OK.

4) RxBwAfc >=  Fdev + BR/2 + LOoffset
500 >= (192 + 192 + 18.3), so OK.

5) Fdev + BR/2 < 500kHz
(192 + 192) < 500, so OK.

So I have

BR = 384kHz
Fdev = 192kHz
RxBw = 500kHz
RxBwAfc = 500kHz

Now Rule 2 is busted by 1 and my MI is already at 1, looks like to get the the 300 kbps we have to get into the low beta stuff.

What's the threshold for the low beta it is MI = 1 yes ?

Sid





Title: Re: Changing the RMF69HCW configuration and back
Post by: perky on September 11, 2016, 06:37:42 PM
Well, nearly. The radio is actually restricted to 300kHz for BR (probably should be one of the rules!). With a MI of 1.5 this yields an Fdev of 225kHz, and an absolute minimum RxBw of 375kHz. You can get away with using RxBw and RxBwAfc settings of 400kHz!

So with BR of 300kHz and Fdev of 225kHz, let's check the rules:

1)  0.5 <= 2 * Fdev/BR <= 10
2 * (225 / 300) is 1.5, So OK.

2)  BR < 2*RxBw
225 < (2 * 400) , so OK.

3) RxBw >= Fdev + BR/2
400 >= (225 + 150),  so OK.

4) RxBwAfc >=  Fdev + BR/2 + LOoffset
400 >= (225 + 150 + 18.3),  so OK.

5) Fdev + BR/2 < 500kHz
(225 + 150) < 500, so OK.

So I think to get the maximum 300kHz BR out of your radio you could have:

BR = 300kHz
Fdev = 225kHz
RxBw = 400kHz
RxBwAfc = 400kHz

(BTW you made a mistake in your rule 2, RxBw for your calculations was 500kHz not 192kHz)

Edit: I've just seen the datasheet suggests MI less than 2 is 'low beta' So MI of 2, not 1.5, to avoid low beta offset stuff.

That makes the calculations a little easier, BR == Fdev. For maximum of 300kHz BR, Fdev = 300kHz, and absolute minimum RxBw is 450kHz, so would need to set RxBw and RxBwAfc to 500kHz.

BR = 300kHz
Fdev = 300kHz
RxBw = 500kHz
RxBwAfc = 500kHz.

Mark.
Title: Re: Changing the RMF69HCW configuration and back
Post by: sid1202 on September 11, 2016, 07:14:27 PM
An I knew that BR was limited to 300, but I got so wrap up in the calculations I missed it and my mistake in rule 2, well, that was a brain fart lol

This is not easy to grasp. There are many way to use these formulas to get numbers and you can start from different points. In the last example we started from the RxBw standpoint. We can also start from BR or even Fdev. This looks like it depends on your end goal. a really good understanding of the FM protocol is definitely a requirement. With you guidance I understand the basics, but I'll have to continue to increase my knowledge of FM to have a better grasp of these equations.

Is starting from RxBw a common practice or does it all depend on the objective ?


One thing I've learned is that the data sheet is not linear went it comes to figuring out the settings. I worked as a software engineer 12 year+ ago so I have some knowledge of datasheets and I used to be a very competent coder but after 12 years of not touching it at all, its a little rougher than I thought it would be. So I can just imagine someone that is just starting...

Anyway This is a great learn experience and I really appreciate it.

Sid
Title: Re: Changing the RMF69HCW configuration and back
Post by: WhiteHare on September 12, 2016, 09:21:00 PM
@sid1202
You may find this thread to be helpful:  https://lowpowerlab.com/forum/rf-range-antennas-rfm69-library/definition-of-rxbw-with-rfm69/30/
Title: Re: Changing the RMF69HCW configuration and back
Post by: sid1202 on September 13, 2016, 04:50:54 AM
@perky

Have you had time to work on that spread sheet of yours BTW ?

I've been playing with some numbers and I'm not always getting the same values that are used the the libraries. I keep refering the the "Definition of RxBw with RFM69 " thread and I found some answers there, but it might be I'm simply not using the formula right.

One thing I'm curious about is when you one a different channel is there enough change in the carrier frequency @915MHz to warrant recalculating all the register values or is the difference low enough that it would not impact it. ?

@WhiteHare
Yes most definitely. I've been referring to the thread a lot.
Title: Re: Changing the RMF69HCW configuration and back
Post by: sid1202 on September 13, 2016, 07:05:50 PM
I was going through the forum and revisiting some posts and I'm actually starting to understand most of the discussions now.  I have a few more questions, but before I ask, I want to see what I can answer for my self.

Again, I am very grateful for the guidance.

Sid.
Title: Re: Changing the RMF69HCW configuration and back
Post by: perky on September 13, 2016, 08:07:41 PM
Glad you're getting to grips with it. I haven't had time to do the spreadsheet unfortunately. BTW if you mean the RadioHead library, there is at least one of the standard configurations that is wrong and theoretically shouldn't work too well, so if you came to that conclusion you're on the right track ;-)
Title: Re: Changing the RMF69HCW configuration and back
Post by: sid1202 on September 13, 2016, 08:15:52 PM
Thats really nice to know :)

I'm try to figure out, for mid range rates where we can play more with MI if having a mid range MI is better that in the higher rangers like MI=2 vs MI =9

From what I understand the ideal MI is around 5, but I'm not sure how much of an impact it has.

Can't seem to get what are the consequences of moving the MI around. I read that at both extremities there are difficulties, more so at the lower end.

Sid.
Title: Re: Changing the RMF69HCW configuration and back
Post by: sid1202 on September 16, 2016, 06:14:18 AM
I've been playing with the settings and I would like to be able to "analyses" the performance of the radios at different settings. I was wondering if there is a standard measuring algorithm or sample code to achieve this so that my tests are meaningful to others too, not just me.

I've seen some results posted  here and there, but I did not find any testing guidelines anywhere...

Sid
Title: Re: Changing the RMF69HCW configuration and back
Post by: perky on September 16, 2016, 07:27:07 AM
Not that I'm aware of, I think people tend to do their own ad-hoc testing. It would be nice to run some standard code on two radios and have it cycle through various settings automatically and report things like RSSI and packet error rate though.
Mark.
Title: Re: Changing the RMF69HCW configuration and back
Post by: WhiteHare on September 16, 2016, 10:40:38 AM
Probably the closest thing to a "standard" would be measuring the bit error rate, but even that starts to get blurry: e.g. do you measure it before or after the error correction code does its work? Do you test the bits in the entire frame, or just the data payload?  If you completely miss a frame, how many bits of error do you count that as?  And how do you count a frame that you "received" but was never actually sent?  And on and on and on.  The actual definition of BER seems a tad fuzzy.
Title: Re: Changing the RMF69HCW configuration and back
Post by: sid1202 on September 16, 2016, 12:34:49 PM
As I was looking at testing, I quickly saw there is a multitude of ways to do so. I wanted the results to be meaningful to the rest of the community.

I'm not even sure ow I should proceed there are so many options. I'll ask on the RadioHead Forum see if they use a standard testing routine for their stuff.

Have you guys played with unlimited payload length ?

Sid
Title: Re: Changing the RMF69 radio configuration [+300kbps settings]
Post by: ChemE on January 06, 2017, 08:26:57 AM
This thread never actually wound up explicitly spelling out working 300kbps settings so I'm sharing mine for others who are looking to break into this speed.  I make no promises that these are 100% optimized but they get me 300+ feet which is all I need.

300kbps Settings - No Encryption or CRC to keep packet as small as possible
Bit Rate - 300kHz
Fdev - 300kHz
RxBW - 500kHz
Code: [Select]
const uint8_t CONFIG[][2] = {
    { REG_OPMODE, RF_OPMODE_SEQUENCER_ON | RF_OPMODE_LISTEN_OFF | RF_OPMODE_STANDBY },    // 0x01
    { REG_DATAMODUL, RF_DATAMODUL_DATAMODE_PACKET | RF_DATAMODUL_MODULATIONTYPE_FSK | RF_DATAMODUL_MODULATIONSHAPING_00 },    // 0x02
    { REG_BITRATEMSB, RF_BITRATEMSB_300000 },    // 0x03
    { REG_BITRATELSB, RF_BITRATELSB_300000 },    // 0x04
    { REG_FDEVMSB, RF_FDEVMSB_300000 },    // 0x05
    { REG_FDEVLSB, RF_FDEVLSB_300000 },    // 0x06
    { REG_FRFMSB, RF_FRFMSB_915 },    // 0x07
    { REG_FRFMID, RF_FRFMID_915 },     // 0x08
    { REG_FRFLSB, RF_FRFLSB_915 },    // 0x09
    { REG_RXBW, RF_RXBW_DCCFREQ_111 | RF_RXBW_MANT_16 | RF_RXBW_EXP_0 },    // 0x19
    { REG_DIOMAPPING1, RF_DIOMAPPING1_DIO0_01 },    // 0x25
    { REG_DIOMAPPING2, RF_DIOMAPPING2_CLKOUT_OFF },    //0x26
    { REG_IRQFLAGS2, RF_IRQFLAGS2_FIFOOVERRUN },    // 0x28
    { REG_RSSITHRESH, 220 },    // 0x29
    { REG_PREAMBLELSB, RF_PREAMBLESIZE_LSB_VALUE },    // 0x2D
    { REG_SYNCCONFIG, RF_SYNC_ON | RF_SYNC_FIFOFILL_AUTO | RF_SYNC_SIZE_2 | RF_SYNC_TOL_0 },    // 0x2E
    { REG_SYNCVALUE1, 0x2D },    // 0x2F
    { REG_SYNCVALUE2, networkID },    // 0x30
    { REG_PACKETCONFIG1, RF_PACKET1_FORMAT_VARIABLE | RF_PACKET1_DCFREE_OFF | RF_PACKET1_CRC_OFF | RF_PACKET1_CRCAUTOCLEAR_OFF | RF_PACKET1_ADRSFILTERING_OFF },    // 0x37
    { REG_PAYLOADLENGTH, 66 },    // 0x38
    { REG_FIFOTHRESH, RF_FIFOTHRESH_TXSTART_FIFONOTEMPTY | RF_FIFOTHRESH_VALUE },    // 0x3C
    { REG_PACKETCONFIG2, RF_PACKET2_RXRESTARTDELAY_2BITS | RF_PACKET2_AUTORXRESTART_ON | RF_PACKET2_AES_OFF },    // 0x3D
    { REG_TESTDAGC, RF_DAGC_IMPROVED_LOWBETA0 },    // 0x6F
    { 255, 0 }
  };
Title: Re: Changing the RMF69 radio configuration [+300kbps settings]
Post by: sid1202 on January 06, 2017, 09:17:14 AM
Thanks ChemE,

I've been to busy at work lately so I had to put this on hold, but I'm about to get back at it within a couple of weeks. I'll be writing up some documentation on this process too probably in February. I'll post about that when time comes though.
Title: Re: Changing the RMF69 radio configuration [+300kbps settings]
Post by: madsci1016 on April 01, 2017, 01:58:10 PM
ChemE,

I used your settings to get my radios working @ 6' apart sending 41 bytes @44hz between them. The stock library settings were chocking on the same setup.

However, my reported RSSI went from -20 to -100 when I used your settings. I'm using RF69HCW. IS this to be expected, or do I need to tweak one of your settings for the HCW model?
Title: Re: Changing the RMF69 radio configuration [+300kbps settings]
Post by: ChemE on April 01, 2017, 02:22:41 PM
That RSSI is unexpectedly low for sure.  I have both Ws and HWs and with those settings my RSSIs range from -50s at power level 0 to -25 or so at power level 31 when the radios are separated by 15' or so and line-of-sight or just a pane of glass in between them.  See the other thread about comments on caching RSSI so you can read it way faster though.  Something is still up though, b/c those numbers will come up some but not to what I get.