4 Replies Latest reply on Jul 9, 2020 7:23 AM by EvPa_264126

    Cache images

    ShKr_3646021

      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

        • 1. Re: Cache images
          LePo_1062026

          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

          • 2. Re: Cache images
            ShKr_3646021

            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

            • 3. Re: Cache images
              LePo_1062026

              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

              • 4. Re: Cache images
                EvPa_264126

                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)