Author Topic: Optimizing radio settings for power (rfm69w/hw) [+300kbps settings]  (Read 23294 times)

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: Optimizing radio settings for power (rfm69w/hw)
« Reply #15 on: April 27, 2016, 06:43:52 AM »
Why not just solder a 50R SMD resistor (0603) across the ANT and GND terminals on the top of the package? Minimal stub, matched with a dummy load so you can TX without damage. We're talking 100mW of power so should be OK (you can get 100mW 0603s as standard, but that's 100mW transmitting continuously so lower duty cycles will be fine).
Mark.

WhiteHare

  • Hero Member
  • *****
  • Posts: 1300
  • Country: us
Re: Optimizing radio settings for power (rfm69w/hw)
« Reply #16 on: October 23, 2016, 03:28:50 PM »

Code: [Select]
RF_BITRATEMSB_300000, RF_BITRATELSB_300000, 
RF_FDEVMSB_300000, RF_FDEVLSB_300000,
RF_RXBW_DCCFREQ_010 | RF_RXBW_MANT_16 | RF_RXBW_EXP_0,
RF_PARAMP_40, RF_PACKET2_RXRESTARTDELAY_1BIT | RF_PACKET2_AUTORXRESTART_ON | RF_PACKET2_AES_OFF,
RF_TESTLNA_HIGH_SENSITIVITY, RF_PACKET1_FORMAT_VARIABLE | RF_PACKET1_DCFREE_WHITENING | RF_PACKET1_CRC_ON | RF_PACKET1_CRCAUTOCLEAR_ON | RF_PACKET1_ADRSFILTERING_OFF,

 

This is a good thread.  After a hiatus, I'm now circling back to upgrade my code to run at 300kbps.  Are the above still regarded as the optimal settings for 300kbps bitrate?

[Edit: Looks as though for 300kbps the current preferred RxBw is 500khz:  https://lowpowerlab.com/forum/rf-range-antennas-rfm69-library/changing-the-rmf69hcw-configuration-and-back/msg15219/#msg15219  , which is in agreement with the above.

I seem to recall the LNA high sensitivity setting was only to be enabled for the narrowest bandwidth, whereas the above seems (?) to have it enabled even at the widest bandwidth. Is that an error, or is it correct?  The datasheet seems to imply it reduces the noise floor, which might always be a good idea to run in any case if the increased power of running it is an acceptable trade-off.  Anyone know how much extra current draw is with the LNA turned on?  Or is that yet to be measured?]

joelucid

  • Hero Member
  • *****
  • Posts: 868
Re: Optimizing radio settings for power (rfm69w/hw)
« Reply #17 on: October 24, 2016, 04:22:14 AM »
WhiteHare, I have since run pretty extensive tests testing different modulation indexes at 300kbit. I would send the best settings I've come up with but I won't have my laptop around until end of the week. I'll follow up then.

joe

WhiteHare

  • Hero Member
  • *****
  • Posts: 1300
  • Country: us
Re: Optimizing radio settings for power (rfm69w/hw)
« Reply #18 on: October 24, 2016, 08:32:32 AM »
WhiteHare, I have since run pretty extensive tests testing different modulation indexes at 300kbit. I would send the best settings I've come up with but I won't have my laptop around until end of the week. I'll follow up then.

joe
Thanks!  I look forward to that.

I'm thinking that since the gateway isn't battery powered, it can transmit at high power for free, which would in a home environment likely save a wireless node from needing to turn-on the LNA sensitivity, except maybe as a last ditch fallback if it fails to receive.  Conversely, if it turns out turning-on LNA sensitivity has benefit at the high bandwidth (and I guess your testing might show whether or not it does), then the gateway could use it, and perhaps a wireless node could use a lower Tx (although in your case you said even the lowest Tx setting on an RFM69HW was still sufficient, so maybe it might matter on an RFM69W).  I remember from my RSSI noise floor testing that turning on LNA sensitivity does indeed appear to lower the noise floor at the narrowest bandwidth.

WhiteHare

  • Hero Member
  • *****
  • Posts: 1300
  • Country: us
