Skip to content

drivers/rn2xx3: migrate to ztimer#17112

Merged
aabadie merged 1 commit intoRIOT-OS:masterfrom
aabadie:pr/drivers/rn2xx3_ztimer
Nov 4, 2021
Merged

drivers/rn2xx3: migrate to ztimer#17112
aabadie merged 1 commit intoRIOT-OS:masterfrom
aabadie:pr/drivers/rn2xx3_ztimer

Conversation

@aabadie
Copy link
Copy Markdown
Contributor

@aabadie aabadie commented Nov 2, 2021

Contribution description

This PR migrates the rn2xx3 lora driver to ztimer. Like in #17105 there are use of ticks conversion not directly available in ztimer.

Testing procedure

  • Green Murdock
  • Driver is still functional (I might be able to test this by the end of this week and will report there)

Issues/PRs references

#17111

@github-actions github-actions bot added Area: drivers Area: Device drivers Area: Kconfig Area: Kconfig integration labels Nov 2, 2021
@aabadie aabadie force-pushed the pr/drivers/rn2xx3_ztimer branch from ca3fabd to 5eca441 Compare November 3, 2021 09:12
@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Nov 4, 2021

I'm testing this PR on sodaq-explorer and it doesn't work, investigating.

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Nov 4, 2021

Found the issue: there was a missing include of board.h in the params header => the reset pin configured for the sodaq-explorer wasn't taken into account and thus the reset was not performed correctly during driver initialization.

Now it works:
$ BUILD_IN_DOCKER=1 make BOARD=sodaq-explorer -C tests/driver_rn2xx3 flash term --no-print-directory 
Launching build container using image "riot/riotbuild:latest".
docker run --rm --tty --user $(id -u) -v '/usr/share/zoneinfo/Europe/Paris:/etc/localtime:ro' -v '/work/riot/RIOT:/data/riotbuild/riotbase:delegated' -e 'RIOTBASE=/data/riotbuild/riotbase' -e 'CCACHE_BASEDIR=/data/riotbuild/riotbase' -e 'BUILD_DIR=/data/riotbuild/riotbase/build' -e 'RIOTPROJECT=/data/riotbuild/riotbase' -e 'RIOTCPU=/data/riotbuild/riotbase/cpu' -e 'RIOTBOARD=/data/riotbuild/riotbase/boards' -e 'RIOTMAKE=/data/riotbuild/riotbase/makefiles'      -e 'BOARD=sodaq-explorer'  -w '/data/riotbuild/riotbase/tests/driver_rn2xx3/' 'riot/riotbuild:latest' make 'BOARD=sodaq-explorer'    
Building application "tests_driver_rn2xx3" for "sodaq-explorer" with MCU "samd21".

"make" -C /data/riotbuild/riotbase/boards/sodaq-explorer
"make" -C /data/riotbuild/riotbase/boards/common/sodaq
"make" -C /data/riotbuild/riotbase/boards/common/samdx1-arduino-bootloader
"make" -C /data/riotbuild/riotbase/core
"make" -C /data/riotbuild/riotbase/cpu/samd21
"make" -C /data/riotbuild/riotbase/cpu/cortexm_common
"make" -C /data/riotbuild/riotbase/cpu/cortexm_common/periph
"make" -C /data/riotbuild/riotbase/cpu/sam0_common
"make" -C /data/riotbuild/riotbase/cpu/sam0_common/periph
"make" -C /data/riotbuild/riotbase/cpu/samd21/periph
"make" -C /data/riotbuild/riotbase/cpu/samd21/vectors
"make" -C /data/riotbuild/riotbase/drivers
"make" -C /data/riotbuild/riotbase/drivers/periph_common
"make" -C /data/riotbuild/riotbase/drivers/rn2xx3
"make" -C /data/riotbuild/riotbase/sys
"make" -C /data/riotbuild/riotbase/sys/auto_init
"make" -C /data/riotbuild/riotbase/sys/auto_init/usb
"make" -C /data/riotbuild/riotbase/sys/event
"make" -C /data/riotbuild/riotbase/sys/fmt
"make" -C /data/riotbuild/riotbase/sys/frac
"make" -C /data/riotbuild/riotbase/sys/isrpipe
"make" -C /data/riotbuild/riotbase/sys/luid
"make" -C /data/riotbuild/riotbase/sys/malloc_thread_safe
"make" -C /data/riotbuild/riotbase/sys/newlib_syscalls_default
"make" -C /data/riotbuild/riotbase/sys/pm_layered
"make" -C /data/riotbuild/riotbase/sys/shell
"make" -C /data/riotbuild/riotbase/sys/shell/commands
"make" -C /data/riotbuild/riotbase/sys/tsrb
"make" -C /data/riotbuild/riotbase/sys/usb/usbus
"make" -C /data/riotbuild/riotbase/sys/usb/usbus/cdc/acm
"make" -C /data/riotbuild/riotbase/sys/usb_board_reset
"make" -C /data/riotbuild/riotbase/sys/ztimer
   text	   data	    bss	    dec	    hex	filename
  31028	    132	   6240	  37400	   9218	/data/riotbuild/riotbase/tests/driver_rn2xx3/bin/sodaq-explorer/tests_driver_rn2xx3.elf
stty -F /dev/ttyACM0 raw ispeed 1200 ospeed 1200 cs8 -cstopb ignpar eol 255 eof 255
sleep 2
/work/riot/RIOT/dist/tools/bossa-1.9/bossac -p /dev/ttyACM0 -o 0x2000 -e -i -w -v -b -R /work/riot/RIOT/tests/driver_rn2xx3/bin/sodaq-explorer/tests_driver_rn2xx3.bin
Device       : ATSAMD21x18
Version      : v2.0 [Arduino:XYZ] Dec 29 2016 21:19:27
Address      : 0x0
Pages        : 4096
Page Size    : 64 bytes
Total Size   : 256KB
Planes       : 1
Lock Regions : 16
Locked       : none
Security     : false
BOD          : true
BOR          : true
Erase flash

Done in 0.858 seconds
Write 31160 bytes to flash (487 pages)
[==============================] 100% (487/487 pages)
Done in 0.185 seconds
Verify 31160 bytes of flash
[==============================] 100% (487/487 pages)
Verify successful
Done in 0.305 seconds
Set boot flash true
sleep 2
/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-11-04 10:43:12,727 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2021-11-04 10:43:13,731 # (Version: 2022.01-devel-342-g295092-pr/drivers/rn2xx3_ztimer)
2021-11-04 10:43:13,732 # RN2XX3 device driver test
2021-11-04 10:43:13,732 # Initialization OK, starting shell now
> help
2021-11-04 10:43:15,598 # help
2021-11-04 10:43:15,599 # Command              Description
2021-11-04 10:43:15,599 # ---------------------------------------
2021-11-04 10:43:15,600 # sys                  Run RN2XX3 system commands
2021-11-04 10:43:15,600 # mac                  Run RN2XX3 LoRa mac layer commands
2021-11-04 10:43:15,601 # reboot               Reboot the node
2021-11-04 10:43:15,601 # version              Prints current RIOT_VERSION
2021-11-04 10:43:15,601 # bootloader           Reboot to bootloader
2021-11-04 10:43:15,602 # pm                   interact with layered PM subsystem
> sys sleep
2021-11-04 10:43:18,016 # sys sleep
2021-11-04 10:43:18,024 # Success: device is in sleep mode during 5s
> sys sleep
2021-11-04 10:43:19,056 # sys sleep
2021-11-04 10:43:19,057 # Cannot put device in sleep mode
> sys sleep
2021-11-04 10:43:23,072 # sys sleep
2021-11-04 10:43:23,074 # Cannot put device in sleep mode
> sys sleep
2021-11-04 10:43:27,047 # sys sleep
2021-11-04 10:43:27,054 # Success: device is in sleep mode during 5s
> mac set appeui 0000000000000000
> 2021-11-04 10:43:53,006 # mac set appeui 0000000000000000
2021-11-04 10:43:53,008 # shell: command not found: >
mac set appeui 0000000000000000
2021-11-04 10:44:01,357 # mac set appeui 0000000000000000
> mac set deveui 70B3D57ED0045672
2021-11-04 10:44:08,551 # mac set deveui 70B3D57ED0045672
> mac set appkey 6C7144C0E20B5F418CCB6ECE40BD2A65
2021-11-04 10:44:16,105 # mac set appkey 6C7144C0E20B5F418CCB6ECE40BD2A65
> mac set dr 5
2021-11-04 10:44:19,567 # mac set dr 5
> mac join otaa
2021-11-04 10:44:22,774 # mac join otaa
2021-11-04 10:44:27,983 # Join procedure succeeded
> mac tx test
2021-11-04 10:45:15,810 # mac tx test
2021-11-04 10:45:20,982 # MAC transmission succeeded
2021-11-04 10:45:20,983 # Data received:
2021-11-04 10:45:20,984 #  -port: 42
2021-11-04 10:45:20,985 #  -payload len: 5
2021-11-04 10:45:20,986 #  -payload: 'ABCDE'
> 2021-11-04 10:45:24,066 # Exiting Pyterm

@aabadie aabadie added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Nov 4, 2021
@fjmolinas
Copy link
Copy Markdown
Contributor

Found the issue: there was a missing include of board.h in the params header => the reset pin configured for the sodaq-explorer wasn't taken into account and thus the reset was not performed correctly during driver initialization.

Can you add a follow-up for this? Or here?

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Nov 4, 2021

Can you add a follow-up for this? Or here?

It is part of this PR already.

@aabadie aabadie force-pushed the pr/drivers/rn2xx3_ztimer branch from 5eca441 to 295092b Compare November 4, 2021 14:30
@fjmolinas
Copy link
Copy Markdown
Contributor

Can you add a follow-up for this? Or here?

It is part of this PR already.

Did you forget to push? There is no board.h change in this PR?

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Nov 4, 2021

Hmm, forgot to push...

Copy link
Copy Markdown
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, test output is provided.

@aabadie aabadie merged commit 7ce5d8a into RIOT-OS:master Nov 4, 2021
@aabadie aabadie deleted the pr/drivers/rn2xx3_ztimer branch November 4, 2021 23:38
@fjmolinas fjmolinas added this to the Release 2022.01 milestone Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: drivers Area: Device drivers Area: Kconfig Area: Kconfig integration CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants