Skip to content

drivers/ata8520e: migrate to ztimer#17105

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

drivers/ata8520e: migrate to ztimer#17105
aabadie merged 1 commit intoRIOT-OS:masterfrom
aabadie:pr/drivers/ata8520e_ztimer

Conversation

@aabadie
Copy link
Copy Markdown
Contributor

@aabadie aabadie commented Nov 2, 2021

Contribution description

This PR migrates the ata8520e driver (for SigFox) to ztimer. It's still untested, and I don't know how to test it TBH since my SigFox test account has expired for quite some time now.

The migration is not straight forward since there's some timer based logic to wait for an event from the driver. I tried to adapt it but it seems to me that there are no ztimer equivalent to all xtimer functions used there.

Testing procedure

  • A green Murdock
  • The driver is still functional

Issues/PRs references

#17111

@fjmolinas
Copy link
Copy Markdown
Contributor

@aabadie do you by any chance have one of these BOARD's?

@aabadie aabadie force-pushed the pr/drivers/ata8520e_ztimer branch from 6c02420 to d748869 Compare November 3, 2021 09:09
@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Nov 5, 2021

do you by any chance have one of these boards?

Yes there's one at AT but I can't test communication with the sigfox backend: my test account has expired and the antenna is broken...
I just did some testing though and we can safely assume that event timer is working.

some output with debug enabled:
$ CFLAGS+=-DTHREAD_STACKSIZE_IDLE=THREAD_STACKSIZE_DEFAULT BOARD=arduino-mkrfox1200 make -C tests/driver_ata8520e flash term
make: Entering directory '/work/riot/RIOT/tests/driver_ata8520e'
Building application "tests_driver_ata8520e" for "arduino-mkrfox1200" with MCU "samd21".

"make" -C /work/riot/RIOT/boards/arduino-mkrfox1200
"make" -C /work/riot/RIOT/boards/common/arduino-mkr
"make" -C /work/riot/RIOT/boards/common/samdx1-arduino-bootloader
"make" -C /work/riot/RIOT/core
"make" -C /work/riot/RIOT/cpu/samd21
"make" -C /work/riot/RIOT/cpu/cortexm_common
"make" -C /work/riot/RIOT/cpu/cortexm_common/periph
"make" -C /work/riot/RIOT/cpu/sam0_common
"make" -C /work/riot/RIOT/cpu/sam0_common/periph
"make" -C /work/riot/RIOT/cpu/samd21/periph
"make" -C /work/riot/RIOT/cpu/samd21/vectors
"make" -C /work/riot/RIOT/drivers
"make" -C /work/riot/RIOT/drivers/ata8520e
"make" -C /work/riot/RIOT/drivers/periph_common
"make" -C /work/riot/RIOT/sys
"make" -C /work/riot/RIOT/sys/auto_init
"make" -C /work/riot/RIOT/sys/auto_init/usb
"make" -C /work/riot/RIOT/sys/event
"make" -C /work/riot/RIOT/sys/fmt
"make" -C /work/riot/RIOT/sys/frac
"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/shell
"make" -C /work/riot/RIOT/sys/shell/commands
"make" -C /work/riot/RIOT/sys/tsrb
"make" -C /work/riot/RIOT/sys/usb/usbus
"make" -C /work/riot/RIOT/sys/usb/usbus/cdc/acm
"make" -C /work/riot/RIOT/sys/usb_board_reset
"make" -C /work/riot/RIOT/sys/ztimer
   text	   data	    bss	    dec	    hex	filename
  28780	    132	   5940	  34852	   8824	/work/riot/RIOT/tests/driver_ata8520e/bin/arduino-mkrfox1200/tests_driver_ata8520e.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_ata8520e/bin/arduino-mkrfox1200/tests_driver_ata8520e.bin
Device       : ATSAMD21x18
Version      : v2.0 [Arduino:XYZ] Mar 10 2017 12:20:17
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.843 seconds
Write 28912 bytes to flash (452 pages)
[==============================] 100% (452/452 pages)
Done in 0.167 seconds
Verify 28912 bytes of flash
[==============================] 100% (452/452 pages)
Verify successful
Done in 0.294 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-05 09:45:00,718 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2021-11-05 09:45:01,720 # igfox status: 0
2021-11-05 09:45:01,720 # [ata8520e] Sigfox: OK
2021-11-05 09:45:01,721 # [ata8520e] Sigfox status: 0
2021-11-05 09:45:01,721 # [ata8520e] Sigfox: OK
2021-11-05 09:45:01,722 # Initialization OK, starting shell now
> sigfox tx toto
2021-11-05 09:45:09,640 # sigfox tx oto
2021-11-05 09:45:09,641 # [ata8520e] Sending frame 'toto', length: 4
2021-11-05 09:45:09,691 # [ata8520e] Atmel status: 64
2021-11-05 09:45:09,692 # [ata8520e] Atmel: PA OFF
2021-11-05 09:45:09,694 # [ata8520e] Atmel: System ready to operate
2021-11-05 09:45:09,696 # [ata8520e] Sigfox status: 0
2021-11-05 09:45:09,696 # [ata8520e] Sigfox: OK
2021-11-05 09:45:09,697 # [ata8520e] Sigfox status: 0
2021-11-05 09:45:09,697 # [ata8520e] Sigfox: OK
2021-11-05 09:45:09,697 # [ata8520e] Writing send frame to RX buffer
2021-11-05 09:45:09,717 # [ata8520e] waiting for TX to complete (timeout: 8)
2021-11-05 09:45:09,728 # [ata8520e] event timeout
2021-11-05 09:45:09,730 # [ata8520e] failed to send message
2021-11-05 09:45:09,746 # [ata8520e] Atmel status: 0
2021-11-05 09:45:09,748 # [ata8520e] Atmel: PA OFF
2021-11-05 09:45:09,749 # [ata8520e] Atmel: System is ready
2021-11-05 09:45:09,750 # [ata8520e] Sigfox status: 0
2021-11-05 09:45:09,751 # [ata8520e] Sigfox: OK
2021-11-05 09:45:09,753 # [ata8520e] Sigfox status: 0
2021-11-05 09:45:09,753 # [ata8520e] Sigfox: OK
2021-11-05 09:45:09,765 # [ata8520e] Atmel status: 0
2021-11-05 09:45:09,766 # [ata8520e] Atmel: PA OFF
2021-11-05 09:45:09,767 # [ata8520e] Atmel: System is ready
2021-11-05 09:45:09,768 # [ata8520e] Sigfox status: 0
2021-11-05 09:45:09,769 # [ata8520e] Sigfox: OK
2021-11-05 09:45:09,771 # [ata8520e] Sigfox status: 0
2021-11-05 09:45:09,772 # [ata8520e] Sigfox: OK
2021-11-05 09:45:09,773 # Message not sent

We can see that the timeout is triggered correctly when sending (which is expected). Anyway, I can't do more testing unfortunately.

@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 5, 2021
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, LGTM, and best effort test results are provided.

@maribu
Copy link
Copy Markdown
Member

maribu commented Nov 5, 2021

There is a leftover #include "xtimer.h" in drivers/include/ata8520e.h that causes build failures for the waspmote-pro

@aabadie aabadie force-pushed the pr/drivers/ata8520e_ztimer branch from d748869 to baa1ed3 Compare November 5, 2021 11:49
@aabadie aabadie merged commit 2634618 into RIOT-OS:master Nov 5, 2021
@aabadie aabadie deleted the pr/drivers/ata8520e_ztimer branch November 5, 2021 15:23
@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.

3 participants