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

periph/spi: add support for printing and testing SPI clock rate (2nd) #18374

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

Conversation

MrKevinWeiss
Copy link
Contributor

Contribution description

Taken over from another PR. We will see how much it needs.

Testing procedure

TBD

Issues/PRs references

Based off #16727 from @hugueslarrive

@github-actions github-actions bot added Area: arduino API Area: Arduino wrapper API Area: boards Area: Board ports Area: CI Area: Continuous Integration of RIOT components Area: cpu Area: CPU/MCU ports Area: doc Area: Documentation Area: drivers Area: Device drivers Area: pkg Area: External package ports Area: sys Area: System Area: tests Area: tests and testing framework Platform: ARM Platform: This PR/issue effects ARM-based platforms Platform: AVR Platform: This PR/issue effects AVR-based platforms Platform: ESP Platform: This PR/issue effects ESP-based platforms Platform: MSP Platform: This PR/issue effects MSP-based platforms labels Jul 26, 2022
@MrKevinWeiss
Copy link
Contributor Author

rebased... I will work on porting some robot tests so we can check it on the hardware. Probably worth some manual testing as well.

@riot-hil-bot
Copy link

HiL Test Results

PASS FAIL SKIP
1 25 2
  ❌ frdm-k22f (1 fail test)
PASS FAIL SKIP
0 1 0
TEST RESULT
tests/periph_spi ❌ test fail
  ❌ nucleo-f091rc (1 fail test)
PASS FAIL SKIP
0 1 0
TEST RESULT
tests/periph_spi ❌ test fail
  ❌ nucleo-f303re (1 fail test)
PASS FAIL SKIP
0 1 0
TEST RESULT
tests/periph_spi ❌ test fail
  ❌ nucleo-g474re (1 fail test)
PASS FAIL SKIP
0 1 0
TEST RESULT
tests/periph_spi ❌ test fail
  ❌ nucleo-f767zi (1 fail test)
PASS FAIL SKIP
0 1 0
TEST RESULT
tests/periph_spi ❌ test fail
  ❌ nucleo-l152re (1 fail test)
PASS FAIL SKIP
0 1 0
TEST RESULT
tests/periph_spi ❌ test fail
  ❌ nucleo-f207zg (1 fail test)
PASS FAIL SKIP
0 1 0
TEST RESULT
tests/periph_spi ❌ test fail
  ❌ arduino-mega2560 (1 fail test)
PASS FAIL SKIP
0 1 0
TEST RESULT
tests/periph_spi ❌ test fail
  ❌ nucleo-l432kc (1 fail test)
PASS FAIL SKIP
0 1 0
TEST RESULT
tests/periph_spi ❌ test fail
  ❌ saml10-xpro (1 fail test)
PASS FAIL SKIP
0 1 0
TEST RESULT
tests/periph_spi ❌ test fail
  ❌ saml11-xpro (1 fail test)
PASS FAIL SKIP
0 1 0
TEST RESULT
tests/periph_spi ❌ test fail
  ❌ samr30-xpro (1 fail test)
PASS FAIL SKIP
0 1 0
TEST RESULT
tests/periph_spi ❌ test fail
  ❌ nrf52dk (1 fail test)
PASS FAIL SKIP
0 1 0
TEST RESULT
tests/periph_spi ❌ test fail
  ❌ remote-revb (1 fail test)
PASS FAIL SKIP
0 1 0
TEST RESULT
tests/periph_spi ❌ test fail
  ❌ nucleo-l073rz (1 fail test)
PASS FAIL SKIP
0 1 0
TEST RESULT
tests/periph_spi ❌ test fail
  ❌ nucleo-f411re (1 fail test)
PASS FAIL SKIP
0 1 0
TEST RESULT
tests/periph_spi ❌ test fail
  ❌ nucleo-f103rb (1 fail test)
PASS FAIL SKIP
0 1 0
TEST RESULT
tests/periph_spi ❌ test fail
  ❌ frdm-kw41z (1 fail test)
PASS FAIL SKIP
0 1 0
TEST RESULT
tests/periph_spi ❌ test fail
  ❌ esp32-wroom-32 (1 fail test)
PASS FAIL SKIP
0 1 0
TEST RESULT
tests/periph_spi ❌ test fail
  ❌ z1 (1 fail test)
PASS FAIL SKIP
0 1 0
TEST RESULT
tests/periph_spi ❌ test fail
  ❌ frdm-k64f (1 fail test)
PASS FAIL SKIP
0 1 0
TEST RESULT
tests/periph_spi ❌ test fail
  ❌ same54-xpro (1 fail test)
PASS FAIL SKIP
0 1 0
TEST RESULT
tests/periph_spi ❌ test fail
  😬 samr21-xpro (1 fail flash)
PASS FAIL SKIP
0 1 0
TEST RESULT
tests/periph_spi 😬 flash fail
  😬 esp8266-esp-12x (1 fail flash)
PASS FAIL SKIP
0 1 0
TEST RESULT
tests/periph_spi 😬 flash fail
  😬 arduino-due (1 fail flash)
PASS FAIL SKIP
0 1 0
TEST RESULT
tests/periph_spi 😬 flash fail
  ✅ samr34-xpro
PASS FAIL SKIP
0 0 1
TEST RESULT
tests/periph_spi 🙈 skip
  ✅ slstk3401a
PASS FAIL SKIP
1 0 0
TEST RESULT
tests/periph_spi ✅ pass
  ✅ slstk3400a
PASS FAIL SKIP
0 0 1
TEST RESULT
tests/periph_spi 🙈 skip

@MrKevinWeiss
Copy link
Contributor Author

oh ya, going to need a bit more love.

hugueslarrive added a commit to hugueslarrive/RIOT that referenced this pull request Jun 29, 2023
hugueslarrive added a commit to hugueslarrive/RIOT that referenced this pull request Jun 30, 2023
tests/periph_spi: printing and testing SPI clock rates

drivers/periph_spi: change API of spi_acquire (from RIOT-OS#15904)

drivers/periph_spi: add the `bus` parameter to spi_get_*()
This was necessary for implementations where multiple
devices can have different clock sources. This broke
the macros SPI_CLK_* that were reverted to an enum.

periph/spi: adapted to the new API
Arbitrary speed support was added to all implementations
where it was missing.

2023-06:
- rebased on current master
- some backports from 2022 RIOT-OS#18374
- 3 new implementations adapted (gd32v, rpx0xx, and esp32)
- minial frequency asserts was replaced by return codes
- useless upper frequency bounding removed from many implementations
- SPI_DIV_UP was replaced by the new DIV_ROUND_UP from macros/math.h
- driver clock configuration caching was removed from implementations
  where it exists because it should be done at application level with
  this new API
- br computation was simplified for stm32 / gd32v as performace
  optimisation is no longer needed at this level and the inaccuracy
  of the fixed point arithmetic was unreliable for frequencies
  requested lower but close to resulting frequencies
hugueslarrive added a commit to hugueslarrive/RIOT that referenced this pull request Jun 30, 2023
tests/periph_spi: printing and testing SPI clock rates

drivers/periph_spi: change API of spi_acquire (from RIOT-OS#15904)

drivers/periph_spi: add the `bus` parameter to spi_get_*()
This was necessary for implementations where multiple
devices can have different clock sources. This broke
the macros SPI_CLK_* that were reverted to an enum.

periph/spi: adapted to the new API
Arbitrary speed support was added to all implementations
where it was missing.

2023-06:
- rebased on current master
- some backports from 2022 RIOT-OS#18374
- 3 new implementations adapted (gd32v, rpx0xx, and esp32)
- minial frequency asserts was replaced by return codes
- useless upper frequency bounding removed from many implementations
- SPI_DIV_UP was replaced by the new DIV_ROUND_UP from macros/math.h
- driver clock configuration caching was removed from implementations
  where it exists because it should be done at application level with
  this new API
- br computation was simplified for stm32 / gd32v as performace
  optimisation is no longer needed at this level and the inaccuracy
  of the fixed point arithmetic was unreliable for frequencies
  requested lower but close to resulting frequencies
hugueslarrive added a commit to hugueslarrive/RIOT that referenced this pull request Jul 2, 2023
tests/periph_spi: printing and testing SPI clock rates

drivers/periph_spi: change API of spi_acquire (from RIOT-OS#15904)

drivers/periph_spi: add the `bus` parameter to spi_get_*()
This was necessary for implementations where multiple
devices can have different clock sources. This broke
the macros SPI_CLK_* that were reverted to an enum.

periph/spi: adapted to the new API
Arbitrary speed support was added to all implementations
where it was missing.

2023-06:
- rebased on current master
- some backports from 2022 RIOT-OS#18374
- 3 new implementations adapted (gd32v, rpx0xx, and esp32)
- minial frequency asserts was replaced by return codes
- useless upper frequency bounding removed from many implementations
- SPI_DIV_UP was replaced by the new DIV_ROUND_UP from macros/math.h
- driver clock configuration caching was removed from implementations
  where it exists because it should be done at application level with
  this new API
- br computation was simplified for stm32 / gd32v as performace
  optimisation is no longer needed at this level and the inaccuracy
  of the fixed point arithmetic was unreliable for frequencies
  requested lower but close to resulting frequencies
bors bot added a commit that referenced this pull request Jul 4, 2023
19747: gnrc/ipv6/nib: reset rs_sent counter also for not-6LN interfaces r=benpicco a=fabian18



19752: cpu/atmega_common: checking features instead of CPU models r=benpicco a=hugueslarrive

### Contribution description
Splitted from:
- #19740

### Testing procedure
Tested on atmega8 with:
- #19755

This one probably need to be tested on others cpu.
### Tests on 1284p:
#### tests/periph/adc
```
tests/periph/adc$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  10712	    304	   1021	  12037	   2f05	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/adc/bin/atmega1284p/tests_adc.elf
avrdude: 11016 bytes of flash written
avrdude: 11016 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:44:54,846 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:44:55,848 # 

2023-06-22 18:44:55,848 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:44:55,848 # 
2023-06-22 18:44:55,849 # RIOT ADC peripheral driver test
2023-06-22 18:44:55,849 # 
2023-06-22 18:44:55,850 # This test will sample all available ADC lines once every 100ms with
2023-06-22 18:44:55,850 # a 10-bit resolution and print the sampled results to STDIO
2023-06-22 18:44:55,850 # 
2023-06-22 18:44:55,850 # 
2023-06-22 18:44:55,851 # Successfully initialized ADC_LINE(0)
2023-06-22 18:44:55,851 # Successfully initialized ADC_LINE(1)
2023-06-22 18:44:55,851 # Successfully initialized ADC_LINE(2)
2023-06-22 18:44:55,852 # Successfully initialized ADC_LINE(3)
2023-06-22 18:44:55,852 # Successfully initialized ADC_LINE(4)
2023-06-22 18:44:55,852 # Successfully initialized ADC_LINE(5)
2023-06-22 18:44:55,853 # Successfully initialized ADC_LINE(6)
2023-06-22 18:44:55,853 # Successfully initialized ADC_LINE(7)
2023-06-22 18:44:55,853 # ADC_LINE(0): 796
2023-06-22 18:44:55,854 # ADC_LINE(1): 599
2023-06-22 18:44:55,854 # ADC_LINE(2): 522
2023-06-22 18:44:55,854 # ADC_LINE(3): 485
2023-06-22 18:44:55,854 # ADC_LINE(4): 466
2023-06-22 18:44:55,854 # ADC_LINE(5): 466
2023-06-22 18:44:55,854 # ADC_LINE(6): 478
2023-06-22 18:44:55,855 # ADC_LINE(7): 501
2023-06-22 18:44:55,855 #  Exiting Pyterm
make: *** [/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/adc/../../../Makefile.include:879: term] Interrompre
```
#### tests/periph/gpio
```
tests/periph/gpio$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  17828	   2112	   1095	  21035	   522b	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/gpio/bin/atmega1284p/tests_gpio.elf
avrdude: 19940 bytes of flash written
avrdude: 19940 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:46:50,726 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:46:51,734 # This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:46:51,734 # GPIO peripheral driver test
2023-06-22 18:46:51,734 # 
2023-06-22 18:46:51,735 # In this test, pins are specified by integer port and pin numbers.
2023-06-22 18:46:51,735 # So if your platform has a pin PA01, it will be port=0 and pin=1,
2023-06-22 18:46:51,736 # PC14 would be port=2 and pin=14 etc.
2023-06-22 18:46:51,736 # 
2023-06-22 18:46:51,736 # NOTE: make sure the values you use exist on your platform! The
2023-06-22 18:46:51,738 #       behavior for not existing ports/pins is not defined!
init_out 1 5
2023-06-22 18:47:50,380 # init_out 1 5
toggle 1 5
2023-06-22 18:48:09,425 # toggle 1 5
> toggle 1 5
2023-06-22 18:48:12,477 # toggle 1 5
> 2023-06-22 18:48:15,013 # Exiting Pyterm
```
#### tests/periph/i2c
```
tests/periph/i2c$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  18634	   1288	   1215	  21137	   5291	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/i2c/bin/atmega1284p/tests_i2c.elf
avrdude: 19922 bytes of flash written
avrdude: 19922 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:50:37,434 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:50:38,437 # 
2023-06-22 18:50:38,438 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:50:38,438 # Start: Test for the low-level I2C driver
> i2c_scan 0
2023-06-22 18:51:37,661 # i2c_scan 0
2023-06-22 18:51:37,687 # Scanning I2C device 0...
2023-06-22 18:51:37,765 # addr not ack'ed = "-", addr ack'ed = "X", addr reserved = "R", error = "E"
2023-06-22 18:51:37,804 #      0 1 2 3 4 5 6 7 8 9 a b c d e f
2023-06-22 18:51:37,842 # 0x00 R R R R R R R R R R R R R R - -
2023-06-22 18:51:37,881 # 0x10 - - - - - - - - - - - - - - - -
2023-06-22 18:51:37,919 # 0x20 - - - - - - - - - - - - - - - -
2023-06-22 18:51:37,958 # 0x30 - - - - - - - - - - - - - - - -
2023-06-22 18:51:37,996 # 0x40 - - - - - - - - - - - - - - - -
2023-06-22 18:51:38,035 # 0x50 - - - - - - - - - - - - - - - -
2023-06-22 18:51:38,073 # 0x60 - - - - - - - - - - - - - - - -
2023-06-22 18:51:38,112 # 0x70 - - - - - - - - R R R R R R R R
> 2023-06-22 18:52:54,462 # Exiting Pyterm
```
#### tests/periph/pwm
```
tests/periph/pwm$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  15382	    896	   1093	  17371	   43db	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/pwm/bin/atmega1284p/tests_pwm.elf
avrdude: 16278 bytes of flash written
avrdude: 16278 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:54:32,308 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:54:33,310 # 
2023-06-22 18:54:33,312 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:54:33,312 # PWM peripheral driver test
2023-06-22 18:54:33,313 # 
> osci
2023-06-22 18:54:39,105 # osci
2023-06-22 18:54:39,106 # 
2023-06-22 18:54:39,121 # RIOT PWM test
2023-06-22 18:54:39,177 # Connect an LED or scope to PWM pins to see something.
2023-06-22 18:54:39,178 # 
2023-06-22 18:54:39,216 # Available PWM device between 0 and 1
2023-06-22 18:54:39,244 # Initialized PWM_0 @ 488Hz.
2023-06-22 18:54:39,273 # Initialized PWM_1 @ 976Hz.
2023-06-22 18:54:39,274 # 
2023-06-22 18:54:39,313 # Letting the PWM pins oscillate now...
2023-06-22 18:54:45,655 # Exiting Pyterm
```
#### tests/periph/spi
```
tests/periph/spi$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  19240	   1402	   2317	  22959	   59af	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/spi/bin/atmega1284p/tests_spi.elf
avrdude: 20642 bytes of flash written
avrdude: 20642 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:58:12,394 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:58:13,396 # 
2023-06-22 18:58:13,398 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:58:13,398 # Manual SPI peripheral driver test (see README.md)
2023-06-22 18:58:13,399 # There are 1 SPI devices configured for your platform.
init 0 0 4
2023-06-22 18:58:32,086 # init 0 0 4
2023-06-22 18:58:32,161 # Trying to initialize SPI_DEV(0): mode: 0, clk: 4, cs_port: 0, cs_pin: 0
2023-06-22 18:58:32,270 # (if below the program crashes with a failed assertion, then it means the configuration is not supported)
2023-06-22 18:58:32,280 # Success.
bench
2023-06-22 18:58:41,590 # bench
2023-06-22 18:58:41,644 # ### Running some benchmarks, all values in [us] ###
2023-06-22 18:58:41,682 # ### Test				Transfer time	user time
2023-06-22 18:58:41,683 # 
2023-06-22 18:58:41,755 #  1 - write 1000 times 1 byte:			28456	28640
2023-06-22 18:58:41,827 #  2 - write 1000 times 2 byte:			28184	28352
2023-06-22 18:58:42,454 #  3 - write 1000 times 100 byte:		579528	579704
2023-06-22 18:58:42,563 #  4 - write 1000 times 1 byte to register:	54080	54256
2023-06-22 18:58:42,674 #  5 - write 1000 times 2 byte to register:	56720	56888
2023-06-22 18:58:43,340 #  6 - write 1000 times 100 byte to register:	608152	608320
2023-06-22 18:58:43,412 #  7 - read 1000 times 2 byte:			28304	28480
2023-06-22 18:58:44,025 #  8 - read 1000 times 100 byte:		567408	567576
2023-06-22 18:58:44,138 #  9 - read 1000 times 2 byte from register:	56840	57016
2023-06-22 18:58:44,793 # 10 - read 1000 times 100 byte from register:	596024	596200
2023-06-22 18:58:44,868 # 11 - transfer 1000 times 2 byte:		28336	28512
2023-06-22 18:58:45,510 # 12 - transfer 1000 times 100 byte:		592128	592304
2023-06-22 18:58:45,625 # 13 - transfer 1000 times 2 byte to register:	56960	57136
2023-06-22 18:58:46,306 # 14 - transfer 1000 times 100 byte to register:620744	620920
2023-06-22 18:58:46,373 # 15 - acquire/release 1000 times:		20960	21136
2023-06-22 18:58:46,879 # -- - SUM:					3922824	3925440
2023-06-22 18:58:46,880 # 
2023-06-22 18:58:46,907 # ### All runs complete ###
> 2023-06-22 18:58:54,706 # Exiting Pyterm
```
I always wonder how fast it really goes:
- #16727
- #18374
#### tests/periph/timer
```
tests/periph/timer$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
   8968	    274	   1032	  10274	   2822	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/timer/bin/atmega1284p/tests_timer.elf
avrdude: 9242 bytes of flash written
avrdude: 9242 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 19:00:15,136 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 19:00:16,138 # 
2023-06-22 19:00:16,139 # Help: Press s to start test, r to print it is ready
s
2023-06-22 19:00:31,118 # START
2023-06-22 19:00:31,200 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 19:00:31,201 # 
2023-06-22 19:00:31,230 # Test for peripheral TIMERs
2023-06-22 19:00:31,231 # 
2023-06-22 19:00:31,251 # Available timers: 2
2023-06-22 19:00:31,252 # 
2023-06-22 19:00:31,270 # Testing TIMER_0:
2023-06-22 19:00:31,306 # TIMER_0: initialization successful
2023-06-22 19:00:31,324 # TIMER_0: stopped
2023-06-22 19:00:31,356 # TIMER_0: set channel 0 to 5000
2023-06-22 19:00:31,390 # TIMER_0: set channel 1 to 10000
2023-06-22 19:00:31,408 # TIMER_0: starting
2023-06-22 19:00:31,482 # TIMER_0: channel 0 fired at SW count     1247 - init:     1247
2023-06-22 19:00:31,547 # TIMER_0: channel 1 fired at SW count     2488 - diff:     1241
2023-06-22 19:00:31,551 # 
2023-06-22 19:00:31,568 # Testing TIMER_1:
2023-06-22 19:00:31,605 # TIMER_1: initialization successful
2023-06-22 19:00:31,622 # TIMER_1: stopped
2023-06-22 19:00:31,655 # TIMER_1: set channel 0 to 5000
2023-06-22 19:00:31,688 # TIMER_1: set channel 1 to 10000
2023-06-22 19:00:31,707 # TIMER_1: starting
2023-06-22 19:00:31,780 # TIMER_1: channel 0 fired at SW count     1247 - init:     1247
2023-06-22 19:00:31,846 # TIMER_1: channel 1 fired at SW count     2488 - diff:     1241
2023-06-22 19:00:31,849 # 
2023-06-22 19:00:31,864 # TEST SUCCEEDED
2023-06-22 19:00:31,939 # { "threads": [{ "name": "idle", "stack_size": 128, "stack_used": 86 }]}
2023-06-22 19:00:32,015 # { "threads": [{ "name": "main", "stack_size": 640, "stack_used": 120 }]}
2023-06-22 19:00:34,259 # Exiting Pyterm
```
#### tests/periph/uart
```
tests/periph/uart$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  15918	   1044	   2000	  18962	   4a12	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/uart/bin/atmega1284p/tests_uart.elf
avrdude: 16962 bytes of flash written
avrdude: 16962 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 19:01:25,894 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 19:01:26,896 # 
2023-06-22 19:01:26,898 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 19:01:26,898 # 
2023-06-22 19:01:26,899 # Manual UART driver test application
2023-06-22 19:01:26,899 # ===================================
2023-06-22 19:01:26,900 # This application is intended for testing additional UART
2023-06-22 19:01:26,900 # interfaces, that might be defined for a board. The 'primary' UART
2023-06-22 19:01:26,901 # interface is tested implicitly, as it is running the shell...
2023-06-22 19:01:26,901 # 
2023-06-22 19:01:26,902 # When receiving data on one of the additional UART interfaces, this
2023-06-22 19:01:26,902 # data will be outputted via STDIO. So the easiest way to test an 
2023-06-22 19:01:26,903 # UART interface, is to simply connect the RX with the TX pin. Then 
2023-06-22 19:01:26,904 # you can send data on that interface and you should see the data 
2023-06-22 19:01:26,904 # being printed to STDOUT
2023-06-22 19:01:26,904 # 
2023-06-22 19:01:26,904 # NOTE: all strings need to be '\n' terminated!
2023-06-22 19:01:26,904 # 
2023-06-22 19:01:26,909 # UARD_DEV(0): test uart_poweron() and uart_poweroff()  ->  [OK]
2023-06-22 19:01:26,910 # 
2023-06-22 19:01:26,921 # UART INFO:
2023-06-22 19:01:26,958 # Available devices:               2
2023-06-22 19:01:27,004 # UART used for STDIO (the shell): UART_DEV(0)
2023-06-22 19:01:27,006 # 
init 1 9600
2023-06-22 19:01:50,464 # init 1 9600
send 1 ping
2023-06-22 19:04:12,912 # send 1 ping
2023-06-22 19:04:12,934 # UART_DEV(1) TX: ping
> 2023-06-22 19:04:12,973 # Success: UART_DEV(1) RX: [ping]\n
2023-06-22 19:04:23,894 # Exiting Pyterm
````

### Issues/PRs references

Depends on PR:
- #19751


19782: cpu/msp430: fix for ti's msp430-gcc-opensource package ld version r=benpicco a=hugueslarrive

### Contribution description
My msp430 toolchain (https://www.ti.com/tool/MSP430-GCC-OPENSOURCE) was broken by #19484:
```
hugues@p700:~/github/cpu_msp430_common/RIOT$ BOARD=msb-430 make -j64 -C examples/hello-world
make : on entre dans le répertoire « /home/hugues/github/cpu_msp430_common/RIOT/examples/hello-world »
Building application "hello-world" for "msb-430" with MCU "msp430fxyz".

"make" -C /home/hugues/github/cpu_msp430_common/RIOT/boards/common/init
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/boards/msb-430
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/core
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/core/lib
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/cpu/msp430fxyz
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/drivers
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/boards/common/msb-430
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/drivers/periph_common
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys/auto_init
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys/div
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys/libc
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys/malloc_thread_safe
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/cpu/msp430_common
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys/newlib_syscalls_default
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/cpu/msp430fxyz/periph
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys/preprocessor
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys/stdio_uart
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/cpu/msp430_common/periph
/opt/ti/msp430-gcc/bin/../lib/gcc/msp430-elf/9.3.1/../../../../msp430-elf/bin/ld: .rodata not found for insert
collect2: error: ld returned 1 exit status
make: *** [/home/hugues/github/cpu_msp430_common/RIOT/examples/hello-world/../../Makefile.include:761 : /home/hugues/github/cpu_msp430_common/RIOT/examples/hello-world/bin/msb-430/hello-world.elf] Erreur 1
make : on quitte le répertoire « /home/hugues/github/cpu_msp430_common/RIOT/examples/hello-world »
hugues@p700:~/github/cpu_msp430_common/RIOT$ /opt/ti/msp430-gcc/msp430-elf/bin/ld --version
GNU ld (Mitto Systems Limited - msp430-gcc 9.3.1.11) 2.34
Copyright (C) 2020 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
hugues@p700:~/github/cpu_msp430_common/RIOT$ /opt/ti/msp430-gcc/msp430-elf/bin/ld --version | grep -Eo '[0-9]\.[0-9]+'
9.3
1.11
2.34
hugues@p700:~/github/cpu_msp430_common/RIOT$ /opt/ti/msp430-gcc/msp430-elf/bin/ld --version | grep -Eo '[0-9]\.[0-9]+$'
2.34
```


### Testing procedure
```
hugues@p700:~/github/cpu_msp430_common/RIOT$ BOARD=msb-430 make -j64 -C examples/hello-world
make : on entre dans le répertoire « /home/hugues/github/cpu_msp430_common/RIOT/examples/hello-world »
Building application "hello-world" for "msb-430" with MCU "msp430fxyz".

"make" -C /home/hugues/github/cpu_msp430_common/RIOT/boards/common/init
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/boards/msb-430
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/core
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/core/lib
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/cpu/msp430fxyz
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/drivers
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/boards/common/msb-430
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/drivers/periph_common
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys/auto_init
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys/div
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys/libc
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys/malloc_thread_safe
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys/newlib_syscalls_default
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys/preprocessor
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/cpu/msp430_common
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys/stdio_uart
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/cpu/msp430fxyz/periph
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/cpu/msp430_common/periph
   text	   data	    bss	    dec	    hex	filename
   8612	    722	    866	  10200	   27d8	/home/hugues/github/cpu_msp430_common/RIOT/examples/hello-world/bin/msb-430/hello-world.elf
make : on quitte le répertoire « /home/hugues/github/cpu_msp430_common/RIOT/examples/hello-world »
```


### Issues/PRs references
Introduced by #19484, highlighted in #16727.


Co-authored-by: Fabian Hüßler <fabian.huessler@ml-pa.com>
Co-authored-by: Hugues Larrive <hlarrive@pm.me>
bors bot added a commit that referenced this pull request Jul 4, 2023
19752: cpu/atmega_common: checking features instead of CPU models r=maribu a=hugueslarrive

### Contribution description
Splitted from:
- #19740

### Testing procedure
Tested on atmega8 with:
- #19755

This one probably need to be tested on others cpu.
### Tests on 1284p:
#### tests/periph/adc
```
tests/periph/adc$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  10712	    304	   1021	  12037	   2f05	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/adc/bin/atmega1284p/tests_adc.elf
avrdude: 11016 bytes of flash written
avrdude: 11016 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:44:54,846 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:44:55,848 # 

2023-06-22 18:44:55,848 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:44:55,848 # 
2023-06-22 18:44:55,849 # RIOT ADC peripheral driver test
2023-06-22 18:44:55,849 # 
2023-06-22 18:44:55,850 # This test will sample all available ADC lines once every 100ms with
2023-06-22 18:44:55,850 # a 10-bit resolution and print the sampled results to STDIO
2023-06-22 18:44:55,850 # 
2023-06-22 18:44:55,850 # 
2023-06-22 18:44:55,851 # Successfully initialized ADC_LINE(0)
2023-06-22 18:44:55,851 # Successfully initialized ADC_LINE(1)
2023-06-22 18:44:55,851 # Successfully initialized ADC_LINE(2)
2023-06-22 18:44:55,852 # Successfully initialized ADC_LINE(3)
2023-06-22 18:44:55,852 # Successfully initialized ADC_LINE(4)
2023-06-22 18:44:55,852 # Successfully initialized ADC_LINE(5)
2023-06-22 18:44:55,853 # Successfully initialized ADC_LINE(6)
2023-06-22 18:44:55,853 # Successfully initialized ADC_LINE(7)
2023-06-22 18:44:55,853 # ADC_LINE(0): 796
2023-06-22 18:44:55,854 # ADC_LINE(1): 599
2023-06-22 18:44:55,854 # ADC_LINE(2): 522
2023-06-22 18:44:55,854 # ADC_LINE(3): 485
2023-06-22 18:44:55,854 # ADC_LINE(4): 466
2023-06-22 18:44:55,854 # ADC_LINE(5): 466
2023-06-22 18:44:55,854 # ADC_LINE(6): 478
2023-06-22 18:44:55,855 # ADC_LINE(7): 501
2023-06-22 18:44:55,855 #  Exiting Pyterm
make: *** [/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/adc/../../../Makefile.include:879: term] Interrompre
```
#### tests/periph/gpio
```
tests/periph/gpio$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  17828	   2112	   1095	  21035	   522b	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/gpio/bin/atmega1284p/tests_gpio.elf
avrdude: 19940 bytes of flash written
avrdude: 19940 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:46:50,726 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:46:51,734 # This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:46:51,734 # GPIO peripheral driver test
2023-06-22 18:46:51,734 # 
2023-06-22 18:46:51,735 # In this test, pins are specified by integer port and pin numbers.
2023-06-22 18:46:51,735 # So if your platform has a pin PA01, it will be port=0 and pin=1,
2023-06-22 18:46:51,736 # PC14 would be port=2 and pin=14 etc.
2023-06-22 18:46:51,736 # 
2023-06-22 18:46:51,736 # NOTE: make sure the values you use exist on your platform! The
2023-06-22 18:46:51,738 #       behavior for not existing ports/pins is not defined!
init_out 1 5
2023-06-22 18:47:50,380 # init_out 1 5
toggle 1 5
2023-06-22 18:48:09,425 # toggle 1 5
> toggle 1 5
2023-06-22 18:48:12,477 # toggle 1 5
> 2023-06-22 18:48:15,013 # Exiting Pyterm
```
#### tests/periph/i2c
```
tests/periph/i2c$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  18634	   1288	   1215	  21137	   5291	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/i2c/bin/atmega1284p/tests_i2c.elf
avrdude: 19922 bytes of flash written
avrdude: 19922 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:50:37,434 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:50:38,437 # 
2023-06-22 18:50:38,438 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:50:38,438 # Start: Test for the low-level I2C driver
> i2c_scan 0
2023-06-22 18:51:37,661 # i2c_scan 0
2023-06-22 18:51:37,687 # Scanning I2C device 0...
2023-06-22 18:51:37,765 # addr not ack'ed = "-", addr ack'ed = "X", addr reserved = "R", error = "E"
2023-06-22 18:51:37,804 #      0 1 2 3 4 5 6 7 8 9 a b c d e f
2023-06-22 18:51:37,842 # 0x00 R R R R R R R R R R R R R R - -
2023-06-22 18:51:37,881 # 0x10 - - - - - - - - - - - - - - - -
2023-06-22 18:51:37,919 # 0x20 - - - - - - - - - - - - - - - -
2023-06-22 18:51:37,958 # 0x30 - - - - - - - - - - - - - - - -
2023-06-22 18:51:37,996 # 0x40 - - - - - - - - - - - - - - - -
2023-06-22 18:51:38,035 # 0x50 - - - - - - - - - - - - - - - -
2023-06-22 18:51:38,073 # 0x60 - - - - - - - - - - - - - - - -
2023-06-22 18:51:38,112 # 0x70 - - - - - - - - R R R R R R R R
> 2023-06-22 18:52:54,462 # Exiting Pyterm
```
#### tests/periph/pwm
```
tests/periph/pwm$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  15382	    896	   1093	  17371	   43db	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/pwm/bin/atmega1284p/tests_pwm.elf
avrdude: 16278 bytes of flash written
avrdude: 16278 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:54:32,308 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:54:33,310 # 
2023-06-22 18:54:33,312 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:54:33,312 # PWM peripheral driver test
2023-06-22 18:54:33,313 # 
> osci
2023-06-22 18:54:39,105 # osci
2023-06-22 18:54:39,106 # 
2023-06-22 18:54:39,121 # RIOT PWM test
2023-06-22 18:54:39,177 # Connect an LED or scope to PWM pins to see something.
2023-06-22 18:54:39,178 # 
2023-06-22 18:54:39,216 # Available PWM device between 0 and 1
2023-06-22 18:54:39,244 # Initialized PWM_0 @ 488Hz.
2023-06-22 18:54:39,273 # Initialized PWM_1 @ 976Hz.
2023-06-22 18:54:39,274 # 
2023-06-22 18:54:39,313 # Letting the PWM pins oscillate now...
2023-06-22 18:54:45,655 # Exiting Pyterm
```
#### tests/periph/spi
```
tests/periph/spi$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  19240	   1402	   2317	  22959	   59af	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/spi/bin/atmega1284p/tests_spi.elf
avrdude: 20642 bytes of flash written
avrdude: 20642 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:58:12,394 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:58:13,396 # 
2023-06-22 18:58:13,398 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:58:13,398 # Manual SPI peripheral driver test (see README.md)
2023-06-22 18:58:13,399 # There are 1 SPI devices configured for your platform.
init 0 0 4
2023-06-22 18:58:32,086 # init 0 0 4
2023-06-22 18:58:32,161 # Trying to initialize SPI_DEV(0): mode: 0, clk: 4, cs_port: 0, cs_pin: 0
2023-06-22 18:58:32,270 # (if below the program crashes with a failed assertion, then it means the configuration is not supported)
2023-06-22 18:58:32,280 # Success.
bench
2023-06-22 18:58:41,590 # bench
2023-06-22 18:58:41,644 # ### Running some benchmarks, all values in [us] ###
2023-06-22 18:58:41,682 # ### Test				Transfer time	user time
2023-06-22 18:58:41,683 # 
2023-06-22 18:58:41,755 #  1 - write 1000 times 1 byte:			28456	28640
2023-06-22 18:58:41,827 #  2 - write 1000 times 2 byte:			28184	28352
2023-06-22 18:58:42,454 #  3 - write 1000 times 100 byte:		579528	579704
2023-06-22 18:58:42,563 #  4 - write 1000 times 1 byte to register:	54080	54256
2023-06-22 18:58:42,674 #  5 - write 1000 times 2 byte to register:	56720	56888
2023-06-22 18:58:43,340 #  6 - write 1000 times 100 byte to register:	608152	608320
2023-06-22 18:58:43,412 #  7 - read 1000 times 2 byte:			28304	28480
2023-06-22 18:58:44,025 #  8 - read 1000 times 100 byte:		567408	567576
2023-06-22 18:58:44,138 #  9 - read 1000 times 2 byte from register:	56840	57016
2023-06-22 18:58:44,793 # 10 - read 1000 times 100 byte from register:	596024	596200
2023-06-22 18:58:44,868 # 11 - transfer 1000 times 2 byte:		28336	28512
2023-06-22 18:58:45,510 # 12 - transfer 1000 times 100 byte:		592128	592304
2023-06-22 18:58:45,625 # 13 - transfer 1000 times 2 byte to register:	56960	57136
2023-06-22 18:58:46,306 # 14 - transfer 1000 times 100 byte to register:620744	620920
2023-06-22 18:58:46,373 # 15 - acquire/release 1000 times:		20960	21136
2023-06-22 18:58:46,879 # -- - SUM:					3922824	3925440
2023-06-22 18:58:46,880 # 
2023-06-22 18:58:46,907 # ### All runs complete ###
> 2023-06-22 18:58:54,706 # Exiting Pyterm
```
I always wonder how fast it really goes:
- #16727
- #18374
#### tests/periph/timer
```
tests/periph/timer$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
   8968	    274	   1032	  10274	   2822	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/timer/bin/atmega1284p/tests_timer.elf
avrdude: 9242 bytes of flash written
avrdude: 9242 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 19:00:15,136 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 19:00:16,138 # 
2023-06-22 19:00:16,139 # Help: Press s to start test, r to print it is ready
s
2023-06-22 19:00:31,118 # START
2023-06-22 19:00:31,200 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 19:00:31,201 # 
2023-06-22 19:00:31,230 # Test for peripheral TIMERs
2023-06-22 19:00:31,231 # 
2023-06-22 19:00:31,251 # Available timers: 2
2023-06-22 19:00:31,252 # 
2023-06-22 19:00:31,270 # Testing TIMER_0:
2023-06-22 19:00:31,306 # TIMER_0: initialization successful
2023-06-22 19:00:31,324 # TIMER_0: stopped
2023-06-22 19:00:31,356 # TIMER_0: set channel 0 to 5000
2023-06-22 19:00:31,390 # TIMER_0: set channel 1 to 10000
2023-06-22 19:00:31,408 # TIMER_0: starting
2023-06-22 19:00:31,482 # TIMER_0: channel 0 fired at SW count     1247 - init:     1247
2023-06-22 19:00:31,547 # TIMER_0: channel 1 fired at SW count     2488 - diff:     1241
2023-06-22 19:00:31,551 # 
2023-06-22 19:00:31,568 # Testing TIMER_1:
2023-06-22 19:00:31,605 # TIMER_1: initialization successful
2023-06-22 19:00:31,622 # TIMER_1: stopped
2023-06-22 19:00:31,655 # TIMER_1: set channel 0 to 5000
2023-06-22 19:00:31,688 # TIMER_1: set channel 1 to 10000
2023-06-22 19:00:31,707 # TIMER_1: starting
2023-06-22 19:00:31,780 # TIMER_1: channel 0 fired at SW count     1247 - init:     1247
2023-06-22 19:00:31,846 # TIMER_1: channel 1 fired at SW count     2488 - diff:     1241
2023-06-22 19:00:31,849 # 
2023-06-22 19:00:31,864 # TEST SUCCEEDED
2023-06-22 19:00:31,939 # { "threads": [{ "name": "idle", "stack_size": 128, "stack_used": 86 }]}
2023-06-22 19:00:32,015 # { "threads": [{ "name": "main", "stack_size": 640, "stack_used": 120 }]}
2023-06-22 19:00:34,259 # Exiting Pyterm
```
#### tests/periph/uart
```
tests/periph/uart$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  15918	   1044	   2000	  18962	   4a12	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/uart/bin/atmega1284p/tests_uart.elf
avrdude: 16962 bytes of flash written
avrdude: 16962 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 19:01:25,894 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 19:01:26,896 # 
2023-06-22 19:01:26,898 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 19:01:26,898 # 
2023-06-22 19:01:26,899 # Manual UART driver test application
2023-06-22 19:01:26,899 # ===================================
2023-06-22 19:01:26,900 # This application is intended for testing additional UART
2023-06-22 19:01:26,900 # interfaces, that might be defined for a board. The 'primary' UART
2023-06-22 19:01:26,901 # interface is tested implicitly, as it is running the shell...
2023-06-22 19:01:26,901 # 
2023-06-22 19:01:26,902 # When receiving data on one of the additional UART interfaces, this
2023-06-22 19:01:26,902 # data will be outputted via STDIO. So the easiest way to test an 
2023-06-22 19:01:26,903 # UART interface, is to simply connect the RX with the TX pin. Then 
2023-06-22 19:01:26,904 # you can send data on that interface and you should see the data 
2023-06-22 19:01:26,904 # being printed to STDOUT
2023-06-22 19:01:26,904 # 
2023-06-22 19:01:26,904 # NOTE: all strings need to be '\n' terminated!
2023-06-22 19:01:26,904 # 
2023-06-22 19:01:26,909 # UARD_DEV(0): test uart_poweron() and uart_poweroff()  ->  [OK]
2023-06-22 19:01:26,910 # 
2023-06-22 19:01:26,921 # UART INFO:
2023-06-22 19:01:26,958 # Available devices:               2
2023-06-22 19:01:27,004 # UART used for STDIO (the shell): UART_DEV(0)
2023-06-22 19:01:27,006 # 
init 1 9600
2023-06-22 19:01:50,464 # init 1 9600
send 1 ping
2023-06-22 19:04:12,912 # send 1 ping
2023-06-22 19:04:12,934 # UART_DEV(1) TX: ping
> 2023-06-22 19:04:12,973 # Success: UART_DEV(1) RX: [ping]\n
2023-06-22 19:04:23,894 # Exiting Pyterm
````

### Issues/PRs references

Depends on PR:
- #19751


Co-authored-by: Hugues Larrive <hlarrive@pm.me>
bors bot added a commit that referenced this pull request Jul 4, 2023
19747: gnrc/ipv6/nib: reset rs_sent counter also for not-6LN interfaces r=benpicco a=fabian18



19752: cpu/atmega_common: checking features instead of CPU models r=maribu a=hugueslarrive

### Contribution description
Splitted from:
- #19740

### Testing procedure
Tested on atmega8 with:
- #19755

This one probably need to be tested on others cpu.
### Tests on 1284p:
#### tests/periph/adc
```
tests/periph/adc$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  10712	    304	   1021	  12037	   2f05	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/adc/bin/atmega1284p/tests_adc.elf
avrdude: 11016 bytes of flash written
avrdude: 11016 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:44:54,846 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:44:55,848 # 

2023-06-22 18:44:55,848 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:44:55,848 # 
2023-06-22 18:44:55,849 # RIOT ADC peripheral driver test
2023-06-22 18:44:55,849 # 
2023-06-22 18:44:55,850 # This test will sample all available ADC lines once every 100ms with
2023-06-22 18:44:55,850 # a 10-bit resolution and print the sampled results to STDIO
2023-06-22 18:44:55,850 # 
2023-06-22 18:44:55,850 # 
2023-06-22 18:44:55,851 # Successfully initialized ADC_LINE(0)
2023-06-22 18:44:55,851 # Successfully initialized ADC_LINE(1)
2023-06-22 18:44:55,851 # Successfully initialized ADC_LINE(2)
2023-06-22 18:44:55,852 # Successfully initialized ADC_LINE(3)
2023-06-22 18:44:55,852 # Successfully initialized ADC_LINE(4)
2023-06-22 18:44:55,852 # Successfully initialized ADC_LINE(5)
2023-06-22 18:44:55,853 # Successfully initialized ADC_LINE(6)
2023-06-22 18:44:55,853 # Successfully initialized ADC_LINE(7)
2023-06-22 18:44:55,853 # ADC_LINE(0): 796
2023-06-22 18:44:55,854 # ADC_LINE(1): 599
2023-06-22 18:44:55,854 # ADC_LINE(2): 522
2023-06-22 18:44:55,854 # ADC_LINE(3): 485
2023-06-22 18:44:55,854 # ADC_LINE(4): 466
2023-06-22 18:44:55,854 # ADC_LINE(5): 466
2023-06-22 18:44:55,854 # ADC_LINE(6): 478
2023-06-22 18:44:55,855 # ADC_LINE(7): 501
2023-06-22 18:44:55,855 #  Exiting Pyterm
make: *** [/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/adc/../../../Makefile.include:879: term] Interrompre
```
#### tests/periph/gpio
```
tests/periph/gpio$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  17828	   2112	   1095	  21035	   522b	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/gpio/bin/atmega1284p/tests_gpio.elf
avrdude: 19940 bytes of flash written
avrdude: 19940 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:46:50,726 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:46:51,734 # This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:46:51,734 # GPIO peripheral driver test
2023-06-22 18:46:51,734 # 
2023-06-22 18:46:51,735 # In this test, pins are specified by integer port and pin numbers.
2023-06-22 18:46:51,735 # So if your platform has a pin PA01, it will be port=0 and pin=1,
2023-06-22 18:46:51,736 # PC14 would be port=2 and pin=14 etc.
2023-06-22 18:46:51,736 # 
2023-06-22 18:46:51,736 # NOTE: make sure the values you use exist on your platform! The
2023-06-22 18:46:51,738 #       behavior for not existing ports/pins is not defined!
init_out 1 5
2023-06-22 18:47:50,380 # init_out 1 5
toggle 1 5
2023-06-22 18:48:09,425 # toggle 1 5
> toggle 1 5
2023-06-22 18:48:12,477 # toggle 1 5
> 2023-06-22 18:48:15,013 # Exiting Pyterm
```
#### tests/periph/i2c
```
tests/periph/i2c$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  18634	   1288	   1215	  21137	   5291	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/i2c/bin/atmega1284p/tests_i2c.elf
avrdude: 19922 bytes of flash written
avrdude: 19922 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:50:37,434 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:50:38,437 # 
2023-06-22 18:50:38,438 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:50:38,438 # Start: Test for the low-level I2C driver
> i2c_scan 0
2023-06-22 18:51:37,661 # i2c_scan 0
2023-06-22 18:51:37,687 # Scanning I2C device 0...
2023-06-22 18:51:37,765 # addr not ack'ed = "-", addr ack'ed = "X", addr reserved = "R", error = "E"
2023-06-22 18:51:37,804 #      0 1 2 3 4 5 6 7 8 9 a b c d e f
2023-06-22 18:51:37,842 # 0x00 R R R R R R R R R R R R R R - -
2023-06-22 18:51:37,881 # 0x10 - - - - - - - - - - - - - - - -
2023-06-22 18:51:37,919 # 0x20 - - - - - - - - - - - - - - - -
2023-06-22 18:51:37,958 # 0x30 - - - - - - - - - - - - - - - -
2023-06-22 18:51:37,996 # 0x40 - - - - - - - - - - - - - - - -
2023-06-22 18:51:38,035 # 0x50 - - - - - - - - - - - - - - - -
2023-06-22 18:51:38,073 # 0x60 - - - - - - - - - - - - - - - -
2023-06-22 18:51:38,112 # 0x70 - - - - - - - - R R R R R R R R
> 2023-06-22 18:52:54,462 # Exiting Pyterm
```
#### tests/periph/pwm
```
tests/periph/pwm$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  15382	    896	   1093	  17371	   43db	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/pwm/bin/atmega1284p/tests_pwm.elf
avrdude: 16278 bytes of flash written
avrdude: 16278 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:54:32,308 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:54:33,310 # 
2023-06-22 18:54:33,312 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:54:33,312 # PWM peripheral driver test
2023-06-22 18:54:33,313 # 
> osci
2023-06-22 18:54:39,105 # osci
2023-06-22 18:54:39,106 # 
2023-06-22 18:54:39,121 # RIOT PWM test
2023-06-22 18:54:39,177 # Connect an LED or scope to PWM pins to see something.
2023-06-22 18:54:39,178 # 
2023-06-22 18:54:39,216 # Available PWM device between 0 and 1
2023-06-22 18:54:39,244 # Initialized PWM_0 @ 488Hz.
2023-06-22 18:54:39,273 # Initialized PWM_1 @ 976Hz.
2023-06-22 18:54:39,274 # 
2023-06-22 18:54:39,313 # Letting the PWM pins oscillate now...
2023-06-22 18:54:45,655 # Exiting Pyterm
```
#### tests/periph/spi
```
tests/periph/spi$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  19240	   1402	   2317	  22959	   59af	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/spi/bin/atmega1284p/tests_spi.elf
avrdude: 20642 bytes of flash written
avrdude: 20642 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:58:12,394 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:58:13,396 # 
2023-06-22 18:58:13,398 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:58:13,398 # Manual SPI peripheral driver test (see README.md)
2023-06-22 18:58:13,399 # There are 1 SPI devices configured for your platform.
init 0 0 4
2023-06-22 18:58:32,086 # init 0 0 4
2023-06-22 18:58:32,161 # Trying to initialize SPI_DEV(0): mode: 0, clk: 4, cs_port: 0, cs_pin: 0
2023-06-22 18:58:32,270 # (if below the program crashes with a failed assertion, then it means the configuration is not supported)
2023-06-22 18:58:32,280 # Success.
bench
2023-06-22 18:58:41,590 # bench
2023-06-22 18:58:41,644 # ### Running some benchmarks, all values in [us] ###
2023-06-22 18:58:41,682 # ### Test				Transfer time	user time
2023-06-22 18:58:41,683 # 
2023-06-22 18:58:41,755 #  1 - write 1000 times 1 byte:			28456	28640
2023-06-22 18:58:41,827 #  2 - write 1000 times 2 byte:			28184	28352
2023-06-22 18:58:42,454 #  3 - write 1000 times 100 byte:		579528	579704
2023-06-22 18:58:42,563 #  4 - write 1000 times 1 byte to register:	54080	54256
2023-06-22 18:58:42,674 #  5 - write 1000 times 2 byte to register:	56720	56888
2023-06-22 18:58:43,340 #  6 - write 1000 times 100 byte to register:	608152	608320
2023-06-22 18:58:43,412 #  7 - read 1000 times 2 byte:			28304	28480
2023-06-22 18:58:44,025 #  8 - read 1000 times 100 byte:		567408	567576
2023-06-22 18:58:44,138 #  9 - read 1000 times 2 byte from register:	56840	57016
2023-06-22 18:58:44,793 # 10 - read 1000 times 100 byte from register:	596024	596200
2023-06-22 18:58:44,868 # 11 - transfer 1000 times 2 byte:		28336	28512
2023-06-22 18:58:45,510 # 12 - transfer 1000 times 100 byte:		592128	592304
2023-06-22 18:58:45,625 # 13 - transfer 1000 times 2 byte to register:	56960	57136
2023-06-22 18:58:46,306 # 14 - transfer 1000 times 100 byte to register:620744	620920
2023-06-22 18:58:46,373 # 15 - acquire/release 1000 times:		20960	21136
2023-06-22 18:58:46,879 # -- - SUM:					3922824	3925440
2023-06-22 18:58:46,880 # 
2023-06-22 18:58:46,907 # ### All runs complete ###
> 2023-06-22 18:58:54,706 # Exiting Pyterm
```
I always wonder how fast it really goes:
- #16727
- #18374
#### tests/periph/timer
```
tests/periph/timer$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
   8968	    274	   1032	  10274	   2822	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/timer/bin/atmega1284p/tests_timer.elf
avrdude: 9242 bytes of flash written
avrdude: 9242 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 19:00:15,136 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 19:00:16,138 # 
2023-06-22 19:00:16,139 # Help: Press s to start test, r to print it is ready
s
2023-06-22 19:00:31,118 # START
2023-06-22 19:00:31,200 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 19:00:31,201 # 
2023-06-22 19:00:31,230 # Test for peripheral TIMERs
2023-06-22 19:00:31,231 # 
2023-06-22 19:00:31,251 # Available timers: 2
2023-06-22 19:00:31,252 # 
2023-06-22 19:00:31,270 # Testing TIMER_0:
2023-06-22 19:00:31,306 # TIMER_0: initialization successful
2023-06-22 19:00:31,324 # TIMER_0: stopped
2023-06-22 19:00:31,356 # TIMER_0: set channel 0 to 5000
2023-06-22 19:00:31,390 # TIMER_0: set channel 1 to 10000
2023-06-22 19:00:31,408 # TIMER_0: starting
2023-06-22 19:00:31,482 # TIMER_0: channel 0 fired at SW count     1247 - init:     1247
2023-06-22 19:00:31,547 # TIMER_0: channel 1 fired at SW count     2488 - diff:     1241
2023-06-22 19:00:31,551 # 
2023-06-22 19:00:31,568 # Testing TIMER_1:
2023-06-22 19:00:31,605 # TIMER_1: initialization successful
2023-06-22 19:00:31,622 # TIMER_1: stopped
2023-06-22 19:00:31,655 # TIMER_1: set channel 0 to 5000
2023-06-22 19:00:31,688 # TIMER_1: set channel 1 to 10000
2023-06-22 19:00:31,707 # TIMER_1: starting
2023-06-22 19:00:31,780 # TIMER_1: channel 0 fired at SW count     1247 - init:     1247
2023-06-22 19:00:31,846 # TIMER_1: channel 1 fired at SW count     2488 - diff:     1241
2023-06-22 19:00:31,849 # 
2023-06-22 19:00:31,864 # TEST SUCCEEDED
2023-06-22 19:00:31,939 # { "threads": [{ "name": "idle", "stack_size": 128, "stack_used": 86 }]}
2023-06-22 19:00:32,015 # { "threads": [{ "name": "main", "stack_size": 640, "stack_used": 120 }]}
2023-06-22 19:00:34,259 # Exiting Pyterm
```
#### tests/periph/uart
```
tests/periph/uart$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  15918	   1044	   2000	  18962	   4a12	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/uart/bin/atmega1284p/tests_uart.elf
avrdude: 16962 bytes of flash written
avrdude: 16962 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 19:01:25,894 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 19:01:26,896 # 
2023-06-22 19:01:26,898 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 19:01:26,898 # 
2023-06-22 19:01:26,899 # Manual UART driver test application
2023-06-22 19:01:26,899 # ===================================
2023-06-22 19:01:26,900 # This application is intended for testing additional UART
2023-06-22 19:01:26,900 # interfaces, that might be defined for a board. The 'primary' UART
2023-06-22 19:01:26,901 # interface is tested implicitly, as it is running the shell...
2023-06-22 19:01:26,901 # 
2023-06-22 19:01:26,902 # When receiving data on one of the additional UART interfaces, this
2023-06-22 19:01:26,902 # data will be outputted via STDIO. So the easiest way to test an 
2023-06-22 19:01:26,903 # UART interface, is to simply connect the RX with the TX pin. Then 
2023-06-22 19:01:26,904 # you can send data on that interface and you should see the data 
2023-06-22 19:01:26,904 # being printed to STDOUT
2023-06-22 19:01:26,904 # 
2023-06-22 19:01:26,904 # NOTE: all strings need to be '\n' terminated!
2023-06-22 19:01:26,904 # 
2023-06-22 19:01:26,909 # UARD_DEV(0): test uart_poweron() and uart_poweroff()  ->  [OK]
2023-06-22 19:01:26,910 # 
2023-06-22 19:01:26,921 # UART INFO:
2023-06-22 19:01:26,958 # Available devices:               2
2023-06-22 19:01:27,004 # UART used for STDIO (the shell): UART_DEV(0)
2023-06-22 19:01:27,006 # 
init 1 9600
2023-06-22 19:01:50,464 # init 1 9600
send 1 ping
2023-06-22 19:04:12,912 # send 1 ping
2023-06-22 19:04:12,934 # UART_DEV(1) TX: ping
> 2023-06-22 19:04:12,973 # Success: UART_DEV(1) RX: [ping]\n
2023-06-22 19:04:23,894 # Exiting Pyterm
````

### Issues/PRs references

Depends on PR:
- #19751


19769: cpu/nrf53: add initial support with nRF5340DK-APP board r=benpicco a=dylad

### Contribution description

This PR adds support for nRF5340 MCU and its associated Nordic development board, nRF5340DK.
This MCU provides a dual Cortex-M33, one application core running at up to 128MHz, and one network core running at up to 64MHz.
Peripherals are inherited from others Nordic MCUs families so it shouldn't be hard to add more of them in followup PRs.

For now, only the minimal set of peripherals is supported:
- GPIO / GPIO_IRQ
- UART
- TIMER

### Testing procedure
Build the usual test application for the supported peripherals and flash the board.
nRF5340DK provides two serial ports on its embedded debugger. RIOT's shell should be available on the first one (/dev/ttyACM0)


### Issues/PRs references
#18576
#19267 


19782: cpu/msp430: fix for ti's msp430-gcc-opensource package ld version r=maribu a=hugueslarrive

### Contribution description
My msp430 toolchain (https://www.ti.com/tool/MSP430-GCC-OPENSOURCE) was broken by #19484:
```
hugues@p700:~/github/cpu_msp430_common/RIOT$ BOARD=msb-430 make -j64 -C examples/hello-world
make : on entre dans le répertoire « /home/hugues/github/cpu_msp430_common/RIOT/examples/hello-world »
Building application "hello-world" for "msb-430" with MCU "msp430fxyz".

"make" -C /home/hugues/github/cpu_msp430_common/RIOT/boards/common/init
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/boards/msb-430
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/core
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/core/lib
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/cpu/msp430fxyz
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/drivers
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/boards/common/msb-430
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/drivers/periph_common
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys/auto_init
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys/div
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys/libc
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys/malloc_thread_safe
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/cpu/msp430_common
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys/newlib_syscalls_default
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/cpu/msp430fxyz/periph
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys/preprocessor
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys/stdio_uart
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/cpu/msp430_common/periph
/opt/ti/msp430-gcc/bin/../lib/gcc/msp430-elf/9.3.1/../../../../msp430-elf/bin/ld: .rodata not found for insert
collect2: error: ld returned 1 exit status
make: *** [/home/hugues/github/cpu_msp430_common/RIOT/examples/hello-world/../../Makefile.include:761 : /home/hugues/github/cpu_msp430_common/RIOT/examples/hello-world/bin/msb-430/hello-world.elf] Erreur 1
make : on quitte le répertoire « /home/hugues/github/cpu_msp430_common/RIOT/examples/hello-world »
hugues@p700:~/github/cpu_msp430_common/RIOT$ /opt/ti/msp430-gcc/msp430-elf/bin/ld --version
GNU ld (Mitto Systems Limited - msp430-gcc 9.3.1.11) 2.34
Copyright (C) 2020 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
hugues@p700:~/github/cpu_msp430_common/RIOT$ /opt/ti/msp430-gcc/msp430-elf/bin/ld --version | grep -Eo '[0-9]\.[0-9]+'
9.3
1.11
2.34
hugues@p700:~/github/cpu_msp430_common/RIOT$ /opt/ti/msp430-gcc/msp430-elf/bin/ld --version | grep -Eo '[0-9]\.[0-9]+$'
2.34
```


### Testing procedure
```
hugues@p700:~/github/cpu_msp430_common/RIOT$ BOARD=msb-430 make -j64 -C examples/hello-world
make : on entre dans le répertoire « /home/hugues/github/cpu_msp430_common/RIOT/examples/hello-world »
Building application "hello-world" for "msb-430" with MCU "msp430fxyz".

"make" -C /home/hugues/github/cpu_msp430_common/RIOT/boards/common/init
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/boards/msb-430
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/core
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/core/lib
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/cpu/msp430fxyz
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/drivers
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/boards/common/msb-430
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/drivers/periph_common
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys/auto_init
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys/div
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys/libc
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys/malloc_thread_safe
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys/newlib_syscalls_default
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys/preprocessor
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/cpu/msp430_common
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/sys/stdio_uart
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/cpu/msp430fxyz/periph
"make" -C /home/hugues/github/cpu_msp430_common/RIOT/cpu/msp430_common/periph
   text	   data	    bss	    dec	    hex	filename
   8612	    722	    866	  10200	   27d8	/home/hugues/github/cpu_msp430_common/RIOT/examples/hello-world/bin/msb-430/hello-world.elf
make : on quitte le répertoire « /home/hugues/github/cpu_msp430_common/RIOT/examples/hello-world »
```


### Issues/PRs references
Introduced by #19484, highlighted in #16727.


Co-authored-by: Fabian Hüßler <fabian.huessler@ml-pa.com>
Co-authored-by: Hugues Larrive <hlarrive@pm.me>
Co-authored-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
bors bot added a commit that referenced this pull request Jul 4, 2023
19747: gnrc/ipv6/nib: reset rs_sent counter also for not-6LN interfaces r=benpicco a=fabian18



19752: cpu/atmega_common: checking features instead of CPU models r=maribu a=hugueslarrive

### Contribution description
Splitted from:
- #19740

### Testing procedure
Tested on atmega8 with:
- #19755

This one probably need to be tested on others cpu.
### Tests on 1284p:
#### tests/periph/adc
```
tests/periph/adc$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  10712	    304	   1021	  12037	   2f05	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/adc/bin/atmega1284p/tests_adc.elf
avrdude: 11016 bytes of flash written
avrdude: 11016 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:44:54,846 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:44:55,848 # 

2023-06-22 18:44:55,848 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:44:55,848 # 
2023-06-22 18:44:55,849 # RIOT ADC peripheral driver test
2023-06-22 18:44:55,849 # 
2023-06-22 18:44:55,850 # This test will sample all available ADC lines once every 100ms with
2023-06-22 18:44:55,850 # a 10-bit resolution and print the sampled results to STDIO
2023-06-22 18:44:55,850 # 
2023-06-22 18:44:55,850 # 
2023-06-22 18:44:55,851 # Successfully initialized ADC_LINE(0)
2023-06-22 18:44:55,851 # Successfully initialized ADC_LINE(1)
2023-06-22 18:44:55,851 # Successfully initialized ADC_LINE(2)
2023-06-22 18:44:55,852 # Successfully initialized ADC_LINE(3)
2023-06-22 18:44:55,852 # Successfully initialized ADC_LINE(4)
2023-06-22 18:44:55,852 # Successfully initialized ADC_LINE(5)
2023-06-22 18:44:55,853 # Successfully initialized ADC_LINE(6)
2023-06-22 18:44:55,853 # Successfully initialized ADC_LINE(7)
2023-06-22 18:44:55,853 # ADC_LINE(0): 796
2023-06-22 18:44:55,854 # ADC_LINE(1): 599
2023-06-22 18:44:55,854 # ADC_LINE(2): 522
2023-06-22 18:44:55,854 # ADC_LINE(3): 485
2023-06-22 18:44:55,854 # ADC_LINE(4): 466
2023-06-22 18:44:55,854 # ADC_LINE(5): 466
2023-06-22 18:44:55,854 # ADC_LINE(6): 478
2023-06-22 18:44:55,855 # ADC_LINE(7): 501
2023-06-22 18:44:55,855 #  Exiting Pyterm
make: *** [/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/adc/../../../Makefile.include:879: term] Interrompre
```
#### tests/periph/gpio
```
tests/periph/gpio$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  17828	   2112	   1095	  21035	   522b	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/gpio/bin/atmega1284p/tests_gpio.elf
avrdude: 19940 bytes of flash written
avrdude: 19940 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:46:50,726 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:46:51,734 # This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:46:51,734 # GPIO peripheral driver test
2023-06-22 18:46:51,734 # 
2023-06-22 18:46:51,735 # In this test, pins are specified by integer port and pin numbers.
2023-06-22 18:46:51,735 # So if your platform has a pin PA01, it will be port=0 and pin=1,
2023-06-22 18:46:51,736 # PC14 would be port=2 and pin=14 etc.
2023-06-22 18:46:51,736 # 
2023-06-22 18:46:51,736 # NOTE: make sure the values you use exist on your platform! The
2023-06-22 18:46:51,738 #       behavior for not existing ports/pins is not defined!
init_out 1 5
2023-06-22 18:47:50,380 # init_out 1 5
toggle 1 5
2023-06-22 18:48:09,425 # toggle 1 5
> toggle 1 5
2023-06-22 18:48:12,477 # toggle 1 5
> 2023-06-22 18:48:15,013 # Exiting Pyterm
```
#### tests/periph/i2c
```
tests/periph/i2c$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  18634	   1288	   1215	  21137	   5291	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/i2c/bin/atmega1284p/tests_i2c.elf
avrdude: 19922 bytes of flash written
avrdude: 19922 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:50:37,434 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:50:38,437 # 
2023-06-22 18:50:38,438 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:50:38,438 # Start: Test for the low-level I2C driver
> i2c_scan 0
2023-06-22 18:51:37,661 # i2c_scan 0
2023-06-22 18:51:37,687 # Scanning I2C device 0...
2023-06-22 18:51:37,765 # addr not ack'ed = "-", addr ack'ed = "X", addr reserved = "R", error = "E"
2023-06-22 18:51:37,804 #      0 1 2 3 4 5 6 7 8 9 a b c d e f
2023-06-22 18:51:37,842 # 0x00 R R R R R R R R R R R R R R - -
2023-06-22 18:51:37,881 # 0x10 - - - - - - - - - - - - - - - -
2023-06-22 18:51:37,919 # 0x20 - - - - - - - - - - - - - - - -
2023-06-22 18:51:37,958 # 0x30 - - - - - - - - - - - - - - - -
2023-06-22 18:51:37,996 # 0x40 - - - - - - - - - - - - - - - -
2023-06-22 18:51:38,035 # 0x50 - - - - - - - - - - - - - - - -
2023-06-22 18:51:38,073 # 0x60 - - - - - - - - - - - - - - - -
2023-06-22 18:51:38,112 # 0x70 - - - - - - - - R R R R R R R R
> 2023-06-22 18:52:54,462 # Exiting Pyterm
```
#### tests/periph/pwm
```
tests/periph/pwm$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  15382	    896	   1093	  17371	   43db	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/pwm/bin/atmega1284p/tests_pwm.elf
avrdude: 16278 bytes of flash written
avrdude: 16278 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:54:32,308 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:54:33,310 # 
2023-06-22 18:54:33,312 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:54:33,312 # PWM peripheral driver test
2023-06-22 18:54:33,313 # 
> osci
2023-06-22 18:54:39,105 # osci
2023-06-22 18:54:39,106 # 
2023-06-22 18:54:39,121 # RIOT PWM test
2023-06-22 18:54:39,177 # Connect an LED or scope to PWM pins to see something.
2023-06-22 18:54:39,178 # 
2023-06-22 18:54:39,216 # Available PWM device between 0 and 1
2023-06-22 18:54:39,244 # Initialized PWM_0 @ 488Hz.
2023-06-22 18:54:39,273 # Initialized PWM_1 @ 976Hz.
2023-06-22 18:54:39,274 # 
2023-06-22 18:54:39,313 # Letting the PWM pins oscillate now...
2023-06-22 18:54:45,655 # Exiting Pyterm
```
#### tests/periph/spi
```
tests/periph/spi$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  19240	   1402	   2317	  22959	   59af	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/spi/bin/atmega1284p/tests_spi.elf
avrdude: 20642 bytes of flash written
avrdude: 20642 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:58:12,394 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:58:13,396 # 
2023-06-22 18:58:13,398 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:58:13,398 # Manual SPI peripheral driver test (see README.md)
2023-06-22 18:58:13,399 # There are 1 SPI devices configured for your platform.
init 0 0 4
2023-06-22 18:58:32,086 # init 0 0 4
2023-06-22 18:58:32,161 # Trying to initialize SPI_DEV(0): mode: 0, clk: 4, cs_port: 0, cs_pin: 0
2023-06-22 18:58:32,270 # (if below the program crashes with a failed assertion, then it means the configuration is not supported)
2023-06-22 18:58:32,280 # Success.
bench
2023-06-22 18:58:41,590 # bench
2023-06-22 18:58:41,644 # ### Running some benchmarks, all values in [us] ###
2023-06-22 18:58:41,682 # ### Test				Transfer time	user time
2023-06-22 18:58:41,683 # 
2023-06-22 18:58:41,755 #  1 - write 1000 times 1 byte:			28456	28640
2023-06-22 18:58:41,827 #  2 - write 1000 times 2 byte:			28184	28352
2023-06-22 18:58:42,454 #  3 - write 1000 times 100 byte:		579528	579704
2023-06-22 18:58:42,563 #  4 - write 1000 times 1 byte to register:	54080	54256
2023-06-22 18:58:42,674 #  5 - write 1000 times 2 byte to register:	56720	56888
2023-06-22 18:58:43,340 #  6 - write 1000 times 100 byte to register:	608152	608320
2023-06-22 18:58:43,412 #  7 - read 1000 times 2 byte:			28304	28480
2023-06-22 18:58:44,025 #  8 - read 1000 times 100 byte:		567408	567576
2023-06-22 18:58:44,138 #  9 - read 1000 times 2 byte from register:	56840	57016
2023-06-22 18:58:44,793 # 10 - read 1000 times 100 byte from register:	596024	596200
2023-06-22 18:58:44,868 # 11 - transfer 1000 times 2 byte:		28336	28512
2023-06-22 18:58:45,510 # 12 - transfer 1000 times 100 byte:		592128	592304
2023-06-22 18:58:45,625 # 13 - transfer 1000 times 2 byte to register:	56960	57136
2023-06-22 18:58:46,306 # 14 - transfer 1000 times 100 byte to register:620744	620920
2023-06-22 18:58:46,373 # 15 - acquire/release 1000 times:		20960	21136
2023-06-22 18:58:46,879 # -- - SUM:					3922824	3925440
2023-06-22 18:58:46,880 # 
2023-06-22 18:58:46,907 # ### All runs complete ###
> 2023-06-22 18:58:54,706 # Exiting Pyterm
```
I always wonder how fast it really goes:
- #16727
- #18374
#### tests/periph/timer
```
tests/periph/timer$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
   8968	    274	   1032	  10274	   2822	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/timer/bin/atmega1284p/tests_timer.elf
avrdude: 9242 bytes of flash written
avrdude: 9242 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 19:00:15,136 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 19:00:16,138 # 
2023-06-22 19:00:16,139 # Help: Press s to start test, r to print it is ready
s
2023-06-22 19:00:31,118 # START
2023-06-22 19:00:31,200 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 19:00:31,201 # 
2023-06-22 19:00:31,230 # Test for peripheral TIMERs
2023-06-22 19:00:31,231 # 
2023-06-22 19:00:31,251 # Available timers: 2
2023-06-22 19:00:31,252 # 
2023-06-22 19:00:31,270 # Testing TIMER_0:
2023-06-22 19:00:31,306 # TIMER_0: initialization successful
2023-06-22 19:00:31,324 # TIMER_0: stopped
2023-06-22 19:00:31,356 # TIMER_0: set channel 0 to 5000
2023-06-22 19:00:31,390 # TIMER_0: set channel 1 to 10000
2023-06-22 19:00:31,408 # TIMER_0: starting
2023-06-22 19:00:31,482 # TIMER_0: channel 0 fired at SW count     1247 - init:     1247
2023-06-22 19:00:31,547 # TIMER_0: channel 1 fired at SW count     2488 - diff:     1241
2023-06-22 19:00:31,551 # 
2023-06-22 19:00:31,568 # Testing TIMER_1:
2023-06-22 19:00:31,605 # TIMER_1: initialization successful
2023-06-22 19:00:31,622 # TIMER_1: stopped
2023-06-22 19:00:31,655 # TIMER_1: set channel 0 to 5000
2023-06-22 19:00:31,688 # TIMER_1: set channel 1 to 10000
2023-06-22 19:00:31,707 # TIMER_1: starting
2023-06-22 19:00:31,780 # TIMER_1: channel 0 fired at SW count     1247 - init:     1247
2023-06-22 19:00:31,846 # TIMER_1: channel 1 fired at SW count     2488 - diff:     1241
2023-06-22 19:00:31,849 # 
2023-06-22 19:00:31,864 # TEST SUCCEEDED
2023-06-22 19:00:31,939 # { "threads": [{ "name": "idle", "stack_size": 128, "stack_used": 86 }]}
2023-06-22 19:00:32,015 # { "threads": [{ "name": "main", "stack_size": 640, "stack_used": 120 }]}
2023-06-22 19:00:34,259 # Exiting Pyterm
```
#### tests/periph/uart
```
tests/periph/uart$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  15918	   1044	   2000	  18962	   4a12	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/uart/bin/atmega1284p/tests_uart.elf
avrdude: 16962 bytes of flash written
avrdude: 16962 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 19:01:25,894 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 19:01:26,896 # 
2023-06-22 19:01:26,898 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 19:01:26,898 # 
2023-06-22 19:01:26,899 # Manual UART driver test application
2023-06-22 19:01:26,899 # ===================================
2023-06-22 19:01:26,900 # This application is intended for testing additional UART
2023-06-22 19:01:26,900 # interfaces, that might be defined for a board. The 'primary' UART
2023-06-22 19:01:26,901 # interface is tested implicitly, as it is running the shell...
2023-06-22 19:01:26,901 # 
2023-06-22 19:01:26,902 # When receiving data on one of the additional UART interfaces, this
2023-06-22 19:01:26,902 # data will be outputted via STDIO. So the easiest way to test an 
2023-06-22 19:01:26,903 # UART interface, is to simply connect the RX with the TX pin. Then 
2023-06-22 19:01:26,904 # you can send data on that interface and you should see the data 
2023-06-22 19:01:26,904 # being printed to STDOUT
2023-06-22 19:01:26,904 # 
2023-06-22 19:01:26,904 # NOTE: all strings need to be '\n' terminated!
2023-06-22 19:01:26,904 # 
2023-06-22 19:01:26,909 # UARD_DEV(0): test uart_poweron() and uart_poweroff()  ->  [OK]
2023-06-22 19:01:26,910 # 
2023-06-22 19:01:26,921 # UART INFO:
2023-06-22 19:01:26,958 # Available devices:               2
2023-06-22 19:01:27,004 # UART used for STDIO (the shell): UART_DEV(0)
2023-06-22 19:01:27,006 # 
init 1 9600
2023-06-22 19:01:50,464 # init 1 9600
send 1 ping
2023-06-22 19:04:12,912 # send 1 ping
2023-06-22 19:04:12,934 # UART_DEV(1) TX: ping
> 2023-06-22 19:04:12,973 # Success: UART_DEV(1) RX: [ping]\n
2023-06-22 19:04:23,894 # Exiting Pyterm
````

### Issues/PRs references

Depends on PR:
- #19751


Co-authored-by: Fabian Hüßler <fabian.huessler@ml-pa.com>
Co-authored-by: Hugues Larrive <hlarrive@pm.me>
bors bot added a commit that referenced this pull request Jul 4, 2023
19752: cpu/atmega_common: checking features instead of CPU models r=benpicco a=hugueslarrive

### Contribution description
Splitted from:
- #19740

### Testing procedure
Tested on atmega8 with:
- #19755

This one probably need to be tested on others cpu.
### Tests on 1284p:
#### tests/periph/adc
```
tests/periph/adc$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  10712	    304	   1021	  12037	   2f05	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/adc/bin/atmega1284p/tests_adc.elf
avrdude: 11016 bytes of flash written
avrdude: 11016 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:44:54,846 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:44:55,848 # 

2023-06-22 18:44:55,848 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:44:55,848 # 
2023-06-22 18:44:55,849 # RIOT ADC peripheral driver test
2023-06-22 18:44:55,849 # 
2023-06-22 18:44:55,850 # This test will sample all available ADC lines once every 100ms with
2023-06-22 18:44:55,850 # a 10-bit resolution and print the sampled results to STDIO
2023-06-22 18:44:55,850 # 
2023-06-22 18:44:55,850 # 
2023-06-22 18:44:55,851 # Successfully initialized ADC_LINE(0)
2023-06-22 18:44:55,851 # Successfully initialized ADC_LINE(1)
2023-06-22 18:44:55,851 # Successfully initialized ADC_LINE(2)
2023-06-22 18:44:55,852 # Successfully initialized ADC_LINE(3)
2023-06-22 18:44:55,852 # Successfully initialized ADC_LINE(4)
2023-06-22 18:44:55,852 # Successfully initialized ADC_LINE(5)
2023-06-22 18:44:55,853 # Successfully initialized ADC_LINE(6)
2023-06-22 18:44:55,853 # Successfully initialized ADC_LINE(7)
2023-06-22 18:44:55,853 # ADC_LINE(0): 796
2023-06-22 18:44:55,854 # ADC_LINE(1): 599
2023-06-22 18:44:55,854 # ADC_LINE(2): 522
2023-06-22 18:44:55,854 # ADC_LINE(3): 485
2023-06-22 18:44:55,854 # ADC_LINE(4): 466
2023-06-22 18:44:55,854 # ADC_LINE(5): 466
2023-06-22 18:44:55,854 # ADC_LINE(6): 478
2023-06-22 18:44:55,855 # ADC_LINE(7): 501
2023-06-22 18:44:55,855 #  Exiting Pyterm
make: *** [/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/adc/../../../Makefile.include:879: term] Interrompre
```
#### tests/periph/gpio
```
tests/periph/gpio$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  17828	   2112	   1095	  21035	   522b	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/gpio/bin/atmega1284p/tests_gpio.elf
avrdude: 19940 bytes of flash written
avrdude: 19940 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:46:50,726 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:46:51,734 # This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:46:51,734 # GPIO peripheral driver test
2023-06-22 18:46:51,734 # 
2023-06-22 18:46:51,735 # In this test, pins are specified by integer port and pin numbers.
2023-06-22 18:46:51,735 # So if your platform has a pin PA01, it will be port=0 and pin=1,
2023-06-22 18:46:51,736 # PC14 would be port=2 and pin=14 etc.
2023-06-22 18:46:51,736 # 
2023-06-22 18:46:51,736 # NOTE: make sure the values you use exist on your platform! The
2023-06-22 18:46:51,738 #       behavior for not existing ports/pins is not defined!
init_out 1 5
2023-06-22 18:47:50,380 # init_out 1 5
toggle 1 5
2023-06-22 18:48:09,425 # toggle 1 5
> toggle 1 5
2023-06-22 18:48:12,477 # toggle 1 5
> 2023-06-22 18:48:15,013 # Exiting Pyterm
```
#### tests/periph/i2c
```
tests/periph/i2c$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  18634	   1288	   1215	  21137	   5291	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/i2c/bin/atmega1284p/tests_i2c.elf
avrdude: 19922 bytes of flash written
avrdude: 19922 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:50:37,434 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:50:38,437 # 
2023-06-22 18:50:38,438 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:50:38,438 # Start: Test for the low-level I2C driver
> i2c_scan 0
2023-06-22 18:51:37,661 # i2c_scan 0
2023-06-22 18:51:37,687 # Scanning I2C device 0...
2023-06-22 18:51:37,765 # addr not ack'ed = "-", addr ack'ed = "X", addr reserved = "R", error = "E"
2023-06-22 18:51:37,804 #      0 1 2 3 4 5 6 7 8 9 a b c d e f
2023-06-22 18:51:37,842 # 0x00 R R R R R R R R R R R R R R - -
2023-06-22 18:51:37,881 # 0x10 - - - - - - - - - - - - - - - -
2023-06-22 18:51:37,919 # 0x20 - - - - - - - - - - - - - - - -
2023-06-22 18:51:37,958 # 0x30 - - - - - - - - - - - - - - - -
2023-06-22 18:51:37,996 # 0x40 - - - - - - - - - - - - - - - -
2023-06-22 18:51:38,035 # 0x50 - - - - - - - - - - - - - - - -
2023-06-22 18:51:38,073 # 0x60 - - - - - - - - - - - - - - - -
2023-06-22 18:51:38,112 # 0x70 - - - - - - - - R R R R R R R R
> 2023-06-22 18:52:54,462 # Exiting Pyterm
```
#### tests/periph/pwm
```
tests/periph/pwm$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  15382	    896	   1093	  17371	   43db	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/pwm/bin/atmega1284p/tests_pwm.elf
avrdude: 16278 bytes of flash written
avrdude: 16278 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:54:32,308 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:54:33,310 # 
2023-06-22 18:54:33,312 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:54:33,312 # PWM peripheral driver test
2023-06-22 18:54:33,313 # 
> osci
2023-06-22 18:54:39,105 # osci
2023-06-22 18:54:39,106 # 
2023-06-22 18:54:39,121 # RIOT PWM test
2023-06-22 18:54:39,177 # Connect an LED or scope to PWM pins to see something.
2023-06-22 18:54:39,178 # 
2023-06-22 18:54:39,216 # Available PWM device between 0 and 1
2023-06-22 18:54:39,244 # Initialized PWM_0 @ 488Hz.
2023-06-22 18:54:39,273 # Initialized PWM_1 @ 976Hz.
2023-06-22 18:54:39,274 # 
2023-06-22 18:54:39,313 # Letting the PWM pins oscillate now...
2023-06-22 18:54:45,655 # Exiting Pyterm
```
#### tests/periph/spi
```
tests/periph/spi$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  19240	   1402	   2317	  22959	   59af	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/spi/bin/atmega1284p/tests_spi.elf
avrdude: 20642 bytes of flash written
avrdude: 20642 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 18:58:12,394 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 18:58:13,396 # 
2023-06-22 18:58:13,398 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 18:58:13,398 # Manual SPI peripheral driver test (see README.md)
2023-06-22 18:58:13,399 # There are 1 SPI devices configured for your platform.
init 0 0 4
2023-06-22 18:58:32,086 # init 0 0 4
2023-06-22 18:58:32,161 # Trying to initialize SPI_DEV(0): mode: 0, clk: 4, cs_port: 0, cs_pin: 0
2023-06-22 18:58:32,270 # (if below the program crashes with a failed assertion, then it means the configuration is not supported)
2023-06-22 18:58:32,280 # Success.
bench
2023-06-22 18:58:41,590 # bench
2023-06-22 18:58:41,644 # ### Running some benchmarks, all values in [us] ###
2023-06-22 18:58:41,682 # ### Test				Transfer time	user time
2023-06-22 18:58:41,683 # 
2023-06-22 18:58:41,755 #  1 - write 1000 times 1 byte:			28456	28640
2023-06-22 18:58:41,827 #  2 - write 1000 times 2 byte:			28184	28352
2023-06-22 18:58:42,454 #  3 - write 1000 times 100 byte:		579528	579704
2023-06-22 18:58:42,563 #  4 - write 1000 times 1 byte to register:	54080	54256
2023-06-22 18:58:42,674 #  5 - write 1000 times 2 byte to register:	56720	56888
2023-06-22 18:58:43,340 #  6 - write 1000 times 100 byte to register:	608152	608320
2023-06-22 18:58:43,412 #  7 - read 1000 times 2 byte:			28304	28480
2023-06-22 18:58:44,025 #  8 - read 1000 times 100 byte:		567408	567576
2023-06-22 18:58:44,138 #  9 - read 1000 times 2 byte from register:	56840	57016
2023-06-22 18:58:44,793 # 10 - read 1000 times 100 byte from register:	596024	596200
2023-06-22 18:58:44,868 # 11 - transfer 1000 times 2 byte:		28336	28512
2023-06-22 18:58:45,510 # 12 - transfer 1000 times 100 byte:		592128	592304
2023-06-22 18:58:45,625 # 13 - transfer 1000 times 2 byte to register:	56960	57136
2023-06-22 18:58:46,306 # 14 - transfer 1000 times 100 byte to register:620744	620920
2023-06-22 18:58:46,373 # 15 - acquire/release 1000 times:		20960	21136
2023-06-22 18:58:46,879 # -- - SUM:					3922824	3925440
2023-06-22 18:58:46,880 # 
2023-06-22 18:58:46,907 # ### All runs complete ###
> 2023-06-22 18:58:54,706 # Exiting Pyterm
```
I always wonder how fast it really goes:
- #16727
- #18374
#### tests/periph/timer
```
tests/periph/timer$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
   8968	    274	   1032	  10274	   2822	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/timer/bin/atmega1284p/tests_timer.elf
avrdude: 9242 bytes of flash written
avrdude: 9242 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 19:00:15,136 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 19:00:16,138 # 
2023-06-22 19:00:16,139 # Help: Press s to start test, r to print it is ready
s
2023-06-22 19:00:31,118 # START
2023-06-22 19:00:31,200 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 19:00:31,201 # 
2023-06-22 19:00:31,230 # Test for peripheral TIMERs
2023-06-22 19:00:31,231 # 
2023-06-22 19:00:31,251 # Available timers: 2
2023-06-22 19:00:31,252 # 
2023-06-22 19:00:31,270 # Testing TIMER_0:
2023-06-22 19:00:31,306 # TIMER_0: initialization successful
2023-06-22 19:00:31,324 # TIMER_0: stopped
2023-06-22 19:00:31,356 # TIMER_0: set channel 0 to 5000
2023-06-22 19:00:31,390 # TIMER_0: set channel 1 to 10000
2023-06-22 19:00:31,408 # TIMER_0: starting
2023-06-22 19:00:31,482 # TIMER_0: channel 0 fired at SW count     1247 - init:     1247
2023-06-22 19:00:31,547 # TIMER_0: channel 1 fired at SW count     2488 - diff:     1241
2023-06-22 19:00:31,551 # 
2023-06-22 19:00:31,568 # Testing TIMER_1:
2023-06-22 19:00:31,605 # TIMER_1: initialization successful
2023-06-22 19:00:31,622 # TIMER_1: stopped
2023-06-22 19:00:31,655 # TIMER_1: set channel 0 to 5000
2023-06-22 19:00:31,688 # TIMER_1: set channel 1 to 10000
2023-06-22 19:00:31,707 # TIMER_1: starting
2023-06-22 19:00:31,780 # TIMER_1: channel 0 fired at SW count     1247 - init:     1247
2023-06-22 19:00:31,846 # TIMER_1: channel 1 fired at SW count     2488 - diff:     1241
2023-06-22 19:00:31,849 # 
2023-06-22 19:00:31,864 # TEST SUCCEEDED
2023-06-22 19:00:31,939 # { "threads": [{ "name": "idle", "stack_size": 128, "stack_used": 86 }]}
2023-06-22 19:00:32,015 # { "threads": [{ "name": "main", "stack_size": 640, "stack_used": 120 }]}
2023-06-22 19:00:34,259 # Exiting Pyterm
```
#### tests/periph/uart
```
tests/periph/uart$ BOARD=atmega1284p make -j64 clean all | grep '^  ' && BOARD=atmega1284p AVRDUDE_PROGRAMMER='usbasp -F' make flash 2>&1 | grep -- 'of flash' && BOARD=atmega1284p PORT=/dev/ttyACM0 make term
   text	   data	    bss	    dec	    hex	filename
  15918	   1044	   2000	  18962	   4a12	/home/hugues/github/cpu_atmega_common/RIOT/tests/periph/uart/bin/atmega1284p/tests_uart.elf
avrdude: 16962 bytes of flash written
avrdude: 16962 bytes of flash verified
/home/hugues/github/cpu_atmega_common/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2023-06-22 19:01:25,894 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2023-06-22 19:01:26,896 # 
2023-06-22 19:01:26,898 # main(): This is RIOT! (Version: 2020.07-devel-15351-gc5f75c-cpu/atmega_common)
2023-06-22 19:01:26,898 # 
2023-06-22 19:01:26,899 # Manual UART driver test application
2023-06-22 19:01:26,899 # ===================================
2023-06-22 19:01:26,900 # This application is intended for testing additional UART
2023-06-22 19:01:26,900 # interfaces, that might be defined for a board. The 'primary' UART
2023-06-22 19:01:26,901 # interface is tested implicitly, as it is running the shell...
2023-06-22 19:01:26,901 # 
2023-06-22 19:01:26,902 # When receiving data on one of the additional UART interfaces, this
2023-06-22 19:01:26,902 # data will be outputted via STDIO. So the easiest way to test an 
2023-06-22 19:01:26,903 # UART interface, is to simply connect the RX with the TX pin. Then 
2023-06-22 19:01:26,904 # you can send data on that interface and you should see the data 
2023-06-22 19:01:26,904 # being printed to STDOUT
2023-06-22 19:01:26,904 # 
2023-06-22 19:01:26,904 # NOTE: all strings need to be '\n' terminated!
2023-06-22 19:01:26,904 # 
2023-06-22 19:01:26,909 # UARD_DEV(0): test uart_poweron() and uart_poweroff()  ->  [OK]
2023-06-22 19:01:26,910 # 
2023-06-22 19:01:26,921 # UART INFO:
2023-06-22 19:01:26,958 # Available devices:               2
2023-06-22 19:01:27,004 # UART used for STDIO (the shell): UART_DEV(0)
2023-06-22 19:01:27,006 # 
init 1 9600
2023-06-22 19:01:50,464 # init 1 9600
send 1 ping
2023-06-22 19:04:12,912 # send 1 ping
2023-06-22 19:04:12,934 # UART_DEV(1) TX: ping
> 2023-06-22 19:04:12,973 # Success: UART_DEV(1) RX: [ping]\n
2023-06-22 19:04:23,894 # Exiting Pyterm
````

### Issues/PRs references

Depends on PR:
- #19751


Co-authored-by: Hugues Larrive <hlarrive@pm.me>
hugueslarrive added a commit to hugueslarrive/RIOT that referenced this pull request Jul 12, 2023
tests/periph_spi: printing and testing SPI clock rates

drivers/periph_spi: change API of spi_acquire (from RIOT-OS#15904)

drivers/periph_spi: add the `bus` parameter to spi_get_*()
This was necessary for implementations where multiple
devices can have different clock sources. This broke
the macros SPI_CLK_* that were reverted to an enum.

periph/spi: adapted to the new API
Arbitrary speed support was added to all implementations
where it was missing.

2023-06:
- rebased on current master
- some backports from 2022 RIOT-OS#18374
- 3 new implementations adapted (gd32v, rpx0xx, and esp32)
- minial frequency asserts was replaced by return codes
- useless upper frequency bounding removed from many implementations
- SPI_DIV_UP was replaced by the new DIV_ROUND_UP from macros/math.h
- driver clock configuration caching was removed from implementations
  where it exists because it should be done at application level with
  this new API
- br computation was simplified for stm32 / gd32v as performace
  optimisation is no longer needed at this level and the inaccuracy
  of the fixed point arithmetic was unreliable for frequencies
  requested lower but close to resulting frequencies
hugueslarrive added a commit to hugueslarrive/RIOT that referenced this pull request Jul 12, 2023
tests/periph_spi: printing and testing SPI clock rates

drivers/periph_spi: change API of spi_acquire (from RIOT-OS#15904)

drivers/periph_spi: add the `bus` parameter to spi_get_*()
This was necessary for implementations where multiple
devices can have different clock sources. This broke
the macros SPI_CLK_* that were reverted to an enum.

periph/spi: adapted to the new API
Arbitrary speed support was added to all implementations
where it was missing.

2023-06:
- rebased on current master
- some backports from 2022 RIOT-OS#18374
- 3 new implementations adapted (gd32v, rpx0xx, and esp32)
- minial frequency asserts was replaced by return codes
- useless upper frequency bounding removed from many implementations
- SPI_DIV_UP was replaced by the new DIV_ROUND_UP from macros/math.h
- driver clock configuration caching was removed from implementations
  where it exists because it should be done at application level with
  this new API
- br computation was simplified for stm32 / gd32v as performace
  optimisation is no longer needed at this level and the inaccuracy
  of the fixed point arithmetic was unreliable for frequencies
  requested lower but close to resulting frequencies
@chrysn
Copy link
Member

chrysn commented Aug 16, 2023

Is this in a reviewable state already? Could you fix the merge conflicts and squash fixup and other "noch mal" style commits, or is there more work needed on the conceptual side anyway?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: arduino API Area: Arduino wrapper API Area: boards Area: Board ports Area: CI Area: Continuous Integration of RIOT components Area: cpu Area: CPU/MCU ports Area: doc Area: Documentation Area: drivers Area: Device drivers Area: pkg Area: External package ports Area: sys Area: System Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms Platform: AVR Platform: This PR/issue effects AVR-based platforms Platform: ESP Platform: This PR/issue effects ESP-based platforms Platform: MSP Platform: This PR/issue effects MSP-based platforms Platform: native Platform: This PR/issue effects the native platform Platform: RISC-V Platform: This PR/issue effects RISC-V-based platforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants