Close

Some notes on speed

A project log for Cinemagraph Display

A hackable digital picture frame optimized to display high quality animated gif's.

theideamentheIdeaMen 06/06/2014 at 15:500 Comments

I want to be able to support 30 frames per second animated GIF's at 24-bit RGB. The LCD I chose for version 0.2 is max 320x240 pixels. 

320 * 240 * 24 = 1843200 bits per frame. 

The LCD controller supports paging, so I can load one animation frame in the background while one is being displayed.

1843200 bits per frame * 30 frames per second = 55296000 bits per second.

Let's see what my chosen microcontroller can do over SPI. 

The SAM3S embeds high speed pads able to handle up to 32 MHz for HSMCI (MCK/2), 45 MHz for SPI clock lines and 35 MHz on other lines.

Well, crap. 

Because SPI is a serial interface, clock frequency is approximately equal to bits per second (there is some overhead because of the LCD controller commands before the pixel data). So what is my max frame rate?

45 million bits per second / 1843200 bits per frame = 24.4 frames per second. 

I guess that's not terrible, but I have to keep in mind this is best case. The real world frame rate will probably be around 10. In future iterations, I will use a bigger microcontroller in order to use 16-bit parallel interface to the LCD controller and eventually get to a bigger LCD. 320x240 is just too small for my cinemagraphs.

EDIT: I realized I had enough pins leftover from I/O assignments that I could use an 8-bit indirect mode to interface to the LCD controller.

This is the setup, with the exception that mine will be a 24-bit TFT.

What is the speed increase?

320 pixels * 240 pixels * 24 bits + 24 bits overhead = 1843224 bits per frame

Each normal I/O pin can do a max of 35 MHz so,

35 million bits per second / (1843224 bits per frame / 8 bits parallel) = 151.9 frames per second!

Once again, this is best case scenario. There are things like settling time and crosstalk for parallel lines that limit the speed. At least I'll be able to dial it down to 30 FPS and have some time in the processor to sleep or do other things.

Discussions