Skip to content

Conversation

@jgromes
Copy link
Owner

@jgromes jgromes commented Jan 17, 2026

This PR add support for the latest LoRa radio, LR2021. It is currently in public preview in this branch. Once the features listed below are implemented, it will be merged into master.

  • Basic Tx+Rx over LoRa in UHF band
  • Support for >1 GHz bands
  • Support for GFSK modem
  • Support for LR-FHSS modem
  • Support for FLRC modem
  • Support for OOK modem
  • Multi-SF reception
  • Add examples
  • Update readme and tags

Closes #1457

@jgromes jgromes marked this pull request as ready for review January 24, 2026 19:05
@lyusupov
Copy link
Contributor

lyusupov commented Jan 24, 2026

One more typo



remains

  1. here
    // disable address filterin
  2. and there
    // disable address filterin


P.S. you will add support for LR2021 antenna RF switch method ( SetDioRfSwitchConfig ) in the future, is that correct ?

/tmp/arduino/sketch/src/driver/radio/radiolib.cpp:4811:5: error: 'RADIOLIB_LR2021_DIO5' was not declared in this scope
     RADIOLIB_LR2021_DIO5, RADIOLIB_LR2021_DIO6,
     ^~~~~~~~~~~~~~~~~~~~
/tmp/arduino/sketch/src/driver/radio/radiolib.cpp:4811:5: note: suggested alternative: 'RADIOLIB_LR11X0_DIO5'
     RADIOLIB_LR2021_DIO5, RADIOLIB_LR2021_DIO6,
     ^~~~~~~~~~~~~~~~~~~~
     RADIOLIB_LR11X0_DIO5
/tmp/arduino/sketch/src/driver/radio/radiolib.cpp:4811:27: error: 'RADIOLIB_LR2021_DIO6' was not declared in this scope
     RADIOLIB_LR2021_DIO5, RADIOLIB_LR2021_DIO6,
                           ^~~~~~~~~~~~~~~~~~~~
/tmp/arduino/sketch/src/driver/radio/radiolib.cpp:4811:27: note: suggested alternative: 'RADIOLIB_LR11X0_DIO6'
     RADIOLIB_LR2021_DIO5, RADIOLIB_LR2021_DIO6,
                           ^~~~~~~~~~~~~~~~~~~~
                           RADIOLIB_LR11X0_DIO6
/tmp/arduino/sketch/src/driver/radio/radiolib.cpp:4817:15: error: 'MODE_STBY' is not a member of 'LR2021'
     { LR2021::MODE_STBY,   { LOW,  LOW  } },
               ^~~~~~~~~
/tmp/arduino/sketch/src/driver/radio/radiolib.cpp:4818:15: error: 'MODE_RX' is not a member of 'LR2021'
     { LR2021::MODE_RX,     { LOW,  LOW  } },
               ^~~~~~~
/tmp/arduino/sketch/src/driver/radio/radiolib.cpp:4819:15: error: 'MODE_TX' is not a member of 'LR2021'
     { LR2021::MODE_TX,     { LOW,  LOW  } },
               ^~~~~~~
/tmp/arduino/sketch/src/driver/radio/radiolib.cpp:4820:15: error: 'MODE_TX_HP' is not a member of 'LR2021'
     { LR2021::MODE_TX_HP,  { LOW,  LOW  } },
               ^~~~~~~~~~
/tmp/arduino/sketch/src/driver/radio/radiolib.cpp:4821:15: error: 'MODE_TX_HF' is not a member of 'LR2021'
     { LR2021::MODE_TX_HF,  { LOW,  LOW  } },
               ^~~~~~~~~~
/tmp/arduino/sketch/src/driver/radio/radiolib.cpp:4822:15: error: 'MODE_GNSS' is not a member of 'LR2021'
     { LR2021::MODE_GNSS,   { LOW,  LOW  } },
               ^~~~~~~~~
/tmp/arduino/sketch/src/driver/radio/radiolib.cpp:4823:15: error: 'MODE_WIFI' is not a member of 'LR2021'
     { LR2021::MODE_WIFI,   { LOW,  LOW  } },
               ^~~~~~~~~
/tmp/arduino/sketch/src/driver/radio/radiolib.cpp: In function 'void lr20xx_setup()':
/tmp/arduino/sketch/src/driver/radio/radiolib.cpp:5393:15: error: 'class LR2021' has no member named 'setRfSwitchTable'
     radio_g4->setRfSwitchTable(rfswitch_dio_pins_noname, rfswitch_table_noname);
               ^~~~~~~~~~~~~~~~

@StevenCellist
Copy link
Collaborator

Soldered some pins to the LR2021 that LilyGo kindly provided, hoping to test LoRaWAN functionality tomorrow :)

@jgromes
Copy link
Owner Author

jgromes commented Jan 25, 2026

@lyusupov

you will add support for LR2021 antenna RF switch method ( SetDioRfSwitchConfig ) in the future, is that correct ?

I can add my best guess as to how it should work, but it will be untested, because both LR2021 boards I am currently working with use a switch-less design.

