Sorry to come back to this issue.
Looking a the RFM69 documentation and from the allowed settings described in the RFM69 library only two modes are possible:
For RFM69, PA0 set, the power range is from -18 to +13dBm (from the Pout formula offset is -18, so output power 0 means -18 and 31 means +13)
For RFM69H, PA0 is reset, PA1,PA2 are set and RegOcp is set to x05x, however there is no high output because, RegTestPa1 and RegTestPa2 are defaulted
The power range is therefore from +2 to +17 dBm (from the Pout Formula, offset is -14, so minimum output power 16 means +2 dBm, 31 means +17)
My concern is the update done for the setPowerLevel function, which doesn’t allow to set the power for a RFM69HW module anymore.
The reason is that the value given to the power is now divided by two, meaning that the maximum value is now 15 which is out of the possible range.
In fact the problem is a several levels.
1. After power ON the RegPaLevel is set to 0x9F (1011111) i.e. PA0 set and output power 31
2. By default the parameter _powerLevel is also set to 31.
At the radio initialisation the function setHighPower is called but the setting is different according the RFM model.
if RFM69H is set then PA0 is set to 0, PA1 and PA2 are set to 1, the power value is left as it was (this case 31)
if RFM69 then PA1 is set to 1, PA1 and PA2 are set to 0, and the power is modified by the value of _powerLevel (this case 31) which is OK
void RFM69::setHighPower(bool onOff) {
_isRFM69HW = onOff;
writeReg(REG_OCP, _isRFM69HW ? RF_OCP_OFF : RF_OCP_ON);
if (_isRFM69HW) // turning ON
writeReg(REG_PALEVEL, (readReg(REG_PALEVEL) & 0x1F) | RF_PALEVEL_PA1_ON | RF_PALEVEL_PA2_ON); // enable P1 & P2 amplifier stages
else
writeReg(REG_PALEVEL, RF_PALEVEL_PA0_ON | RF_PALEVEL_PA1_OFF | RF_PALEVEL_PA2_OFF | _powerLevel); // enable P0 only
}
This means that for a RFM69H module the maximum power of 17 dBm is achieved (I used it like this while combining my network with motes running RFM69 without problems)
3. Now using the function setPowerLevel, for instance by setting the value to 18
in case of RFM69 is set, PA0,1,2 are unchanged and the power is modified by the value of _powerLevel (this case 18)
if RFM69H is set, PA0,1,2 are unchanged but the power is modified by the value of _powerLevel (which is the parameter value divided by 2, in this case 9) Why?
void RFM69::setPowerLevel(uint8_t powerLevel)
{
_powerLevel = (powerLevel > 31 ? 31 : powerLevel);
if (_isRFM69HW) _powerLevel /= 2;
writeReg(REG_PALEVEL, (readReg(REG_PALEVEL) & 0xE0) | _powerLevel);
}
4. If now we want to set the power level to its maximum using setHighPower(true) the result is the following:
if RFM69H is set then PA0 is set to 0, PA1 and PA2 are set to 1, the power value is left as it was (this case 9)
if RFM69 then PA1 is set to 1, PA1 and PA2 are set to 0, and the power is modified by the value of _powerLevel (this case 18)
So in my point of view is that there is a confusion between setPowerLevel and setHighPower.
setHighPower (true or false) means activate the RFM69H Power Amplifiers (and not High output), this function should only modify the PA bits and RegOcp and not modify the output power value (as it is currently only for the RFM69 module) which may still configured as by default to 31.
setPowerLevel (value 0-31) should modify the output power only (as it was before independently of the RFM69 module). A test my be done on the value which should be between 0 and 31 fort a RFM module and 16 to 31 for a RFMH module.
Set High Output (+5 to 20dBm) if necessary should be achieved with another function setting the RegTestPa1 an Pa2 according to table 11, but this is another story.
Hoping to be correct with these explanations
Robert