esp32-s3 polling for SPI transfer done

Slinisa
Posts: 32
Joined: Sat Oct 07, 2023 8:21 am

esp32-s3 polling for SPI transfer done

Postby Slinisa » Sat Oct 12, 2024 7:27 pm

At the moment I'm initializing SPI slave to use a callback function when SPI transfer is finished and it works fine, except for the fact that it sometimes occurres in inconvenient times. Because of that, I would prefer to check myself if the transfer is finished and then do the appropriate tasks. My question is if this is possible, and if it is, how is it done?

MicroController
Posts: 1729
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: esp32-s3 polling for SPI transfer done

Postby MicroController » Sat Oct 12, 2024 8:55 pm

A common pattern is to have the callback function send a 'message' to a task, which the task can then receive and process when it is 'convenient'.
For this 'messaging', you can use a FreeRTOS queue, semaphore, or direct-to-task notification.

Slinisa
Posts: 32
Joined: Sat Oct 07, 2023 8:21 am

Re: esp32-s3 polling for SPI transfer done

Postby Slinisa » Sun Oct 13, 2024 2:41 am

Thank you for your reply. The thing is that I don't want interrupt on any of the cores. I was hoping that it's possible to check if there is a flag indicating that SPI message is received. Then I would clear the "flag", process the received message and initiate another SPI transfer manually.

MicroController
Posts: 1729
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: esp32-s3 polling for SPI transfer done

Postby MicroController » Sun Oct 13, 2024 3:51 pm

Are you using DMA?
Which interrupts do you want to 'pause'? All of them or just SPI?

Slinisa
Posts: 32
Joined: Sat Oct 07, 2023 8:21 am

Re: esp32-s3 polling for SPI transfer done

Postby Slinisa » Sun Oct 13, 2024 5:16 pm

Only SPI. I don't want to pause DMA, it should do the transfer when requested, but not generate interrupt on completion. The thing is I'm using LCD interrupts as well, and I don't know how to change interrupt priorities of any of them, so I guess that increasing priority of LCD interrupt would also do the trick. I could only find changing priority levels of interrupts on pins.

Who is online

Users browsing this forum: Bing [Bot] and 187 guests