Page 1 of 1

SPI DMA Read/Write example

Posted: Sun Dec 23, 2018 6:29 pm
by KanyeKanye
Hi, I just read SPI api-reference and looking for an example snippet of reading SPI data in DMA mode.
There is spi_master but it doesnt use DMA (doesnt it?) and just send, do not read any data. Things that are important for me:
- declaring memory for buffers (how, should I declare new buffer for each transaction?)
- cmd and addr variable length (should use only tx_buffer or change addr length dynamically?)
- what is length and rxlength? length is sum of rxlength and txlength?

Re: SPI DMA Read/Write example

Posted: Mon Dec 24, 2018 2:45 am
by ESP_Sprite
The SPI master driver actually happily uses DMA as long as you tell it to. I think the SPI master example has some example code for reading (in this case, the LCD ID) as well.