I have a working project developed against nRF Connect SDK version 1.6.1. I am attempting to update to version 1.9.1 nRF Connect SDK as a stepping stone to v2.0.0. Upon further investigation, I determined that the reason that the device is not working against 1.9.1 is because the SPI CS polarity is incorrect. Of course, I did not change my code that configures the SPI, so I am looking for some guidance. I tried changing .gpio_dt_flags from GPIO_ACTIVE_LOW to GPIO_ACTIVE_HIGH (even though I want ACTIVE_LOW), but it didn't make any difference. Here are code and dts snippets:
static const struct spi_config spi_cfg = {
.operation = SPI_WORD_SET(8) | SPI_TRANSFER_MSB,
.frequency = 4000000,
.slave = 0,
.cs = &(struct spi_cs_control) {
.gpio_dev = DEVICE_DT_GET(DT_NODELABEL(gpio0)),
.delay = 2,
.gpio_pin = 18,
.gpio_dt_flags = GPIO_ACTIVE_LOW
},
};
int spi_send(const struct device *spi,
const uint8_t *data, size_t len)
{
tx.buf = (void*)data;
tx.len = len;
return spi_write(spi, &spi_cfg, &tx_bufs);
}
&spi1 {
compatible = "nordic,nrf-spi";
status = "okay";
sck-pin = <16>;
mosi-pin = <15>;
miso-pin = <14>;
};