Commit Graph

16 Commits (0da589e6e725c3757c6b3ecbf973732e48879ceb)

Author SHA1 Message Date
Hasnain Virk e1e48b492b Final cleanup and ASCII art for algorithm v2
Final code cleanup and adding ascii art for the version 2 of the
algorithm.
2018-12-10 08:53:30 +02:00
Hasnain Virk 5170daa00a RX window calculation algorithm version 2
In this version we try to mitigate a situation when we start listening
right in the middle of a preamble sequence (e.g., in high SF case).
2018-12-10 08:53:30 +02:00
Hasnain Virk 3ec643f06a Style alignment
Minor style alignment.
2018-12-10 08:53:30 +02:00
Hasnain Virk 88490fb145 Mitigating reception problems with lower data rates
A new algorithm has been taken in use to calculate the receive window
length and the timing offset involved in opening of the said receive
window. This algorithm performs better than the stock algorthm and
consumes less power.
2018-12-10 08:53:30 +02:00
Hasnain Virk 5cca2f2e76 Adding override for TX ch. selection in CN470 PHY
set_next_channel() is the base function provided by LoRaPHY class and should be overridden
by the PHYs who behave differently as compared to EU868 like PHY layers.
CN470 PHY had been missing such an override.
In addition to that we have provided a parameter "fsb-mask-china" that can be used to
enforce a custom frequency sub-band of operation as most of the base stations in the market
may not support all 96 channels. Such a strategy will help in rapid network acquisition.
2018-08-27 12:50:09 +03:00
Hasnain Virk 8f0bb07390 Removing US915Hybrid PHY
This phy implementation was just to support a single sub-band in US region.
As we have decided to make FSBs configurable, we do not need this class anymore.
2018-08-24 15:32:12 +03:00
Hasnain Virk 207ae2dedf Adding FSB selection feature for US915 PHY
User can now define a custom frequency sub-band for the US915 PHY.
FSB_Usage.txt defines how this parameter will be configured.
2018-08-24 15:31:53 +03:00
Kimmo Vaisanen 2f15dae400 Lora: Refactor duty-cycle configuration and introduce config for JOIN request
- Duty cycle can be now only disabled with duty-cycle-on flag if region supports duty-cycle.
  If region does not support duty-cycle, this flag has no effect and duty cycle is always
  disabled.

- Also introduced a new flag (duty-cycle-on-join) to disable duty cycle for JOIN requests.
  This flag can be used for testing only and is used to speed up JOIN request testing as
  backoff times for JOIN request are really long (easily several minutes per attempt).
  This flag works in conjunction with main duty cycle setting. Disabling duty-cycle-on-join
  works only if duty-cycle-on is disabled (or region settings have duty cycle disabled).
2018-08-20 15:30:15 +03:00
Hasnain Virk d76f6c07e9 Making recv timing error and preamble length configurable
We had a bug especially in the reception path. Our recv window opening
delays were being calculated on the premise that the radio has to capture
5 preamble symbols out of 8 transmitted by the base station. However, in PHY
layer while setting radio rc settings, we were setting preamble length to be 8.
Preamble length register needs to be configured differently for Uplink and Downlink.
For uplink, we wish to transmit 8 preamble symbols whereas in the reception path we need
to receive 5 preamble symbols at least out of 8.
Alongwith that the maximum range of timing error may vary from platform to platform as it
is based upon the crystal in the chip. We have now made these parameters configurable and
have loaded them with the most optimal defaults.
2018-07-30 15:25:36 +03:00
Kimmo Vaisanen d336ceeee8 Lora: Make automatic uplink message configurable
Currently lora stack will automatically send an empty uplink message to lora gateway in case of:
- Node received message with pending bit set.
- Node received MAC command which requires instant response (sticky MAC command)
- Node received confirmed message in class C mode

This commit makes this configurable via config item

        "automatic-uplink-message": {
            "help": "In case of pending bit, class c confirmed message or sticky MAC command, stack will automatically send empty uplink message",
            "value": true
        }

Default value is true. If sending an empty message fails, stack will send event AUTOMATIC_UPLINK_ERROR application.

