Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gnrc/lorawan: support for single channel gateways #13590

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

gschorcht
Copy link
Contributor

Contribution description

This PR allows the use of gnrc/lorawan with single channel gateways.

There are a number of cheap single/dual channel gateways on the market, for example the Dragino LG02. Although they are not recommended for LoRaWAN use, they are inexpensive tools for playing with and testing RIOT's LoRa functions. However, the use of different channels for the join procedure and the send function avoids the use of such a single-channel gateway.

Therefore, this PR introduces a compile time variable GNRC_LORAWAN_SINGLE_CHANNEL, which can be used to define a single frequency. When this variable is defined, only this frequency is set in gnrc_lorawan_default_channels during initialization and the channel configuration in gnrc_lorawan_process_cflist after joining is disabled.

Testing procedure

Set ENABLE_DEBUG to 1 in drivers/sx127x/sx172x_getset.c and flash examples/gnrc_lorawan for any LoRa-Board with

CFLAGS='-DGNRC_LORAWAN_SINGLE_CHANNEL=868100000UL ...' make BOARD=... -C examples/gnrc_lorawan flash

Use command ifconfig 4 up to join and send 4 RIOT afterwards. All sx172x_set_channel calls should show the configured frequency.

[sx127x] Set channel: 868100000

Issues/PRs references

@gschorcht gschorcht requested review from jia200x and removed request for haukepetersen, miri64, cgundogan and PeterKietzmann March 8, 2020 14:24
@gschorcht gschorcht added Area: LoRa Area: LoRa radio support CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation labels Mar 8, 2020
@@ -96,6 +96,10 @@ uint32_t gnrc_lorawan_pick_channel(gnrc_lorawan_t *mac)

void gnrc_lorawan_process_cflist(gnrc_lorawan_t *mac, uint8_t *cflist)
{
#ifdef GNRC_LORAWAN_SINGLE_CHANNEL
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have you checked if the Join Procedure sends the channel list?
If so, there's no need add this guard.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, tested with TTN. The Join_Accecpt contains the optional channel list.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah true, it's the same network server :)

Comment on lines 99 to 102
#ifdef GNRC_LORAWAN_SINGLE_CHANNEL
(void)mac;
(void)cflist;
#else
Copy link
Member

@jia200x jia200x Mar 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#ifdef GNRC_LORAWAN_SINGLE_CHANNEL
(void)mac;
(void)cflist;
#else
if(!IS_USED(GNRC_LORAWAN_SINGLE_CHANNEL)) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this can be done. As I understand, @gschorcht proposes that GNRC_LORAWAN_SINGLE_CHANNEL holds the single frequency value, so it would not be a boolean switch.

Copy link
Contributor Author

@gschorcht gschorcht Apr 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, GNRC_LORAWAN_SINGLE_CHANNEL defines a value. IS_USED and IS_ACTIVE test for a macro that is 1, 0 or not defined. So they are not applicable here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, misread and though it was a boolean

@jia200x
Copy link
Member

jia200x commented Mar 9, 2020

please squash

@gschorcht gschorcht force-pushed the gnrc/lorawan/single_channel_gateway branch from 6e858d5 to 3f54b94 Compare March 9, 2020 15:02
@gschorcht
Copy link
Contributor Author

Squashed

@benpicco benpicco added this to the Release 2020.04 milestone Mar 29, 2020
@benpicco benpicco requested a review from aabadie March 29, 2020 15:38
@leandrolanzieri leandrolanzieri requested a review from jia200x April 7, 2020 07:12
@@ -29,11 +29,16 @@ extern "C" {
* @brief Default LoRaWAN channels for current region (EU868)
*/
static const uint32_t gnrc_lorawan_default_channels[] = {
#ifdef GNRC_LORAWAN_SINGLE_CHANNEL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation on this option should be added.

@miri64
Copy link
Member

miri64 commented Jun 25, 2020

@gschorcht @leandrolanzieri any progress?

@gschorcht
Copy link
Contributor Author

@miri64 Thanks for going through all these PR and pushing them a bit 👍

As I see it, only the option needs to be documented. I will try to do it in next days.

@stale
Copy link

stale bot commented Jan 14, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

@stale stale bot added the State: stale State: The issue / PR has no activity for >185 days label Jan 14, 2021
@gschorcht gschorcht added State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet and removed State: stale State: The issue / PR has no activity for >185 days labels Jan 14, 2021
@MrKevinWeiss MrKevinWeiss removed this from the Release 2021.07 milestone Jul 15, 2021
@gschorcht gschorcht force-pushed the gnrc/lorawan/single_channel_gateway branch from 3f54b94 to 5d48995 Compare October 26, 2021 22:24
@github-actions github-actions bot added Area: network Area: Networking Area: sys Area: System labels Oct 26, 2021
@stale
Copy link

stale bot commented Apr 30, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

@stale stale bot added the State: stale State: The issue / PR has no activity for >185 days label Apr 30, 2022
@gschorcht gschorcht added State: don't stale State: Tell state-bot to ignore this issue and removed State: stale State: The issue / PR has no activity for >185 days labels Apr 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: LoRa Area: LoRa radio support Area: network Area: Networking Area: sys Area: System CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR State: don't stale State: Tell state-bot to ignore this issue State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants