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

drivers: pinctrl: nrf: Add support for setting initial pin state #61280

Commits on Aug 8, 2023

  1. drivers: pinctrl: nrf: Add support for setting initial pin state

    The nRF pinctrl driver did not allow for setting the initial state
    of the pins. This issue specifically affected the SPI SPIM driver,
    which caused an invalid SCK state when configured with CPOL
    (Clock Polarity).
    
    With the introduction of the power-optimized SPIM driver,
    it disables the peripheral instance once the transfer is completed.
    As a result, the GPIO takes control over the SCK pin and drive it
    based on its own configuration. However, the pinctrl configures pins
    for SPIM incorrectly when CPOL is set. This causes that GPIO
    sets the SCK pin to 0 instead of the expected 1 when idle after SPI
    transaction is finished.
    
    To address this issue, a patch was introduced.
    Now, when an SPIM instance is configured with CPOL,
    the pinctrl node must have the 'output-high' property set
    to ensure the correct initial pin state.
    
    Example devicetree fragment:
    
        spi1_default: spi1_default {
            group1 {
                psels = <NRF_PSEL(SPIM_SCK, 0, 5)>;
                output-high;
            };
            group2 {
                psels = <NRF_PSEL(SPIM_MISO, 0, 6)>,
                        <NRF_PSEL(SPIM_MOSI, 0, 7)>;
            };
        };
    
    Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
    Adam Wojasinski committed Aug 8, 2023
    Configuration menu
    Copy the full SHA
    0d38e77 View commit details
    Browse the repository at this point in the history