Skip to content

LoRa: RX2 DR is ignored and wrong one is applied #7820

Closed
@maxgerhardt

Description

@maxgerhardt

Description

  • board type: Nucleo L476RG with RFM95W radio
  • latest commit mbed-os
  • GCC

I am using the LoRaWAN stack with The Things Network (TTN), which has its RX2 window on SF9BW125, a.k.a DR_3 for EU868 (https://www.thethingsnetwork.org/docs/lorawan/frequency-plans.html), not the actual SF12 standard.

So, I have to modify the LoRaPHYEU868.cpp file in order to change the hard-coded

#define EU868_RX_WND_2_DR          DR_0

to

#define EU868_RX_WND_2_DR          DR_3//DR_0

This worked fine in previous stack versions.

Then, commit b0b0261 broke it.

The radio is now listening in the RX2 window on SF7 (highest possible datarate) instead of the SF9 I want it to listen on, dictated by phy_params.rx_window2_datarate

Previously in LoRaPHY.cpp:523, this is where the RX2 datarate was set:

    params->sys_params.rx2_channel.datarate = get_default_rx2_datarate();

Now this has become

    // RX2 data rate should also start from the maximum
    params->sys_params.rx2_channel.datarate = get_default_max_tx_datarate(); 

Since get_default_rx2_datarate() is never called in any other place, the PHY's RX2 datarate is ignored completely.

The commit message says something about starting on a higher rate for joining a network (aka OTAA?). However, I'm using ABP and this bug still occurs.

When I manually change it back to respect my PHY's RX2 datarate again, it receives packets again as normal.

Without this change, reception is utterly crippled, since TTN lets the gateways mostly reply back in RX2 when a packet is sent on a higher SF. About 90% packet loss when no RX2 packet is received makes the mbed-os LoRaWAN stack unusable in this scenario .

Request:

  • Justify the change to ignore the PHY's RX2 datarate but use the highest possible TX datarate for an RX window
  • fix code for the ABP codepaths, keep that old code for OTAA if needed

Appendix note:

Actually we're talking about two separate problems here: For TTN, the RX2 window is by-default on the wrong data rate of you're using ABP (SF12BW125). You must edit the PHY's source code file to fix this to SF9BW125 if you want to use TTN on the European continent with ABP. Secondly, after the above referenced commit, ABP is broken even if you edit the EU868_RX_WND_2_DR macro, because the radio now uses SF7BW125 in RX2. Maybe a macro configuration MBED_CONF_FORCE_RX2_DR would be nice?

Issue request type

[ ] Question
[ ] Enhancement
[X] Bug

@hasnainvirk would be great if you'd take a quick a look at it :)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions