Cache images

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ShKr_3646021
Level 2
Level 2
First like received 10 replies posted 5 replies posted

Hi,

Could someone help me understand how to cache images from SD Card to PSoC memory??? Is there an example to follow? I am using PSoC 5 LP and emFile to work with SD card. I want to save the time hence the try to cache images.

Appreciate any tips with this regard.

Thanks and regards,

Shamili

0 Likes
1 Solution

ShKr,

4KB is not too bad.

The simplest but not always the most flexible architecture is a single-task structure.  In this case you pre-allocate your image buffer (4KB) at design/compile time.  For example:

uint8_t imagebuff[4096];

If you need to use a dual image buffer strategy which will double your RAM pre-allocated:

uint8_t imagebuff0[4096];

uint8_t imagebuff1[4096];

or:

uint8_t imagebuff[4096,2];

With the dual buffer strategy you can switch between buffers as you are displaying one buffer, you can fill the other buffer.  Then switch the buffer being displayed and filled.

If you are dumping to an intelligent display, some display internally use a double-buffering schemes.  This means you might be able to dump the data directly from a SPI connected SD card to the display then instruct the display to switch to the new buffer at the proper switch time.

A more complicated architecture approach is to use a RTOS (Real-Time Operating System).  It takes a bit of setup and learning but may be more real-time responsive to a deterministic system such as audio or video.

Len

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

0 Likes
4 Replies
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

Shamili,

What is the maximum image size you desire to cache?

Note: The PSoC5 has limited RAM memory.

I'm assuming you are trying to implement a video-like function.   What is your desired frame-rate?

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

Len,

Thank you for your response.

Maximum image size is 4KB. I will make sure not to cross the limit when I cache. Any idea as to how it can be done?

Note: I have different screens and different set of images for each screen. Every time I try to navigate between the screens I would like to retrieve respective images from cache.

Appreciate any help!

Best regards,

Shamili

0 Likes

ShKr,

4KB is not too bad.

The simplest but not always the most flexible architecture is a single-task structure.  In this case you pre-allocate your image buffer (4KB) at design/compile time.  For example:

uint8_t imagebuff[4096];

If you need to use a dual image buffer strategy which will double your RAM pre-allocated:

uint8_t imagebuff0[4096];

uint8_t imagebuff1[4096];

or:

uint8_t imagebuff[4096,2];

With the dual buffer strategy you can switch between buffers as you are displaying one buffer, you can fill the other buffer.  Then switch the buffer being displayed and filled.

If you are dumping to an intelligent display, some display internally use a double-buffering schemes.  This means you might be able to dump the data directly from a SPI connected SD card to the display then instruct the display to switch to the new buffer at the proper switch time.

A more complicated architecture approach is to use a RTOS (Real-Time Operating System).  It takes a bit of setup and learning but may be more real-time responsive to a deterministic system such as audio or video.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

Reading pictures from SD and displaying on the screen - is this suitable?

LCD_320.cywrk.zip  (http://mylab.wmsite.ru/moi-razrab/cypress-psoc/)

TFT240x320_ECG_Simulator.zip (http://mylab.wmsite.ru/moi-razrab/kardiograf)