Re: Optimizing radio settings for power (rfm69w/hw)
« Reply #19 on: October 28, 2016, 11:29:47 AM »
In theory RxBwAfc should be wider than RxBw, but the way this radio works that's not possible if RxBw=500kHz, because 500kHz is the widest bandwidth that can be specified for RxBwAfc.  [Edit: Not sure if that may have unintended consequences, like possibly impairing (?) AFC or something like that.  On the other hand, maybe at the wider bandwidths the worst case frequency misalignment  would not be significant enough (?) to worry about. ]
« Last Edit: October 28, 2016, 11:45:01 AM by WhiteHare »

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: Optimizing radio settings for power (rfm69w/hw)
« Reply #20 on: October 28, 2016, 11:40:11 AM »
At 300kHz FDEV and 300kbps BR you'll need RxBw >= 450kHz, the nearest to that is 500kHz. Setting RxBwAfc to 500kHz gives you 50kHz for clock offsets. RxBwAfc doesn't have to be wider than RxBw, it just needs to be big enough to cover the signal bandwidth plus the LO offset.
Mark.
« Last Edit: October 28, 2016, 02:21:28 PM by Felix »

WhiteHare

  • Hero Member
  • *****
  • Posts: 1300
  • Country: us
Re: Optimizing radio settings for power (rfm69w/hw)
« Reply #21 on: October 28, 2016, 11:47:45 AM »
At 300kHz FDEV and 300kHz BR you'll need RxBw >= 450kHz, the nearest to that is 500kHz. Setting RxBwAfc to 500kHz gives you 50kHz for clock offsets. RxBwAfc doesn't have to be wider than RxBw, it just needs to be big enough to cover the signal bandwidth plus the LO offset.
Mark.

Oh, I get it now.  Thanks.  I keep forgetting that the RxBw is only used for setting the Rx, and has no affect on Tx.  [Edit: apparently the Tx bandwidth is purely a function of the bitrate, and so the Tx bandwidth just naturally widens as bitrate increases.  i.e. Tx bandwidth is not a parameter you set per se, but just a physical consequence of the bitrate.  At least, without really knowing, I'm inferring that's how it works...  ]
« Last Edit: October 28, 2016, 12:03:09 PM by WhiteHare »

WhiteHare

  • Hero Member
  • *****
  • Posts: 1300
  • Country: us
Re: Optimizing radio settings for power (rfm69w/hw)
« Reply #22 on: October 28, 2016, 03:04:33 PM »
So, I upgraded now to running at 300kbps as the default, and all is good.   :)

Not surprisingly, RSSI is a lot lower than with a narrower bandwidth.  What did surprise me, though, is that RSSI seems to fall at a much lower rate with distance.   :o Not sure why that is, but I'm glad for it.   8)

[Edit: Doh!  Of course, because it's a logarithmic scale, not a linear one.   ::)]
« Last Edit: October 28, 2016, 03:07:39 PM by WhiteHare »

joelucid

  • Hero Member
  • *****
  • Posts: 868
Re: Optimizing radio settings for power (rfm69w/hw)
« Reply #23 on: October 28, 2016, 03:11:52 PM »
Actually RSSI should not be lower using a higher fdev. You're just spreading out the signal across a larger freq range. If rxbw is large enough there should be little difference. What you will see is a higher noise floor and better rssi needed to get the signal across.

Joe

WhiteHare

  • Hero Member
  • *****
  • Posts: 1300
  • Country: us
Re: Optimizing radio settings for power (rfm69w/hw)
« Reply #24 on: October 28, 2016, 03:30:13 PM »
I guess my settings are wrong then, because RSSI appears to be a lot lower.  Here are the settings and then results from 10 feet away:

Quote
Radio Configuration:
====================
Receiver-Mode(RX)
Packet Mode, FSK modulation scheme
RegDioMapping1=B1000000=0x40
RegDioMapping2=B111=0x7
[ActualBitrate] 299065.406bps
[theDccFreq] B10 (equals Semtech default)
[RxBw] 500000Hz
  [RxBwMant] 16
  [RxBwExp] 0
[FDEV] 250000Hz
Beta=((2*FDev)/BitRate)=1.67
Fcutoff=19894.37Hz
  Percentage=3.98%
Warning: low Beta.
[theDccFreqAfc] B100 (equals Semtech default)
[RxBwAfc] 500000Hz
  [RxBwMantAfc] 16
  [RxBwExpAfc] 0
[frequency-center] 915000000Hz
[regLNA] B1000
  [LnaZin] B0 -> Input Impedance = 50 ohm (Warning: Semtech default is 200 ohm).
  [LnaCurrentGain] B1 -> G1
  [LnaGainSelect] B0 -> gain set by the internal AGC loop.  Matches Semtech default.
[regAFCFEI] B10000
  [FeiDone] B0 -> FEI is on-going (i.e. not finished).  Matches Semtech default.
  [AfcDone] B1 -> AFC is finished (i.e. not on-going).  Matches Semtech default.
  [AfcAutoclearOn] B0 -> Invalid, because AfcAutoOn is not set.
  [AfcAutoOn] B0 -> AFC is performed each time AfcStart is set (i.e. not each time Rx mode is entered).
               ^Matches Semtech default.
RegPaLevel=B1111111
theRegOCP=0xF
RegTestPa1=0x55
RegTestPa2=0x70
RegRssiThresh=0xDC
   ==> RSSI Threshold = -110.0dB
---------------------------------------------------------------------
#[1][2] FLASH_MEM_ID:0xEF30   [RX_RSSI:-104]
 - ACK sent. Pinging node 2 - ACK...ok!
#[2][2] 1   [RX_RSSI:-103]
 - ACK sent.
#[3][2] 12   [RX_RSSI:-107]
 - ACK sent.
#[4][2] 123   [RX_RSSI:-111]
 - ACK sent. Pinging node 2 - ACK...ok!
#[5][2] 123    [RX_RSSI:-102]
 - ACK sent.
#[6][2] 123    [RX_RSSI:-102]
 - ACK sent.
#[7][2] 123 A   [RX_RSSI:-104]
 - ACK sent. Pinging node 2 - ACK...ok!
#[8][2] 123 AB   [RX_RSSI:-103]
 - ACK sent.


perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: Optimizing radio settings for power (rfm69w/hw)
« Reply #25 on: October 28, 2016, 03:41:21 PM »
You have a low modulation index, I think you forgot to change FDEV to 300kHz as well.
Mark.

WhiteHare

  • Hero Member
  • *****
  • Posts: 1300
  • Country: us
Re: Optimizing radio settings for power (rfm69w/hw)
« Reply #26 on: October 28, 2016, 05:53:03 PM »
Thanks.  Made that change, but still no joy:
Quote
Radio Configuration:
====================
Receiver-Mode(RX)
Packet Mode, FSK modulation scheme
RegDioMapping1=B1000000=0x40
RegDioMapping2=B111=0x7
[ActualBitrate] 299065.406bps
[theDccFreq] B10 (equals Semtech default)
[RxBw] 500000Hz
  [RxBwMant] 16
  [RxBwExp] 0
[FDEV] 299987Hz
Beta=((2*FDEV)/BitRate)=2.01
Fcutoff=19894.37Hz
  Percentage=3.98%
[theDccFreqAfc] B100 (equals Semtech default)
[RxBwAfc] 500000Hz
  [RxBwMantAfc] 16
  [RxBwExpAfc] 0
[frequency-center] 915000000Hz
[regLNA] B1000
  [LnaZin] B0 -> Input Impedance = 50 ohm (Warning: Semtech default is 200 ohm).
  [LnaCurrentGain] B1 -> G1
  [LnaGainSelect] B0 -> gain set by the internal AGC loop.  Matches Semtech default.
[regAFCFEI] B10000
  [FeiDone] B0 -> FEI is on-going (i.e. not finished).  Matches Semtech default.
  [AfcDone] B1 -> AFC is finished (i.e. not on-going).  Matches Semtech default.
  [AfcAutoclearOn] B0 -> Invalid, because AfcAutoOn is not set.
  [AfcAutoOn] B0 -> AFC is performed each time AfcStart is set (i.e. not each time Rx mode is entered).
               ^Matches Semtech default.
RegPaLevel=B1111111
theRegOCP=0xF
RegTestPa1=0x55
RegTestPa2=0x70
RegRssiThresh=0xDC
   ==> RSSI Threshold = -110.0dB
---------------------------------------------------------------------
#[1][2] FLASH_MEM_ID:0xEF30   [RX_RSSI:-103]
 - ACK sent. Pinging node 2 - ACK...ok!
#[2][2] 1   [RX_RSSI:-102]
 - ACK sent.
#[3][2] 12   [RX_RSSI:-102]
 - ACK sent.
#[4][2] 123   [RX_RSSI:-104]
 - ACK sent. Pinging node 2 - ACK...nothing
#[5][2] 123    [RX_RSSI:-107]
 - ACK sent.
#[6][2] 123 A   [RX_RSSI:-101]
 - ACK sent.
#[7][2] 123 AB   [RX_RSSI:-103]
 - ACK sent. Pinging node 2 - ACK...nothing


perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: Optimizing radio settings for power (rfm69w/hw)
« Reply #27 on: October 28, 2016, 06:57:43 PM »
Ok, try turning auto Afc on? Currently AfcAutoOn is not set, which means unless you're manually triggering there may be a local oscillator offset in your TX and RX frequencies.
RegOcp, RegTestPa1 and RegTestPa2 are set strangely. I'm not sure what the library you're using does with these, see section 3.3.7 in the sx1231h spec.

Mark.
« Last Edit: October 28, 2016, 07:08:00 PM by perky »

joelucid

  • Hero Member
  • *****
  • Posts: 868
Re: Optimizing radio settings for power (rfm69w/hw)
« Reply #28 on: October 29, 2016, 10:45:26 AM »
Here are my 300kbit settings:

Code: [Select]
SX1231_REG_BITRATEMSB, SX1231_BITRATEMSB_300000,
SX1231_REG_BITRATELSB, SX1231_BITRATELSB_300000,
SX1231_REG_FDEVMSB, SX1231_FDEVMSB_200000,
SX1231_REG_FDEVLSB, SX1231_FDEVLSB_200000,
SX1231_REG_RXBW, SX1231_RXBW_DCCFREQ_010 | SX1231_RXBW_400000,
SX1231_REG_RSSITHRESH, 255,
SX1231_REG_PREAMBLELSB, 6,
SX1231_REG_PACKETCONFIG2, SX1231_PACKET2_RXRESTARTDELAY_2BITS | SX1231_PACKET2_AUTORXRESTART_OFF |  SX1231_PACKET2_AES_OFF,
SX1231_REG_PACKETCONFIG1, SX1231_PACKET1_FORMAT_VARIABLE | SX1231_PACKET1_DCFREE_WHITENING | SX1231_PACKET1_CRC_ON | SX1231_PACKET1_CRCAUTOCLEAR_ON | SX1231_PACKET1_ADRSFILTERING_OFF,
SX1231_REG_PARAMP, SX1231_PARAMP_10,
SX1231_REG_LNA, SX1231_LNA_GAINSELECT_MAX

I'm using a fairly low modulation index which was determined by trying the full range. AFC and AGC are off, gain at max and rssi thresh at 255 - this works well when nodes aren't too close to each other. I found I needed a longer preamble at 300kbit - here it's 6 bytes. I don't recall why this was necessary.

Joe

WhiteHare

  • Hero Member
  • *****
  • Posts: 1300
  • Country: us
Re: Optimizing radio settings for power (rfm69w/hw)
« Reply #29 on: October 29, 2016, 12:14:47 PM »
Ok, try turning auto Afc on? Currently AfcAutoOn is not set, which means unless you're manually triggering there may be a local oscillator offset in your TX and RX frequencies.
RegOcp, RegTestPa1 and RegTestPa2 are set strangely. I'm not sure what the library you're using does with these, see section 3.3.7 in the sx1231h spec.

Mark.

I decided to start with a clean slate.  I boiled it down to the following, which I add to the end of setup in Felix's node and gateway examples:
Code: [Select]
  // set baud rate to 300kbps
  // equals 0x006B according to datasheet table 9
  radio.writeReg(0x03,0x00);  //set regBitrateMsb
  radio.writeReg(0x04,0x6B);  //set regBitrateLsb

  //set RxBW to 500kHz
  radio.writeReg(0x19,0x40); 

  //set RxBWAfc to 500kHz
  radio.writeReg(0x1A,0x80);

  // Set FDEV to 300khz, implies Fdev=0x1333
  // Set Fdev registers:
  radio.writeReg(0x05,0x13);  //write MSB of Fdev
  radio.writeReg(0x06,0x33);  //write LSB of Fdev 
}

The result is the same.  It must be something obvious that's staring me in the face, but so far I don't see what it is.