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

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
moonie223
 
Posts: 49
Joined: Sun Feb 05, 2017 2:44 pm

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

Post by moonie223 »

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!

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

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

Post by adafruit_support_mike »

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.

User avatar
moonie223
 
Posts: 49
Joined: Sun Feb 05, 2017 2:44 pm

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

Post by moonie223 »

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.

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

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

Post by adafruit_support_mike »

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.

User avatar
moonie223
 
Posts: 49
Joined: Sun Feb 05, 2017 2:44 pm

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

Post by moonie223 »

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...

Locked
Please be positive and constructive with your questions and comments.

Return to “Itsy Bitsy Boards”