Hello Everyone,
I am using ESP32C3 module and the tool is ESPRESSIF IDE(v5.1.1). I am trying to connect ESP32C3 as a SPI Slave mode with the master.
I tried to enable the SPI slave interrupt using esp_intr_enable_source(ETS_SPI2_INTR_SOURCE) and whenever any byte I receive from the master, control goes to receive ISR and do some task for that I am using esp_intr_alloc(ETS_SPI2_INTR_SOURCE, ESP_INTR_FLAG_SHARED, spi_slave_isr_handler, &t, &SPI_intr) but I am getting error like ESP_ERR_NOT_FOUND.
I have mentioned the related code below, Please help me to solve this error.
Thanks & Regards,
D. Vineetha.
ESP_ERR_NOT_FOUND error in ESP_INTR_ALLOC() function
ESP_ERR_NOT_FOUND error in ESP_INTR_ALLOC() function
- Attachments
-
- Screenshot 2023-12-02 143516.png (40.74 KiB) Viewed 8050 times
-
- Screenshot 2023-12-02 143503.png (57.42 KiB) Viewed 8050 times
-
- Screenshot 2023-12-02 143448.png (61.41 KiB) Viewed 8050 times
-
- Posts: 1706
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: ESP_ERR_NOT_FOUND error in ESP_INTR_ALLOC() function
That's because the SPI slave driver internally does the interrupt handling for you. After the driver is initialized, the corresponding SPI interrupt is already 'allocated' to the driver's own ISR.I am using esp_intr_alloc(ETS_SPI2_INTR_SOURCE, ESP_INTR_FLAG_SHARED, spi_slave_isr_handler, &t, &SPI_intr) but I am getting error like ESP_ERR_NOT_FOUND.
Re: ESP_ERR_NOT_FOUND error in ESP_INTR_ALLOC() function
Thank you for the reply,
As per your suggestion we are tried this but SPI slave was not receiving any data from the master in interrupt mode.
Please can you explain briefly how the SPI slave driver internally does the interrupt handling.
Thanks & Regards,
D. Vineetha.
As per your suggestion we are tried this but SPI slave was not receiving any data from the master in interrupt mode.
Please can you explain briefly how the SPI slave driver internally does the interrupt handling.
Thanks & Regards,
D. Vineetha.
-
- Posts: 1706
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: ESP_ERR_NOT_FOUND error in ESP_INTR_ALLOC() function
As per the example, you need to prepare and enqueue an SPI transaction with the driver. This transaction will sit there waiting for the master to start communication and when it is done you receive the post_trans_cb callback.
Re: ESP_ERR_NOT_FOUND error in ESP_INTR_ALLOC() function
Thanks for the response,
"you need to prepare and enqueue an SPI transaction with the driver"
my bad, I didn't got what you mean by enqueue an SPI transaction with the driver, can you explain what does it mean and how to do it.
I understood that in the example which you have shared we need to call the SPI_SLAVE _TRANSMIT() function for every transmission and receive from the slave. I don't want to call SPI_SLAVE _TRANSMIT() in main loop as it is waiting until data is sent from the master.
my requirement is some process will be running in the main while loop continuously and whenever a data of some number of bytes(ex. 3 bytes) from master is sent the execution in the slave should go to the SPI ISR where I can collect the data sent from the master. After executing the ISR the execution should go back to the main while loop and this process should repeat. This should happen independent of handshake pin, can you share if there is any example available related to do this or else can you guide me how to do this.
"you need to prepare and enqueue an SPI transaction with the driver"
my bad, I didn't got what you mean by enqueue an SPI transaction with the driver, can you explain what does it mean and how to do it.
I understood that in the example which you have shared we need to call the SPI_SLAVE _TRANSMIT() function for every transmission and receive from the slave. I don't want to call SPI_SLAVE _TRANSMIT() in main loop as it is waiting until data is sent from the master.
my requirement is some process will be running in the main while loop continuously and whenever a data of some number of bytes(ex. 3 bytes) from master is sent the execution in the slave should go to the SPI ISR where I can collect the data sent from the master. After executing the ISR the execution should go back to the main while loop and this process should repeat. This should happen independent of handshake pin, can you share if there is any example available related to do this or else can you guide me how to do this.
-
- Posts: 1706
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: ESP_ERR_NOT_FOUND error in ESP_INTR_ALLOC() function
See spi_slave_queue_trans().
Also, consider creating one or more tasks to run concurrently to your main loop.
Also, consider creating one or more tasks to run concurrently to your main loop.
Re: ESP_ERR_NOT_FOUND error in ESP_INTR_ALLOC() function
Hello,
Thanks for the response,
Actually I don't want to use rtos, the whole thing I explained in my previous reply should work in bare metal. Is that possible.
Please help me in this regard.
Thanks & regards,
D. Vineetha
Thanks for the response,
Actually I don't want to use rtos, the whole thing I explained in my previous reply should work in bare metal. Is that possible.
Please help me in this regard.
Thanks & regards,
D. Vineetha
Who is online
Users browsing this forum: Baidu [Spider] and 76 guests