diff --git a/drivers/include/periph/gpio_ll.h b/drivers/include/periph/gpio_ll.h index e8690f002f..280b6f3cc2 100644 --- a/drivers/include/periph/gpio_ll.h +++ b/drivers/include/periph/gpio_ll.h @@ -176,7 +176,13 @@ typedef enum { * @brief Disconnect pin from all peripherals * * The implementation should aim to reduce power consumption of the pin - * when this state is entered, if this is feasible. + * when this state is entered, if this is feasible. For pins where it is + * possible and sensible, this should electrically disconnect them + * (high impedance). + * + * @warning If a given pin will not only be disconnected from peripherals + * but also enter an high impedance state is implementation + * defined and may differ from pin to pin. * * @note Pull resistors can still be requested in this mode. This can be * useful e.g. for keeping an UART TXD pin from emitting noise diff --git a/tests/periph/gpio_ll/README.md b/tests/periph/gpio_ll/README.md index f2ed1539cb..28ec025f54 100644 --- a/tests/periph/gpio_ll/README.md +++ b/tests/periph/gpio_ll/README.md @@ -19,3 +19,11 @@ GPIO port is set via `PORT_IN`. Both `PORT_IN == PORT_OUT` and `PORT_IN != PORT_OUT` is valid. The input pin number within `PORT_IN` are set via `PIN_IN_0` and `PIN_IN_1`. `PIN_IN_0` has to be wired to `PIN_OUT_0`, and `PIN_IN_1` to `PIN_OUT_1`. + +## Expected Failures + +Implementations are allowed to not electrically disconnect GPIO pins in state +`GPIO_DISCONNECT`. The test will however test for pins to be electrically +disconnected. For every MCU supported by GPIO LL so far at least some pins can +be electrically disconnected. You might need to change the GPIO pins tested +if the test for disconnected GPIOs being also electrically disconnected. diff --git a/tests/periph/gpio_ll/main.c b/tests/periph/gpio_ll/main.c index 03a8423011..9cc9ce42c2 100644 --- a/tests/periph/gpio_ll/main.c +++ b/tests/periph/gpio_ll/main.c @@ -470,6 +470,18 @@ static void test_gpio_ll_init(void) is_supported = !(gpio_ll_read(port_in) & (1ULL << PIN_IN_0)); printf_optional("Output can indeed be pulled LOW: %s\n", noyes[is_supported]); + /* If this expects fails, try with a different pin. Often pins intended + * for use as UART, I2C, or hardware /CS on SPI cannot be configured + * as high impedance and will instead remain HIGH. An implementation + * is free to work around this e.g. by configuring these pins as + * input with the input buffer disabled or as analog input without + * routing them to the ADC, or just to restore the reset configuration + * and have them high. + * + * Even though this can fail on some pins, the `expect()` here should + * remain. Just test with a different pin that can be configured as + * high impedance to confirm that this functionality does work where + * supported. */ expect(is_supported); } else { @@ -482,6 +494,10 @@ static void test_gpio_ll_init(void) is_supported = (gpio_ll_read(port_in) & (1ULL << PIN_IN_0)); printf_optional("Output can indeed be pulled HIGH: %s\n", noyes[is_supported]); + /* May also fail for some pins, if the reset configuration of the + * pin results in LOW output. Do not comment this out, but rather + * try with a different pin to confirm that this functionality does + * work where supported */ expect(is_supported); } else {