Page 1 of 1

How to generate an interrupt with SPI SS input on SPI Slave

Posted: Thu Oct 09, 2025 7:45 pm
by sidprice
Using ESPIDF extension in VSCode.

I have an application where I need and interrupt when the SPI SS signal of a SPI slave is asserted.

Searching suggests that setting the SS pin to -1 is the way to go to achieve this:

Code: Select all

	spi_slave_interface_config_t slvcfg = {
		.mode = 1,
		.spics_io_num = -1,
		.queue_size = 1,
		.flags = 0,
		.post_setup_cb = userPostSetupCallback,
		.post_trans_cb = userTransactionCallback,
	};
Then the SS GPIO is set up as one would expect for a negative edge interrupt:

Code: Select all

	gpio_config_t gpio_configuration;
	memset(&gpio_configuration, 0, sizeof(gpio_configuration));
	gpio_configuration.intr_type = GPIO_INTR_NEGEDGE;
	gpio_configuration.pin_bit_mask = (1ULL << SPI_SS_PIN);
	gpio_configuration.mode = GPIO_MODE_INPUT;
	gpio_configuration.pull_down_en = GPIO_PULLDOWN_DISABLE;
	gpio_configuration.pull_up_en = GPIO_PULLUP_DISABLE;
	err = gpio_config(&gpio_configuration);
However, this does not appear to work, the slave driver calls esp_rom_gpio_connect_in_signal with the signal_idx parameter of '0'. Subsequently this causes an exception.

So, how does one achieve the goal of getting an interrupt from the SPI SS signal?
Sid