Is there any DMA based OLED library?

Working libraries, libraries being ported and related hardware
Post Reply
WindyYam
Posts: 49
Joined: Mon Aug 07, 2017 2:39 am

Is there any DMA based OLED library?

Post by WindyYam » Fri Nov 09, 2018 3:03 am

Hello everyone, is there any dma based ssd1306 spi driver library? Just in case anyone have done it but I haven't found in this forum

If not , is there any references on how to drive SPI along with dma? :D

david.prentice
Posts: 163
Joined: Wed Nov 16, 2016 8:52 am

Re: Is there any DMA based OLED library?

Post by david.prentice » Fri Nov 09, 2018 7:39 am

There is little to be gained with DMA. Most libraries manipulate a SRAM buffer and then blit the whole 1024 bytes via SPI or I2C. This is 512us @ 16MHz SPI. Pretty insignificant for an animation.

Yes, you can alter the blit-buffer routine in the library to use DMA. I doubt if you will notice any difference.

David.

stevestrong
Posts: 3053
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: Is there any DMA based OLED library?

Post by stevestrong » Fri Nov 09, 2018 9:21 am

It shouldn't be hard to replace existing SPI function with some of the available snyc/async DMA SPI functions.

WindyYam
Posts: 49
Joined: Mon Aug 07, 2017 2:39 am

Re: Is there any DMA based OLED library?

Post by WindyYam » Fri Nov 09, 2018 10:53 am

stevestrong wrote:
Fri Nov 09, 2018 9:21 am
It shouldn't be hard to replace existing SPI function with some of the available snyc/async DMA SPI functions.
I'll have a try, but those functions lack of usage reference, for example, what's the differences of sync/async transfer mode?

stevestrong
Posts: 3053
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: Is there any DMA based OLED library?

Post by stevestrong » Fri Nov 09, 2018 12:42 pm

Sorry, I should have written blocking/non-blocking DMA functions, the non-blocking ones containing "async" in the name.

User avatar
madias
Posts: 1198
Joined: Mon Apr 27, 2015 11:26 am
Location: Vienna, Austria

Re: Is there any DMA based OLED library?

Post by madias » Fri Nov 09, 2018 11:19 pm

as David said, there wouldn't be any benefit using DMA for the SSD1306. DMA isn't a for speed as a major priority and with a whole screen buffer of 1k it wouldn't be a really discharge for the MCU. The SSD1306 is limited by it's chip. A much better approach would be not to update the whole display at once, but only the pages (0-7) which need to be updated (I've done this for my project). Maybe you can also select the rows for a particular part for updating (can't remember, but it's written in the datasheet).
Here is my approach just updating pages, but you need to update the SPI routines (I only own the I2C variants): viewtopic.php?f=13&t=4201&hilit=ssd1306

WindyYam
Posts: 49
Joined: Mon Aug 07, 2017 2:39 am

Re: Is there any DMA based OLED library?

Post by WindyYam » Tue Nov 13, 2018 3:14 am

Thanks for your suggestions, I thought the non-blocking dma would save the time of the mcu bliting frame buffer :(

david.prentice
Posts: 163
Joined: Wed Nov 16, 2016 8:52 am

Re: Is there any DMA based OLED library?

Post by david.prentice » Tue Nov 13, 2018 7:27 am

Yes, it would make a difference to blitting the Frame buffer.
My point was that you would not notice in most apps.

I have a running horse animation that steps through a set of 14 Frames in flash memory. It works fast enough as it is.

It does not need 30 FPS. 128X64 monochrome is not really capable of high resolution.
If you have a sample set of Frames that would benefit from a high Frame rate, please attach or post a link.

Mind you, there are plenty of dynamic animations e.g. spinning wire-frame. This requires serious computation to generate the changing wire-frame in the buffer. DMA would mean that the previous blit would be executing while you are producing the next frame. This means you must be careful with your drawing algorithm.

David.

Post Reply