Configure GPIO in devicetree as "nordic,nrf-gpio" and not as "gpio-leds"

I would like to configure GPIOs as compatible = "nordic,nrf-gpio"; in devicetree file. 

I did check this topic, but I think that this kind of configuration defeats the whole purpose of .dts file.

I did not find any example for compatible = "nordic,nrf-gpio"; but only for compatible = "gpio-leds";.

 

The Zephyr documentation for nordic,nrf-gpio doesn't help me much.


Could you please provide some example?


/ {
    boardGpios {
        compatible = "nordic,nrf-gpio";
        output1: output1 {
            ...
        }
    };
};

Parents Reply Children
  • For setting up general GPIO's (not using the GPIOTE module) I would recommend using the gpio-keys node, as explained in this case.

    Is there some documentation when GPIO is used instead of GPIOTE?

    I recently made my own little example showing how to add an overlay with additional GPIO's for the nRF5340. It should work fine on other Nordic boards if you just rename the overlay file:

    blinky_w_gpio_overlay.zip

    Thank you for the example, but I don't have problem using gpio-keys nor gpio-leds.

    I would like to use something like st,stm32-pinctrl instead of gpio-keys or gpio-leds.

  • Hi 

    Can you give me a bit of information regarding what you are planning to use the GPIO pins for?

    The purpose of the GPIOTE module is to connect pins into the task/event system of the nRF devices, which allow you to do things such as automatically toggling a pin based on a timer, or trigger a capture in a timer when a pin toggles. Another example is having a pin toggle high every time the RADIO module is sending a packet. 

    Best regards
    Torbjørn

  • For current project I am using GPIOs only for simple LED toggling, turning ON and OFF some MOSFET, reading some input pins... Nothing that can't be done with gpio-keys and gpio-leds, but I don't want to.

    It is bothering me because I don't know if gpio-keys and gpio-leds are using GPIO or GPIOTE (for current project I don't need GPIOTE).

    I would like to have an option to select when to use GPIO and when GPIOTE.
    Could something like st,stm32-pinctrl be created for nordic?

  • Hi 

    bzgec said:
    It is bothering me because I don't know if gpio-keys and gpio-leds are using GPIO or GPIOTE (for current project I don't need GPIOTE).

    They are using GPIO, not GPIOTE. 

    Correction: Whenever you use the GPIO_INT_EDGE flag on an input pin it will use a dedicated GPIOTE IN channel. If this flag is not used you will only use GPIO. 

    GPIOTE OUT channels are only supported by using the nrfx_gpiote driver directly. 

    bzgec said:
    I would like to have an option to select when to use GPIO and when GPIOTE.
    Could something like st,stm32-pinctrl be created for nordic?

    This was designed for the ST devices, which has a different GPIO architecture than we have in the nRF devices. 

    In other words it doesn't make sense to implement a similar driver for Nordic. 

    The higher level Zephyr API's are still similar, so that you can write code that will run on either ST or Nordic (or any other supported MCU's). 
    It is just the DTS configuration that will have to be different. 

    Best regards
    Torbjørn

Related