0

SAMD51 SPI DMA, does it do it automatically and other questi
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

SAMD51 SPI DMA, does it do it automatically and other questi

by moonie223 on Sun Sep 12, 2021 9:01 pm

Hello again!

I am playing around with a little 240x240 round TFT and an itsybitsy M4.

I would like to use it to make an analog gauge pointer, and rather than fuss about with update windows on the TFT I want to run a full frame buffer.

https://github.com/moononournation/Arduino_GFX
There's a library here which works, and uses a frame buffer, but the SPI is tremendously slow. I've modified things to run at 50MHz, and I've got delays of over 350ns between 8bit transfers.

I thought that DMA is automatically used to get rid of the interbyte delays, even if it's not fully leveraging DMA to do other things, I guess it's a blocking DMA till you do otherwise?

Can I get rid of these delays? I was hoping for much closer to 25-30FPS, not the ~14FPS I am getting now.

DMA can be used for this right? I mean transferring 112.5K?

Thank you for any advise!

moonie223
 
Posts: 47
Joined: Sun Feb 05, 2017 2:44 pm

Re: SAMD51 SPI DMA, does it do it automatically and other qu

by adafruit_support_mike on Tue Sep 14, 2021 8:21 pm

Our version of the GFX library doesn't use DMA at all. You'll need to talk to the author of the library you're using to get more information about its timing.

In general, the SAMD51 doesn't use DMA for anything unless you tell it to, and its timing depends heavily on the way you code transfers.

adafruit_support_mike
 
Posts: 63729
Joined: Thu Feb 11, 2010 2:51 pm

Re: SAMD51 SPI DMA, does it do it automatically and other qu

by moonie223 on Tue Sep 14, 2021 8:47 pm

Are you sure? The GFX library might not use it, but I am pretty sure the SPI library in the adafruit SAMD BSP does use DMA even if you don't tell it to. I swear I remember seeing someone say it was to get rid of interbyte delays and nothing else. I can't find it now.

https://github.com/adafruit/ArduinoCore ... raries/SPI

Is there any documentation on the changes made to these libraries over time? Because it doesn't seem like it.

moonie223
 
Posts: 47
Joined: Sun Feb 05, 2017 2:44 pm

Re: SAMD51 SPI DMA, does it do it automatically and other qu

by adafruit_support_mike on Fri Sep 17, 2021 10:27 pm

The SPI library does try to use DMA, but falls back to the basic SERCOM if DMA doesn't work. Even at that level, it falls under the heading of telling the SAMD51 to use DMA.. the SERCOM has its own way of doing data transfers.

moonie223 wrote:Is there any documentation on the changes made to these libraries over time? Because it doesn't seem like it.

Not really.. the commit messages show what each change did, but we don't usually keep changelogs.

adafruit_support_mike
 
Posts: 63729
Joined: Thu Feb 11, 2010 2:51 pm

Re: SAMD51 SPI DMA, does it do it automatically and other qu

by moonie223 on Sat Sep 18, 2021 1:58 pm

That doesn't make any sense. The only difference between DMA SPI and not is what writes and reads the data register. SERCOM is configured the same.

I figured it out. 65535 consecutive beats is the most you can put together with one DMA descriptor. Using ZeroDMA, it automatically links consecutive descriptors, so you can keep them going till you run out of RAM to hold them in. Either way, I am able to send all 115200 bytes at 50MHz with zero delay between any bytes, that's all I was asking for.

Thanks for the help, I guess...

https://github.com/adafruit/ArduinoCore ... I.cpp#L366

What's that? A full DMA config and call on a call to SPI.transfer? Very strange. There's even support there to use it without blocking. Seems to me a person can use DMA without even knowing it...

moonie223
 
Posts: 47
Joined: Sun Feb 05, 2017 2:44 pm

Please be positive and constructive with your questions and comments.