SPI DMA Read/Write example

KanyeKanye
Posts: 54
Joined: Mon Dec 05, 2016 12:34 am

SPI DMA Read/Write example

Postby KanyeKanye » Sun Dec 23, 2018 6:29 pm

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?

ESP_Sprite
Posts: 9727
Joined: Thu Nov 26, 2015 4:08 am

Re: SPI DMA Read/Write example

Postby ESP_Sprite » Mon Dec 24, 2018 2:45 am

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.

Who is online

Users browsing this forum: Google [Bot] and 105 guests