cancel
Showing results for 
Search instead for 
Did you mean: 

How to store the TouchGFX assets to SD card?

Iswarya
Associate II

Hi,

I would like to use SD card to store the image files. Can you please help me to guide how to store these files in SD card?

6 REPLIES 6
Martin KJELDSEN
Chief III

Hi @Iswarya​,

I don't have a ready example to share on how to do this.

But, generally, you cannot simply store assets on an SD card because the SD card is not memory addressable. You would need to use the caching mechanisms of TouchGFX to decode whatever images (into dynamic bitmaps) you have on said SD card (e.g. jpegs, pngs - we do not have an official decoder for the latter).

Decoding images will incur some overhead.

Iswarya
Associate II

Hi Martin,

Thank you Martin. Looks like , it is possible to store the assets in SD card. Does the Washer Demo in TouchGFX designer stores the images in SD card??

Martin KJELDSEN
Chief III

Hi @Iswarya​,

It doesn't. The video is present as a c-array which is a part of the application.

Iswarya
Associate II

Hi Martin,

I tried "dynamic_bitmap_example" to store the assets in SD card. I'm trying the store the bitmap in RAM instead of SDRAM used in the example.

BmpId generated. Image width and Image height calculated.

I'm facing issue in BMPFileLoader::readBMP24File function.

               case Bitmap::RGB565:

                           static uint32_t i;

                   buffer16[x + (height - y - 1) * buffer_width] =

                       touchgfx::Color::getColorFrom24BitRGB(data[(x % 10) * 3 + 2], data[(x % 10) * 3 + 1], data[(x % 10) * 3]);

                   break;

The execution went to hardfault error after this case is executed once.

Iswarya
Associate II

Hi Martin,

I tried to load the image in flash using the following code in BoardConfiguration.cpp file.

const uint32_t bmpCache[18000] __attribute__((section(".ARM.__at_0x8001800"))) = {};

void touchgfx_init()

{

   HAL& hal = touchgfx_generic_init<HAL_CLASS_TYPE>(dma, display, tc, 480, 272, (uint16_t*)bmpCache,263000,1);

.......

.........

}

Now, I didn't see the hard fault error. But the image is not loading in LCD.

Can you please help me..

Iswarya
Associate II

Hi @Martin KJELDSEN​,

I'm trying to load the image from SD card. I'm using flash location to store the bitmap cache.

I could successfully get the image width, image height and bimtap id also generated. But, I couldn't see the image in SD card.

Can you please help me.