This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SPI slave configuration & overlay

Hi,

I am using BL653 dvk to write an application for SPI,

In my prj.conf, I added below parameters:

CONFIG_SPI=y
CONFIG_SPI_ASYNC=y

Now when I am debugging SPI master code, execution enters the file "spi_nrfx_spi.c", and transfers data & rest is fine.

But when I try to use SPI slave configuration, execution enters the same file "spi_nrfx_spi.c", into the function:

static inline nrf_spi_bit_order_t get_nrf_spi_bit_order(uint16_t operation)
{
	if (operation & SPI_TRANSFER_LSB) {
		return NRF_SPI_BIT_ORDER_LSB_FIRST;
	} else {
		return NRF_SPI_BIT_ORDER_MSB_FIRST;
	}
}

static int configure(const struct device *dev,
		     const struct spi_config *spi_cfg)
{
	struct spi_nrfx_data *dev_data = get_dev_data(dev);
	const struct spi_nrfx_config *dev_config = get_dev_config(dev);
	struct spi_context *ctx = &dev_data->ctx;
	nrfx_spi_config_t config;
	nrfx_err_t result;

	if (dev_data->initialized && spi_context_configured(ctx, spi_cfg)) {
		/* Already configured. No need to do it again. */
		return 0;
	}

	if (SPI_OP_MODE_GET(spi_cfg->operation) != SPI_OP_MODE_MASTER) {
		LOG_ERR("Slave mode is not supported on %s", dev->name);
		return -EINVAL;
	}

& logs an error saying "Slave mode is not supported on".

I understand that I need to make changes to prj.conf &  also write an overlay file for bl653.

1. But I do not know how to write overlay for this case, I am using SPI_1 and wrote an overlay as:

&spi1 {
	compatible = "nordic,nrf-spis";
	status = "okay";
	sck-pin = <41>;
	mosi-pin = <40>;
	miso-pin = <4>;
	cs-gpios = <&gpio1 23 0>;
};

But is still not working,

2. Kindly also help me on what changes to be done in prj.conf to have SPI_0 in slave mode.



Thanks,

Related