@lyusupov
Copy link
Contributor

lyusupov commented Jan 25, 2026

It's Ok
A module with RF switch (at least shown in the schematics) is expected to be delivered from @lewisxhe to me next week.
Hopefully, I will be able to confirm if it works or not.

@lyusupov
Copy link
Contributor

lyusupov commented Jan 25, 2026

@jgromes

DIOs available for RF switch logic are 7

image

while RFSWITCH_MAX_PINS constant is set to 5.

static const size_t RFSWITCH_MAX_PINS = 5;

Is it Ok ?

@jgromes
Copy link
Owner Author

jgromes commented Jan 25, 2026

@lyusupov this is intentional, I considered increasing the maximum number of allowed RF switch pins to 7, but to be honest, I don't think there is a realistic use case for it. The LR2021 supports only 5 switch modes, so even if you used single pin for each, you would still have two unused DIO pins. Changing the constant would also break backwards compatibility a bit.

@StevenCellist
Copy link
Collaborator

Compiling 1e371b8 for the LR2021, I get:

.pio/libdeps/heltec-v3/RadioLib/src/modules/LR11x0/LR_common.cpp: In member function 'int16_t LRxxxx::writeCommon(uint16_t, uint32_t, const uint32_t*, size_t, bool)':
.pio/libdeps/heltec-v3/RadioLib/src/modules/LR11x0/LR_common.cpp:340:41: error: 'RADIOLIB_LR11X0_SPI_MAX_READ_WRITE_LEN' was not declared in this scope; did you mean 'RADIOLIB_LRXXXX_SPI_MAX_READ_WRITE_LEN'?
  340 |     uint8_t dataBuff[sizeof(uint32_t) + RADIOLIB_LR11X0_SPI_MAX_READ_WRITE_LEN];
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                         RADIOLIB_LRXXXX_SPI_MAX_READ_WRITE_LEN
.pio/libdeps/heltec-v3/RadioLib/src/modules/LR11x0/LR_common.cpp:346:53: error: 'dataBuff' was not declared in this scope; did you mean 'dataBuffPtr'?
  346 |   uint8_t* dataBuffPtr = reinterpret_cast<uint8_t*>(dataBuff);
      |                                                     ^~~~~~~~
      |                                                     dataBuffPtr

@jgromes
Copy link
Owner Author

jgromes commented Jan 25, 2026

@StevenCellist looks I forgot to build it at least once with static-only memory management - oops :)

@StevenCellist
Copy link
Collaborator

Worth adding to CI, I guess?
Currently struggling to get my LR2021 going. It's reading out FW 1.24 properly, but I'm always getting a GPIO post-transfer timeout. Tried both DIO9 and DIO10 but no luck yet.
(Did we get the switch design from LilyGo? Can't find anything yet!)

@lyusupov
Copy link
Contributor

Did we get the switch design from LilyGo? Can't find anything yet!



Did you get V0.1 or V0.2 ?
I can see the switch in the V0.2 design file.

@StevenCellist
Copy link
Collaborator

I have v0.2, but didn't receive no design file!

@lewisxhe
Copy link
Contributor

v0.2? The first shipment of modules was always version 0.1, yours is version 0.2?

Could you take a picture?

@lewisxhe
Copy link
Contributor

@lyusupov Linar, I apologize. I just checked with the hardware engineer, and you should have received version V0.2, not v0.1. Version V0.1 requires cutting the PCB traces.

@StevenCellist The attached document is a schematic diagram.

LR2021 V0.2.pdf

@lyusupov
Copy link
Contributor

lyusupov commented Jan 26, 2026

@lewisxhe
The picture above is not mine.
:-) I actually have not received the module yet - delivery is still in progress.
I am trying to guess - will the module contain MXD8721 HF/LF RF switch as shown in the V0.2 schematics ?

image


@jgromes wrote that there is no RF switch in his module. - #1676 (comment)
@StevenCellist is not certain as well - #1676 (comment)

@lewisxhe
Copy link
Contributor

Okay, I thought you received version v0.1. If I'm not mistaken, you should also have received version v0.2. Version v0.2 also has an RF switch design, but later versions will change to a switch-free design. Because it's almost Chinese New Year and we'll be on holiday soon, we sent you our test samples in advance.

@jgromes
Copy link
Owner Author

jgromes commented Jan 26, 2026

@lyusupov I also have other LR2021 modules without switch (and have been using those just because those from @lewisxhe took slightly longer to get here) - sorry for the confusion. The 0.2 version from @lewisxhe I have does seem to have a switch, so I was wrong before and can actually test it.

@lyusupov
Copy link
Contributor

lyusupov commented Jan 27, 2026

@jgromes
You've implemented all the features from this list #1457 (comment) except setRxBoostedGainMode()




Your current implementation of SetRxPath() uses two pre-defined constants for the LF/HF Rx gain boost values only ( RADIOLIB_LR2021_RX_BOOST_HF and RADIOLIB_LR2021_RX_BOOST_LF. )

Do you have plans to extend the implementation with support of all the Rx gain boost values possible ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Support for Semtech LR2021

5 participants