Skip to main content
Iswarya
Associate III
April 3, 2019
Question

How to store the TouchGFX assets to SD card?

  • April 3, 2019
  • 6 replies
  • 1559 views

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?

This topic has been closed for replies.

6 replies

Martin KJELDSEN
Principal III
April 4, 2019

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
IswaryaAuthor
Associate III
April 4, 2019

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
Principal III
April 8, 2019

Hi @Iswarya​,

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

Iswarya
IswaryaAuthor
Associate III
April 10, 2019

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
IswaryaAuthor
Associate III
April 10, 2019

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
IswaryaAuthor
Associate III
April 11, 2019

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.