If automatic uplink sending is disabled, stack will send application UPLINK_REQUIRED -event to indicate
application should issue a new uplink to gateway as soon as possible.
2018-04-18 09:29:20 +03:00
Antti Kauppila d1bbd21e01 LoRa: Improved handling of region selection
- This implements IOTCELL-697
- This touches API, but does not break it, old ones still work in a same manner!
2018-04-09 11:10:40 +03:00
Hasnain Virk 4432ad9ae7 Major PHY layer modifications
The PHY layer had a lot of duplicated code in various geographic regions.
In this commit we have tried to concentrate all common functionaliy into
one single class which LoRaPHY that provides three kind of methods:

i) Non virtual base methods which are there for upper layer use, e.g.,
   providing access to driver or generic PHY layer functionality which
   needs to be exposed to upper layers.

ii) Virtual methods (no hard limit on implementation) that can be overriden
    in derived classes. Some PHY implementations will need that as they may
    come with very peculiar channel schemes, e.g., dynamic channel schemes
    in US bands.

iii) Protected methods which are only available for the derived PHYs

We have adopted a mechanism for the dervied PHYs to announce their differenmtiating
parameters in their constructors by filling up a data structure known as lora_phy_params_t
which exists at base level. Access modifier for this data structure is protected so it can only be
used by the base or derived classes, i.e., no exposure to upper layers.

For extra functionality and differentiating controls, a derived PHY can override any virual method as necessary.

In addition to that we have adopted the Mbed-OS style guide and have changed data structures and code to reflect that.
Some data structures are removed.

* Algorithm to get alternate DR is modified. Current scheme, works as multiples of 6 as EU and EU like PHYs
provide 6 datarates. We make sure that we try a datarate at least once. If nuber of join retries is a multiple
of 6, we may try multiple times on each data rate.

* Most of the PHYs with dynamic channel plans, always override the above mentioned algorithm as the rules governing
  this algorithm do not hild in their case.

* band_t data structure is enhanced with lower band frequency and higher band frequency. That enables us to validate
  frequency based upon the band and hence we can have a single function for all PHYs to validate frequency.

* In some PHYs, there were some extra channel masks were defined which were not being used. Hence removed.

* EIRP table corrected in some PHYs based upon spec.

* PHY functions in response to Mac commands are renamed to reflect what they exactly do.
  for example accept_rx_param_setup_req() because that's what they do. they can either accept
  the mac command or reject it.# Please enter the commit message for your changes.
2018-02-11 00:31:47 +02:00
Kimmo Vaisanen 34c034dfff Remove duplicate configuration flags
This commit changes code to use directly mbed os configuration system generated
compilation flags.
2018-02-11 00:31:47 +02:00
Kimmo Vaisanen 1eedadd52d Change region configuration help format
New mbed os configuration parser no longer seems to allow multiline help description.
2018-02-11 00:31:47 +02:00
Hasnain Virk 6281073d8b [IOTCELL-279] Using Application provided EventQueue
The EventQueue thread in LoRaMac.cpp is disbanded and the LoRaWAN
protocol is redesigned to store a pointer for an application
provided EventQueue. It means that now the stack runs in the
same thread as application. Application provided EventQueue is used
to defer ISRs from radio driver and timer callbacks as well as the
application events are queued to the same event loop.
2018-02-09 11:00:56 -06:00
Hasnain Virk 2f860d2be5 Adding LoRaWANStack class to control MAC and PHY
LoRaWANStack class is our controller layer on top of our
current MAC and PHY layer. It provides services to an implementation
of LoRaWANBase class.

It is a singleton class owing to the fact that the mac layer underneath
is not a class object. Instead, it uses the MAC via setting mib, mlme, mcps
requests and getting responses back from the mac layer using confirmations and
indications.

In essense this class is a special handle for
mac layer underneath which is predominantly reference design based.
In future we may refactor the LoRaMac.cpp code to make it object oriented
and cleaner.

At one end, it binds the application selected radio driver with the PHY layer
and at the other end it provides services to upper layers handling the mac via
well defined APIs.

For proper selection of a PHY layer, user must use Mbed config system.
For this purpose an mbed_lib.json is provided which can be overriden by the
user defined mbed_app.json. By default the EU868 band is selected as a PHY layer.
User must set relevant keys for the selected connection mechanism.
2018-02-09 11:00:56 -06:00