cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7S78-DK reading Image from SD card with TouchGFX

Leo99
Associate II

Hello, everyone.
I have a problem on which I am seeking advice and opinions for a possible solution.
I am making an application with the STM32H7S78-dk board and TouchGFX. A very simple thing, imagine a page with a background image and a button, same for page 2. By pressing a button I move between pages.
What I want to do is read an image from the SD card (I have already managed to configure reading and writing a file correctly) and display it on the screen on one of the two pages, let's take page 2 as an example.
I have almost succeeded but with some basic problems.

My method was to have TouchGFX allocate an image of the size I wanted in the External Flash and through this code in the image.cpp file change its location.

LOCATION_PRAGMA(‘MyImage’) //RAM
KEEP extern unsigned char image_saname[] LOCATION_ATTRIBUTE(‘MyImage’) = { ...

Where this area called MyImage that has been allocated in the external RAM section in the LD file like this:

BufferSection(NOLOAD) :
{
*(TouchGFX_Framebuffer TouchGFX_Framebuffer.*)
*(.gnu.linkonce.r.*)
. = ALIGN(0x8);

*(Nemagfx_Stencil_Buffer Nemagfx_Stencil_Buffer.*)
*(.gnu.linkonce.r.*)
. = ALIGN(0x8);

*(MyImage MyImage.*)
*(.gnu.linkonce.r.*)
. = ALIGN(0x8);

} >EXTRAM

Having done this within the task that regulates the SD card, I went to read bit by bit of my 565 bitmap image on the SD card and overwritten the image created by TouchGFX.

This works because I can see this image on the page I'm interested in but after a bit of switching between pages by pressing the buttons I get a HardFault_Handler() back.

I can't figure out if there is a problem because TouchGFX doesn't know that that image is actually in the external RAM so that every time the page is reloaded it doesn't clean the memory correctly.
Or I can't tell if it's a task conflict problem

Thanks

1 REPLY 1
SofLit
ST Employee

Hello,


@Leo99 wrote:

This works because I can see this image on the page I'm interested in but after a bit of switching between pages by pressing the buttons I get a HardFault_Handler() back.

 

For Hardfault debug, you need to refer to this article. Not obvious that someone here can tell you what is going on based on what you shared, as debugging "Hardfault" is a bit tricky and could be a symptom of many issues. So need a debug from your side.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.