Page 1 of 1

SPI DMA and interrupts...

Posted: Thu May 10, 2018 3:58 pm
by themindfactory
I have been able to write code that sends out SPI data using DMA... however I can not figure out how to get it to interrupt me to tell me its done with the transfer, right now it waits for completion.....

I used this code for my example https://github.com/natanaeljr/esp32-SPIbus

RichardS.

Re: SPI DMA and interrupts...

Posted: Thu May 10, 2018 4:17 pm
by mikemoy
There is an example of pre-transfer callback in \esp-idf\examples\peripherals\spi_master
There is also a post-transfer callback as well that you can setup to tell you when the transfer is complete.
http://esp-idf.readthedocs.io/en/latest ... aster.html

Re: SPI DMA and interrupts...

Posted: Thu May 10, 2018 5:05 pm
by themindfactory
mikemoy wrote:There is an example of pre-transfer callback in \esp-idf\examples\peripherals\spi_master
There is also a post-transfer callback as well that you can setup to tell you when the transfer is complete.
http://esp-idf.readthedocs.io/en/latest ... aster.html
Thanks for the reply.

I added a callback on the post-transfer and it still waits till completion and then calls the callback :-(

RichardS

Re: SPI DMA and interrupts...

Posted: Fri May 11, 2018 3:37 am
by ESP_Sprite
You're using 'done with the transfer' and 'completion' here as if there's a difference between them; I'm not sure we all are getting what you mean there. Could you elaborate a bit on what you're trying to do, to make us understand what you want a bit better?

Re: SPI DMA and interrupts...

Posted: Fri May 11, 2018 4:15 am
by WiFive
https://esp-idf.readthedocs.io/en/lates ... nsaction_t
Send a SPI transaction, wait for it to complete, and return the result.
This function is the equivalent of calling spi_device_queue_trans() followed by spi_device_get_trans_result()