-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
LMIC_setDrTxpow() is ineffective #21
Comments
For EU like region we can do something like this commit ngraziano/arduino-lmic@3948c8c It will allow the network to reduce power if quality of signal is good enough (TTN do that). |
@ngraziano Thanks for the reference, that make it clear. I see that. in fact, this management of txpow is one of the important things that I like the idea of using the ADR value as a maximum. But after reviewing the code, I think it might be better to put it more centrally. It turns out that txpow is only meaningfully referenced one place in radio.c around line 445. Allowing for some refactoring, that's where we should consider adrTxPow. Here's the current code: Lines 445 to 474 in c208277
Instead ("NOTE" comments added to explain why I changed things, other comments intended for publication) static void configPower () {
// NOTE: no need for (s1_t) cast, txpow is declared s1_t.
s1_t pw = LMIC.txpow;
// enforce ADR limitations and adminstrative power limits here. The
// bandplans set txpow to the desired target in terms of power at
// the radio.
if (pw > LMIC.adrTxPow)
pw = LMIC.adrTxPow;
// TODO(tmm@mcci.com) this also is where we'd adjust for antenna gain other than 3 dBi.
#ifdef CFG_sx1276_radio
// TODO(tmm@mcci.com) now that we have the enhanced HAL, we could delegate this work,
// thereby allowing PAs to work properly on devices like the Murata that support 20 dB tx.
// In fringes, an extra 3 dB could be very helpful.
// PA_BOOST output is assumed but not 20 dBm.
if(pw > 17) {
pw = 17;
} else if(pw < 2) {
pw = 2;
}
// 0x80 forces use of PA_BOOST; but we don't
// turn on 20 dBm mode. So powers are:
// 0000 => 2dBm, 0001 => 3dBm, ... 1111 => 17dBm
// But we also enforce that the high-power mode
// is off by writing RegPaDac.
writeReg(RegPaConfig, (u1_t)(0x80|(pw - 2)));
writeReg(RegPaDac, readReg(RegPaDac)|0x4);
#elif CFG_sx1272_radio
// set PA config (2-17 dBm using PA_BOOST)
if(pw > 17) {
pw = 17;
} else if(pw < 2) {
pw = 2;
}
writeReg(RegPaConfig, (u1_t)(0x80|(pw-2)));
#else
#error Missing CFG_sx1272_radio/CFG_sx1276_radio
#endif /* CFG_sx1272_radio */
} I need some volunteers to test... or I need to get this working with the RWC5020A. But that is a few weeks off. |
I check regional parameter and I see a problem with region like AS923 where Max EIRP is set by Maybe But I am little lost because in lorawan regional parameters for E868 do not match the code and there is no power per band. This topic need more thinking. |
Any thoughts on how this would be resolved? Any quick hard-coded fixes for those of us using this only one region and trying to LIMIT power? In my case, I would like to put the RFM95W to its lowest power level (in USA at 915Mhz), but calls like
and
seemingly still have no effect. Thank you! |
Update: I'm just manually setting s1_t pw = 2; in radio.c, as my region and location will be static. Still though, is there a plan to resolve Thank you! |
@pomplesiegel -- As for changing the tx power, yes... the delay is due to lack of time on my part to set up a proper test -- we really want to make sure we're controlling power properly. I have been planning to run US LoRaWAN certification tests, which would (I think) clear up enough of the otehr issues to let this be addressed. But I don't know if I'll get to it this quarter, because of pressing work for MCCI's other projects. |
@terrillmoore, thanks so much for the in-depth response. This is very helpful information on the spreading factor, as I had heard varying reports from others. I totally understand about the tx power issue and the need to get it right. In the meantime people like me will just hard-code a value and that's fine. Very exciting about the US LoraWan cert tests. I imagine that is a major question on many of our minds: When following best practices and using sanctioned hardware with this fork of LMIC, are we being compliant and future-proof with our devices? Thanks again! |
I have an additional question about the Tx power... What is the initial value if nothing is set? I use the lib for an SX1276 with this config: #define CFG_eu868
#define CFG_sx1276_radio 1
#define DISABLE_PING
#define DISABLE_BEACONS
#define LMIC_DEBUG_LEVEL 2 Thanks :) |
see lorabase_eu868.h : |
LMIC_setDrTxpow()
doesn't really do anything.Although calling it sets
LMIC.adrTxpow
to the input parameter, the value is then never used inside the LMIC library. This is because LMIC's radio.c usesLMIC.txpow
, and in US915,lmic.c::updatetx()
setsLMIC.txpow
to 30 for 125kHz channels, and 26 for 500kHz channels, ignoringLMIC.adrTxpow
. Finally, radio.cconfigPower()
limits the value to 17 dBm, and doesn't turn on the +20 dBm option if over 17 dBm. This wouldn't cause much of a problem in Europe, as you're limited to 16dBm EIRP, and so we have to subtract 3 dBm anyway. But in the US it's a limit.Exact rules in the US (per LoRaWAN 1.0.2)
At present, however, it seems that neither manual nor automatic TX power control can set the power above 10 dBm; and (in the US), the TX power is fixed at 10 dBm.
To fix this:
updatetx()
so that ADR worksThe text was updated successfully, but these errors were encountered: