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

pkg/semtech-loramac: add support for sx126x/llcc68 radios #16238

Merged
merged 3 commits into from
Mar 31, 2021

Conversation

aabadie
Copy link
Contributor

@aabadie aabadie commented Mar 27, 2021

Contribution description

This PR adds the missing logic to be able to use the semtech-loramac package with sx126x and llcc68 radios.

Testing procedure

One can test this PR out-of-the-box using an sx1261/sx1262/llcc68 mbed shield and a nucleo 64 board (I tested with nucleo-l476rg and nucleo-g431rb): just flash the tests/pkg_semtech-loramac application and verify that OTAA join procedures are successful and data can be sent to a LoRaWAN backend:

some basic tests with TTN
$ LORA_DRIVER=sx1261 make BOARD=nucleo-g431rb -C tests/pkg_semtech-loramac/ flash term
make: Entering directory '/work/riot/RIOT/tests/pkg_semtech-loramac'
Building application "tests_pkg_semtech-loramac" for "nucleo-g431rb" with MCU "stm32".

[INFO] updating driver_sx126x /work/riot/RIOT/build/pkg/driver_sx126x/.pkg-state.git-downloaded
echo ba61312213450ae94a4293d75285c1d8f30c04b3 > /work/riot/RIOT/build/pkg/driver_sx126x/.pkg-state.git-downloaded
[INFO] patch driver_sx126x
"make" -C /work/riot/RIOT/pkg/driver_sx126x
"make" -C /work/riot/RIOT/build/pkg/driver_sx126x/src -f /work/riot/RIOT/pkg/driver_sx126x/driver_sx126x.mk
"make" -C /work/riot/RIOT/pkg/semtech-loramac
"make" -C /work/riot/RIOT/build/pkg/semtech-loramac/src/boards/mcu -f /work/riot/RIOT/pkg/semtech-loramac/Makefile.loramac_arch
"make" -C /work/riot/RIOT/build/pkg/semtech-loramac/src/system/crypto -f /work/riot/RIOT/pkg/semtech-loramac/Makefile.loramac_crypto
"make" -C /work/riot/RIOT/build/pkg/semtech-loramac/src/mac -f /work/riot/RIOT/pkg/semtech-loramac/Makefile.loramac_mac
"make" -C /work/riot/RIOT/build/pkg/semtech-loramac/src/mac/region -f /work/riot/RIOT/pkg/semtech-loramac/Makefile.loramac_region
"make" -C /work/riot/RIOT/boards/nucleo-g431rb
"make" -C /work/riot/RIOT/boards/common/nucleo
"make" -C /work/riot/RIOT/core
"make" -C /work/riot/RIOT/cpu/stm32
"make" -C /work/riot/RIOT/cpu/cortexm_common
"make" -C /work/riot/RIOT/cpu/cortexm_common/periph
"make" -C /work/riot/RIOT/cpu/stm32/periph
"make" -C /work/riot/RIOT/cpu/stm32/stmclk
"make" -C /work/riot/RIOT/cpu/stm32/vectors
"make" -C /work/riot/RIOT/drivers
"make" -C /work/riot/RIOT/drivers/periph_common
"make" -C /work/riot/RIOT/drivers/sx126x
"make" -C /work/riot/RIOT/pkg/driver_sx126x/contrib
"make" -C /work/riot/RIOT/pkg/semtech-loramac/contrib
"make" -C /work/riot/RIOT/sys
"make" -C /work/riot/RIOT/sys/auto_init
"make" -C /work/riot/RIOT/sys/auto_init/loramac
"make" -C /work/riot/RIOT/sys/fmt
"make" -C /work/riot/RIOT/sys/frac
"make" -C /work/riot/RIOT/sys/iolist
"make" -C /work/riot/RIOT/sys/isrpipe
"make" -C /work/riot/RIOT/sys/luid
"make" -C /work/riot/RIOT/sys/malloc_thread_safe
"make" -C /work/riot/RIOT/sys/newlib_syscalls_default
"make" -C /work/riot/RIOT/sys/pm_layered
"make" -C /work/riot/RIOT/sys/random
"make" -C /work/riot/RIOT/sys/random/tinymt32
"make" -C /work/riot/RIOT/sys/shell
"make" -C /work/riot/RIOT/sys/shell/commands
"make" -C /work/riot/RIOT/sys/stdio_uart
"make" -C /work/riot/RIOT/sys/test_utils/interactive_sync
"make" -C /work/riot/RIOT/sys/tsrb
"make" -C /work/riot/RIOT/sys/ztimer
   text	   data	    bss	    dec	    hex	filename
  51460	    292	   7268	  59020	   e68c	/work/riot/RIOT/tests/pkg_semtech-loramac/bin/nucleo-g431rb/tests_pkg_semtech-loramac.elf
For full programmer output add PROGRAMMER_QUIET=0 or QUIET=0 to the make command line.
 ✓ Flashing done! (programmer: 'openocd' - duration: 3.01s)
/work/riot/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "115200"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2021-03-27 16:44:05,345 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
loramac set deveui 00AB22849FF4885C
2021-03-27 16:44:15,503 # loramac set deveui 00AB22849FF4885C
loramac set appeui 70B3D57ED000B02F
2021-03-27 16:44:17,990 # loramac set appeui 70B3D57ED000B02F
loramac set appkey 45C8E67A4FD8871D6943CEE3A305177C
2021-03-27 16:44:21,000 # loramac set appkey 45C8E67A4FD8871D6943CEE3A305177C
> loramac set dr 5
2021-03-27 16:44:25,845 # loramac set dr 5
> loramac join otaa
2021-03-27 16:44:28,667 # loramac join otaa
2021-03-27 16:44:33,809 # Join procedure succeeded!
> loramac tx "This is RIOT!"
2021-03-27 16:45:23,853 # loramac tx "This is RIOT!"
2021-03-27 16:45:24,963 # Received ACK from network
2021-03-27 16:45:24,965 # Message sent with success
> loramac tx "This is RIOT!"
2021-03-27 16:45:46,246 # loramac tx "This is RIOT!"
2021-03-27 16:45:52,366 # Data received: ABCD, port: 42
2021-03-27 16:45:52,368 # Received ACK from network
2021-03-27 16:45:52,370 # Message sent with success
> 

Issues/PRs references

This is based on #16177

@aabadie aabadie added Type: new feature The issue requests / The PR implemements a new feature for RIOT Area: LoRa Area: LoRa radio support labels Mar 27, 2021
@aabadie aabadie added the State: waiting for other PR State: The PR requires another PR to be merged first label Mar 27, 2021
@aabadie aabadie force-pushed the semtech-loramac_sx126x branch 2 times, most recently from 5144e38 to 2e4eb65 Compare March 30, 2021 12:00
@fjmolinas
Copy link
Contributor

I was able to join a network but It then got stuck when sending a message:

2021-03-30 15:39:23,137 # loramac join otaa
2021-03-30 15:39:28,278 # Join procedure succeeded!
> help
2021-03-30 15:39:45,451 # help
2021-03-30 15:39:45,453 # Command              Description
2021-03-30 15:39:45,457 # ---------------------------------------
2021-03-30 15:39:45,460 # reboot               Reboot the node
2021-03-30 15:39:45,465 # version              Prints current RIOT_VERSION
2021-03-30 15:39:45,469 # pm                   interact with layered PM subsystem
2021-03-30 15:39:45,473 # random_init          initializes the PRNG
2021-03-30 15:39:45,478 # random_get           returns 32 bit of pseudo randomness
2021-03-30 15:39:45,483 # loramac              Control Semtech loramac stack
> loramac send
2021-03-30 15:39:48,943 # loramac send
2021-03-30 15:39:48,948 # Usage: loramac <get|set|join|tx|link_check>
> loramac tx AAAA
2021-03-30 15:39:55,482 # loramac tx AAAA
help

@fjmolinas
Copy link
Contributor

I was able to join a network but It then got stuck when sending a message:

2021-03-30 15:39:23,137 # loramac join otaa
2021-03-30 15:39:28,278 # Join procedure succeeded!
> help
2021-03-30 15:39:45,451 # help
2021-03-30 15:39:45,453 # Command              Description
2021-03-30 15:39:45,457 # ---------------------------------------
2021-03-30 15:39:45,460 # reboot               Reboot the node
2021-03-30 15:39:45,465 # version              Prints current RIOT_VERSION
2021-03-30 15:39:45,469 # pm                   interact with layered PM subsystem
2021-03-30 15:39:45,473 # random_init          initializes the PRNG
2021-03-30 15:39:45,478 # random_get           returns 32 bit of pseudo randomness
2021-03-30 15:39:45,483 # loramac              Control Semtech loramac stack
> loramac send
2021-03-30 15:39:48,943 # loramac send
2021-03-30 15:39:48,948 # Usage: loramac <get|set|join|tx|link_check>
> loramac tx AAAA
2021-03-30 15:39:55,482 # loramac tx AAAA
help

Ah seems it was just because of missing quoutes:

2021-03-30 15:42:18,440 # main(): This is RIOT! (Version: 2021.04-devel-1185-g2e4eb-pr-16238)
2021-03-30 15:42:18,443 # All up, running the shell now
: loramac set appeui 70B3D57ED00204EC
2021-03-30 15:42:20,700 # loramac set appeui 70B3D57ED00204EC
: loramac set appkey 0A3E1510AEB8DB583B10DCA691522409
2021-03-30 15:42:22,531 # loramac set appkey 0A3E1510AEB8DB583B10DCA691522409
: loramac set deveui 00D23F63A8D87783
2021-03-30 15:42:24,474 # loramac set deveui 00D23F63A8D87783
: loramac set dr 5
2021-03-30 15:42:26,552 # loramac set dr 5
: loramac join otaa
2021-03-30 15:42:28,392 # loramac join otaa
2021-03-30 15:42:33,534 # Join procedure succeeded!
> loramac tx "This is RIOT!"
2021-03-30 15:42:42,828 # loramac tx "This is RIOT!"
2021-03-30 15:42:56,841 # Fail to send: no ACK received
> hlep
2021-03-30 15:43:05,555 # hlep
2021-03-30 15:43:05,558 # shell: command not found: hlep
> help
2021-03-30 15:43:07,323 # help
2021-03-30 15:43:07,326 # Command              Description
2021-03-30 15:43:07,329 # ---------------------------------------
2021-03-30 15:43:07,332 # reboot               Reboot the node
2021-03-30 15:43:07,337 # version              Prints current RIOT_VERSION
2021-03-30 15:43:07,342 # pm                   interact with layered PM subsystem
2021-03-30 15:43:07,345 # random_init          initializes the PRNG
2021-03-30 15:43:07,350 # random_get           returns 32 bit of pseudo randomness
2021-03-30 15:43:07,355 # loramac              Control Semtech loramac stack
> loramac tx "This is RIOT!"
2021-03-30 15:43:15,835 # loramac tx "This is RIOT!"
2021-03-30 15:43:16,945 # Received ACK from network
2021-03-30 15:43:16,947 # Message sent with success
> loramac tx "This is RIOT!"
2021-03-30 15:43:47,352 # loramac tx "This is RIOT!"
2021-03-30 15:43:57,562 # Data received: ��, port: 1
2021-03-30 15:43:57,564 # Received ACK from network
2021-03-30 15:43:57,566 # Message sent with success

@fjmolinas fjmolinas added the Reviewed: 3-testing The PR was tested according to the maintainer guidelines label Mar 30, 2021
@aabadie aabadie force-pushed the semtech-loramac_sx126x branch from 2e4eb65 to 06a3d8f Compare March 30, 2021 13:52
@aabadie aabadie force-pushed the semtech-loramac_sx126x branch from 06a3d8f to efdaf92 Compare March 30, 2021 17:03
@fjmolinas fjmolinas added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed State: waiting for other PR State: The PR requires another PR to be merged first labels Mar 30, 2021
Copy link
Contributor

@fjmolinas fjmolinas left a comment

Choose a reason for hiding this comment

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

ACK and GO!

@fjmolinas fjmolinas merged commit c082b42 into RIOT-OS:master Mar 31, 2021
@aabadie aabadie deleted the semtech-loramac_sx126x branch March 31, 2021 08:35
@kaspar030 kaspar030 added this to the Release 2021.04 milestone Apr 23, 2021
@kaspar030 kaspar030 added the Release notes: added Set on PRs that have been processed into the release notes for the current release. label Apr 28, 2021
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 CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Release notes: added Set on PRs that have been processed into the release notes for the current release. Reviewed: 3-testing The PR was tested according to the maintainer guidelines Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants