Skip to content

Commit 9de69aa

Browse files
Adam Wojasinskifabiobaltieri
authored andcommitted
drivers: spi: spi_nrfx_spi: Add CPOL handling on SCK pin
Pin state after SPI deinitialization is based on pinctrl configuration. On the other hand, CPOL is set during runtime. When the SPI instance is disabled GPIO takes control over SCK and drives it to state set by pinctrl driver. This might causes an invalid SCK state when the transaction is configured with CPOL (Clock Polarity). To address this issue, a patch was introduced to the SPI driver. Now, when a SPI instance is configured with CPOL, the driver is setting in the runtime the correct state of the SCK pin. Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
1 parent 315dd0f commit 9de69aa

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/spi/spi_nrfx_spi.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ static int configure(const struct device *dev,
133133
config.mode = get_nrf_spi_mode(spi_cfg->operation);
134134
config.bit_order = get_nrf_spi_bit_order(spi_cfg->operation);
135135

136+
nrf_gpio_pin_write(nrf_spi_sck_pin_get(dev_config->spi.p_reg),
137+
spi_cfg->operation & SPI_MODE_CPOL ? 1 : 0);
138+
136139
if (dev_data->initialized) {
137140
nrfx_spi_uninit(&dev_config->spi);
138141
dev_data->initialized = false;

0 commit comments

Comments
 (0)