Git Product home page Git Product logo

Comments (11)

terrillmoore avatar terrillmoore commented on June 12, 2024

See #50 #46 etc.

from arduino-lmic.

ngraziano avatar ngraziano commented on June 12, 2024

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).

from arduino-lmic.

terrillmoore avatar terrillmoore commented on June 12, 2024

@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 *_updateTx() is supposed to do.

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:

static void configPower () {
#ifdef CFG_sx1276_radio
// PA_BOOST output is assumed but not 20 dBm.
s1_t pw = (s1_t)LMIC.txpow;
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)
s1_t pw = (s1_t)LMIC.txpow;
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 */
}

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([email protected]) this also is where we'd adjust for antenna gain other than 3 dBi.

#ifdef CFG_sx1276_radio
    // TODO([email protected]) 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.

from arduino-lmic.

ngraziano avatar ngraziano commented on June 12, 2024

I check regional parameter and I see a problem with region like AS923 where Max EIRP is set by TxParamSetupReq.
In actual code for AS923, adrTxPow store the delta and not the absolute value.

Maybe adrTxPow should store the delta for all region and not the absolute value.

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.

from arduino-lmic.

pomplesiegel avatar pomplesiegel commented on June 12, 2024

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

LMIC_setDrTxpow(DR_SF7,2);

and

LMIC.datarate = DR_SF7;
LMIC.txpow = 2; 

seemingly still have no effect.

Thank you!

from arduino-lmic.

pomplesiegel avatar pomplesiegel commented on June 12, 2024

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
LMIC_setDrTxpow() and restore its effectiveness? Am I correct in believing that it does not affect the Spread factor as well?

Thank you!

from arduino-lmic.

terrillmoore avatar terrillmoore commented on June 12, 2024

@pomplesiegel -- LMIC_setDrTxpow() sets the spreading factor, but that will get reset by network downlinks that happen during and after a joint. In other words, you may find that you have to set the data rate several times to make things effective, and you may have to turn off ADR (which can be done, and which works). Network operators are not always happy if you do this, but... sometimes it's necessary.

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.

from arduino-lmic.

pomplesiegel avatar pomplesiegel commented on June 12, 2024

@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!

from arduino-lmic.

terrillmoore avatar terrillmoore commented on June 12, 2024

This is now fixed with #416 and #410

from arduino-lmic.

Commifreak avatar Commifreak commented on June 12, 2024

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 :)

from arduino-lmic.

martin3000 avatar martin3000 commented on June 12, 2024

see lorabase_eu868.h :
EU868_TX_EIRP_MAX_DBM = 16

from arduino-lmic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.