1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

79 Commits

Author SHA1 Message Date
Marian Buschsieweke
a51d4bd7d9
tests/periph/selftest_shield: fix logic to enable UART test
We cannot use the D0/D1 UART if it is also used for STDIO. However,
the logic did not take into account whether `stdio_uart` was used at
all. This fixes the issue.
2024-11-26 13:35:02 +01:00
Marian Buschsieweke
e7ea668a7f
tests/periph/selftest_shield: release UART after test
Calling `uart_poweroff()` when done with the UART test allows sharing
the underlying hardware e.g. to provide other peripheral interfaces.
One example of this would be the SERCOM3 on the Adafruit Metro M4
Express that is used to provide UART on D1/D0 and SPI on D11/D12/D13.
2024-11-26 13:34:54 +01:00
Benjamin Valentin
8ed05a68e1 tests/periph/pm: print some output on alarm 2024-11-21 14:55:57 +01:00
Marian Buschsieweke
d7d6a3653d
Merge pull request #21006 from maribu/tests/periph/selftest_shield/fix-timer_init
tests/periph/selftest_shield: fix invalid calls to timer_init() + GPIO IRQ tests
2024-11-21 05:44:12 +00:00
Marian Buschsieweke
fd30434921
tests/periph/selftest_shield: fix GPIO IRQ testing
The GPIO IRQ tests had a side-effect that IRQs remained configured after
the test case was complete. This caused stray IRQs to trigger on
SAM0 MCUs and they consequently (and incorrectly) failed the test.
2024-11-19 22:25:20 +01:00
Marian Buschsieweke
d1c4b455fb
tests/periph/selftest_shield: fix invalid calls to timer_init()
Calling `timer_init()` with unsupported frequencies on some MCUs just
selects the closest possible frequency. But e.g. on SAM0, using an
unsupported frequency will cause `timer_init()` to fail; which probably
is the better option.

However, a failing calling to `timer_init()` results in a test failure.
This is now worked around by using timer_query_freq() to select a
suitable timer frequency that is supported.
2024-11-19 22:25:15 +01:00
Mikolai Gütschow
d3133c5acc
tests/periph/uart: wait 1ms for HW to trigger RX irq during self-test 2024-11-19 14:47:02 +01:00
Mikolai Gütschow
a0164ff58c
tests/periph/uart: improve error handling and reporting 2024-11-19 14:46:50 +01:00
Marian Buschsieweke
562f1f0210
tests: always use interactive sync for timing tests
Use `test_utils_interactive_sync` for the following tests explicitly:

- tests/periph/timer_periodic
- tests/sys/posix_sleep

This is needed for accurate timestamping of the stdio received. The
tests will not pass without on `native` / `native64`.
2024-11-13 12:37:37 +01:00
Marian Buschsieweke
af61cf40e3
tests/periph/gpio_ll: add delays to test_switch_dir()
In all other tests we added a delay after writing to the output buffer
of GPIO A before expected the input buffer of GPIO B (connected to A)
to reflect the change, but not in test_switch_dir().

This adds the delay here as well to make the test more robust in regard
to GPIO peripherals that react not as fast as the CPU can query them.
2024-08-08 16:22:36 +02:00
Marian Buschsieweke
a6b459eff3
drivers/periph/gpio_ll: change gpio_ll_switch_dir API
It turns out that the feature to switch the GPIO direction quickly
is not only a way to emulate open drain / open source mode for less
sophisticated GPIO peripherals that do not natively support it.
It also enables tri-state output (push-pull high, push-pull low,
high impedance), which is useful e.g. for driven charlieplexed LEDs
quickly.

This changes the API by introducing a `gpio_ll_prepare_switch_dir()`
function that prepares the value used to identify which pins should
be switched to input or to output mode. This is useful for GPIO
peripherals in which the GPIO mode register does not allocate one bit
per pin (so that only the direction is given there), such as the one
for STM32. This allows an STM32 implementation in which preparing the
bitmask needed to modify the direction of pins is not trivial.
2024-08-08 16:22:36 +02:00
Marian Buschsieweke
422042bd00
drivers/periph_gpio_ll_irq: make support for both edges optional
The assumption that every MCU has this feature turned out wrong. Hence,
add a feature to allow testing for support of edge triggered IRQs on
both flanks.
2024-08-02 13:41:36 +02:00
Marian Buschsieweke
84a4399135
tests/periph/gpio_ll: fix randomly failing test
A test intended to ensure that a configuration toggling the direction
of a GPIO two times restores the original configuration not only
compared the configuration at the two points in time, but also the
value of the input buffer. Since a floating input reads back random
values when not externally driven, the test was actually randomly
failing. Apparently I got lucky before consistently and this never
triggered until now.

This now clears the input value from both the configuration reported
before and after toggling the direction twice and should now indeed
succeed consistently.
2024-08-02 09:55:24 +02:00
Marian Buschsieweke
36e8526046
drivers/periph_gpio_ll: change API to access GPIO ports
The API was based on the assumption that GPIO ports are mapped in memory
sanely, so that a `GPIO_PORT(num)` macro would work allow for constant
folding when `num` is known and still be efficient when it is not.

Some MCUs, however, will need a look up tables to efficiently translate
GPIO port numbers to the port's base address. This will prevent the use
of such a `GPIO_PORT(num)` macro in constant initializers.

As a result, we rather provide `GPIO_PORT_0`, `GPIO_PORT_1`, etc. macros
for each GPIO port present (regardless of MCU naming scheme), as well as
`GPIO_PORT_A`, `GPIO_PORT_B`, etc. macros if (and only if) the MCU port
naming scheme uses letters rather than numbers.

These can be defined as macros to the peripheral base address even when
those are randomly mapped into the address space. In addition, a C
function `gpio_port()` replaces the role of the `GPIO_PORT()` and
`gpio_port_num()` the `GPIO_PORT_NUM()` macro. Those functions will
still be implemented as efficient as possible and will allow constant
folding where it was formerly possible. Hence, there is no downside for
MCUs with sane peripheral memory mapping, but it is highly beneficial
for the crazy ones.

There are also two benefits for the non-crazy MCUs:
1. We can now test for valid port numbers with `#ifdef GPIO_PORT_<NUM>`
    - This directly benefits the test in `tests/periph/gpio_ll`, which
      can now provide a valid GPIO port for each and every board
    - Writing to invalid memory mapped I/O addresses was treated as
      triggering undefined behavior by the compiler and used as a
      optimization opportunity
2. We can now detect at compile time if the naming scheme of the MCU
   uses letters or numbers, and produce more user friendly output.
    - This is directly applied in the test app
2024-08-02 09:55:24 +02:00
fabian18
772ccb9954
Merge pull request #20177 from fabian18/pr/test_periph_flashpage_raw
tests/periph/flashpage: make mtd_raw command write bytes instead of ASCII
2024-06-10 08:40:01 +00:00
benpicco
251ea7f75a
Merge pull request #20687 from benpicco/nanocoap_fs
nanocoap_fs: add nanoCoAP as VFS backend (remote CoAP fs)
2024-05-29 15:00:24 +00:00
Benjamin Valentin
4ff877d239 tests/periph/hwrng: LIMIT -> NUM_BYTES 2024-05-29 14:20:49 +02:00
Marian Buschsieweke
29c5452861
tests/periph/uart: clean up and add power off cmd
This updates the test app to use the XFA shell interface and ztimer.
In addition, a shell command to power off the UART interface is added
to e.g. confirm that power consumption indeed goes down.
2024-05-07 14:45:49 +02:00
Fabian Hüßler
629c0c2f1a tests/periph/flashpage: make mtd_raw write bytes instead of ASCII 2024-05-06 17:48:00 +02:00
Teufelchen
5bc8ca5318
Merge pull request #18093 from Ollrogge/remove_flashpage_free_funcs
periph/flashpage: remove deprecated flashpage_*_free functions
2024-04-16 08:47:11 +00:00
Marian Buschsieweke
189bb29f76
tests/periph/timer: also test for idx out of range
Also test that `timer_query_freqs()` for an index out of range
does return 0, as stated by the doc.
2024-04-14 20:22:38 +02:00
Ollrogge
10c987eb66 Revert "periph/flashpage: extend API"
This reverts commit 72d47013dd.
2024-04-04 17:57:40 +02:00
MrKevinWeiss
20fcb1d99d
tests/*: Remove TEST_KCONFIG symbols 2024-03-27 10:28:14 +01:00
MrKevinWeiss
e0fdc3c16c
*Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
MrKevinWeiss
7a68fb0d5e
*Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
MrKevinWeiss
db965c9491
*app.config.test*: Remove kconfig dep files 2024-03-26 14:53:35 +01:00
Teufelchen
5f0dc5921c
Merge pull request #20281 from keestux/fix/refactor-tests-periph-uart
Refactor tests periph uart
2024-03-18 12:42:23 +00:00
chrysn
756a384442 makefiles, treewide: Remove MCU variable 2024-02-18 20:46:09 +01:00
Marian Buschsieweke
1fcf778526
tests/periph/spi_dma: fix Makefile.ci
The `Makefile.ci` was intended to be read and generated by command
line utilities and the contents should look exactly like this:

```
BOARD_INSUFFICIENT_MEMORY += \
    board_a \
    board_b \
    ... \
    #
```

No fancy schmancy, no `include`, no nothing. This fixes the format.
2024-02-12 15:57:43 +01:00
benpicco
4d9e8a8dde
Merge pull request #20335 from fzi-haxel/pr/native64-board
native64: Separate board for 64-bit native
2024-02-05 22:58:02 +00:00
Frederik Haxel
5ed0bafc92 examples, tests: Changes for the native64 board
- Adapted build system and test checks for the native boards to include native64
- Added `native64` to the same tests as `native`
2024-02-05 22:02:14 +01:00
Marian Buschsieweke
8aab69e93d
tests/periph/gpio_ll: Test gpio_ll_switch_dir 2024-02-05 10:56:16 +01:00
Marian Buschsieweke
8bf61336a2
Merge pull request #20290 from maribu/drivers/periph/gpio_ll/features
drivers/periph_gpio_ll: Fix GPIO_DISCONNECT handling and add compile time feature checks
2024-02-05 07:30:54 +00:00
Frederik Haxel
7a1c099e7b tests: 64 bit compatibility
Fixed compilation errors. Mostly DEBUG/printf formatting and void pointer casting.

Other changes are:
* net/gnrc_sixlowpan_frag_*: Generalized packet size calculation
* cpu/native_backtrace: Reduced required backtrace size to 3 for 64-bit
* periph/flashpage: Simplified test
* unittests/tests-pktbuf: Generalized alignment
* sys/architecture: Extended test for 64-bit
2024-01-30 09:31:00 +01:00
Marian Buschsieweke
447493e719
tests/periph/gpio_ll: test for features matching
Test that features implemented match the features claimed to be
supported.
2024-01-23 15:03:34 +01:00
Marian Buschsieweke
a1bb536dbd
tests/periph/gpio_ll: structure code a bit
When it is difficult to navigate a function, it is overdue to split
it up :D

Also, no need to test for feature `gpio_ll_irq` in `test_irq()` *and*
before calling `test_irq()`.
2024-01-23 15:03:34 +01:00
Marian Buschsieweke
3159578cbe
Merge pull request #20189 from maribu/cpu/sam0_common/periph_gpio_ll
cpu/sam0_common: implement periph_gpio_ll and periph_gpio_ll_irq
2024-01-22 15:39:26 +00:00
Marian Buschsieweke
00cb9668ae
drivers/periph_gpio_ll: Improve documentation
The documentation on the state `GPIO_DISCONNECT` was a bit vague. The
API doc said it should disconnect the GPIO from all peripherals, the
test also tested them for being electrically disconnected.

The documentation in both the test and the API is extended to point out
that a GPIO indeed SHOULD be in high impedance state, but that user
MUST NOT expect that this requested is honored by every implementation
and for every GPIO pin.

In the test it is also pointed out that failing the test for a GPIO
in the `GPIO_DISCONNECT` state being electrically disconnected is for
some pins expected, and that the test should be just run again with
different GPIOs. The test intentionally tests for a feature not provided
by every GPIO pin rather than warning on a failure: The effort to just
flash and run the test again with different GPIOs is relatively low, but
it does confirm correct behavior of the API.
2024-01-22 10:28:35 +01:00
Marian Buschsieweke
891c627c48
tests/periph/gpio_ll: make test more robust
When using level triggered IRQs, a new IRQ flag may already have been
set while the IRQ callback is executed. Hence, we cannot just toggle
the output, but rather should drive it low/high for a level trigger on
high/low.

Also test `gpio_ll_query_conf()` for the disconnected state as well.
2024-01-21 18:27:35 +01:00
Marian Buschsieweke
922276296e
drivers/periph/gpio_ll: pass gpio_conf_t by value
Now that `gpio_conf_t` is on all implemented platforms no larger than
a register, we can more efficiently pass it by value rather than via
pointer.
2024-01-21 09:19:08 +01:00
Marian Buschsieweke
718f277642
tests/periph/gpio_ll: optimize RAM usage on AVR 2024-01-21 08:38:48 +01:00
Marian Buschsieweke
84800fdb5d
tests/periph/gpio_ll: Use better default pin config
The default pin config is only a place holder anyway. But if it is
invalid at least on AVR most of the firmware is considered unreachable.
This updates the default GPIO config to something that should look
plausible to the compiler for all MCUs supporting GPIO LL, so that
ROM and RAM size in the CI start making sense.
2024-01-21 08:38:47 +01:00
Marian Buschsieweke
2ee949e676
tests/periph/gpio_ll: fix output on LOW_ROM_BOARDS
Printing the newline after the state was printed is not optional.

This also moves the call to `gpio_ll_print_conf()` and `puts("")` to
a static function to safe enough ROM so that this still can be flashed
on `nucleo-l011k4`.
2024-01-21 08:38:47 +01:00
Kees Bakker
790bd989f7 tests/periph/uart: redo implementation of changing eol 2024-01-20 21:48:19 +01:00
Kees Bakker
e95211eb14 tests/periph/uart: print incoming CR as \r
Also the LF is display inside the [...].
Now it is more obvious what characters came in on the RX port of the UART.
Here is an example:

2024-01-20 20:57:41,368 # send 1 ati
2024-01-20 20:57:41,368 # UART_DEV(1) TX: ati
> 2024-01-20 20:57:41,393 # Success: UART_DEV(1) RX: [ati\r\r\n]
2024-01-20 20:57:41,398 # Success: UART_DEV(1) RX: [SARA-N310-00X-00\r\n]
2024-01-20 20:57:41,399 # Success: UART_DEV(1) RX: [\r\n]
2024-01-20 20:57:41,399 # Success: UART_DEV(1) RX: [OK\r\n]
2024-01-20 21:43:46 +01:00
Marian Buschsieweke
f9aab53e16
tests/periph/uart_locate_pins: new test/utility app
This application uses `soft_uart` to bit-bang the name of a number of
configured GPIO pins via said pins at 9600 Bd. This way attaching an
USB UART bridge to one pin at a time easily reveals which MCU GPIO
pin a given pin on a board corresponds to. This is useful when no
schematic and no silkscreen labeling is available, or when the
information is misleading or outright incorrect (looking at the
E180-ZG120B-TB).
2024-01-18 10:42:13 +01:00
Benjamin Valentin
d8cc2ac24f tests: don't manually select native term 2023-12-23 20:27:47 +01:00
Oleg Hahm
c0e71b0592
Merge pull request #20172 from OlegHahm/pr/pyterm_native_pipe
pyterm: add native support
2023-12-21 23:08:22 +00:00
Frederik Haxel
fa0cf05d0a tests: Use size_t print format specifier
Co-authored-by: Marian Buschsieweke <marian.buschsieweke@posteo.net>
2023-12-21 12:02:37 +01:00
Oleg Hahm
99ff9bad03 examples: tests: update native TERMFLAGS
Updating the Makefiles for example and test applications to set the
TERMFLAGS correctly for native.
2023-12-18 13:44:20 +01:00