We are using ESP32C3 module. We have tested the SPI master example code, it was working fine. Now I want to test the SPI slave communication but I didn't find any SPI slave example in Arduino IDE 2.2.1. Can anyone help me.
The lack of SS handling was already mentioned in a comment.
When to send a byte? If the slave is supposed to transfer the first byte in the first transfer then that byte has to be placed into SPDR before or just when the slave is selected. Subsequent bytes of a multi-byte output have to be put into SPDR in the ISR, after reading the preceding input byte from SPDR. The main loop can not place any other bytes into SPDR until the slave is deselected whereupon the transfer ends.