Skip to main content
WPazH
Associate II
March 6, 2024
Solved

Is it possible to capture the screen image with the STM32F4 MCUs?

  • March 6, 2024
  • 4 replies
  • 2307 views

Hello,

I'm starting a project with an STM32F429IIT6 MCU, but I have a doubt. The project will have a display (I haven't decided yet if it will be 4.3" or 7"), and I'll be controlling the display with the MCU's internal TFT controller using TouchGFX. So far, so good. The issue is that the device needs to be able to capture a screenshot of the screen and save it to an internal microSD. Is this possible, or should I use an external driver to achieve this?

Best Regards,                                                                                                                                                                      Walter Paz.

This topic has been closed for replies.
Best answer by GaetanGodart

Hello @WPazH ,

 

As @Tesla DeLorean have said, you can simply fetch the frame buffer data.

There is no way for TouchGFX to get the information of the pixels displayed on the screen but if you configured your project properly, your screen should display exactly what is stored in the frame buffer.

You just need to know the starting address of your frame buffer and its size (its size should be the size of your screen in pixel multiplied by the depth of your pixels color [16bpp for RGB565, 24bpp for RGB888, 32bpp for ARGB8888]) and copy the raw data into a buffer.
Then you could use the libpng library to convert it into a png, libpng is already used in TouchGFX.

 

As per how to store it into your micoSD, I cannot help you as it is out of the scope of TouchGFX and of my qualifications.
However, here is an example of Creating a File System on a SD card on STM32 .

 

Regards,

4 replies

Tesla DeLorean
Guru
March 6, 2024

As long as there aren't overlays you could likely fish the static image out of the frame buffer and write it to a bit map file. For BMP you'd need to handle the headers, and line ordering.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
GaetanGodart
GaetanGodartBest answer
Technical Moderator
March 7, 2024

Hello @WPazH ,

 

As @Tesla DeLorean have said, you can simply fetch the frame buffer data.

There is no way for TouchGFX to get the information of the pixels displayed on the screen but if you configured your project properly, your screen should display exactly what is stored in the frame buffer.

You just need to know the starting address of your frame buffer and its size (its size should be the size of your screen in pixel multiplied by the depth of your pixels color [16bpp for RGB565, 24bpp for RGB888, 32bpp for ARGB8888]) and copy the raw data into a buffer.
Then you could use the libpng library to convert it into a png, libpng is already used in TouchGFX.

 

As per how to store it into your micoSD, I cannot help you as it is out of the scope of TouchGFX and of my qualifications.
However, here is an example of Creating a File System on a SD card on STM32 .

 

Regards,

Andrew Neil
Super User
March 7, 2024

@WPazH wrote:

the device needs to be able to capture a screenshot of the screen and save it to an internal microSD. .


That seems a rather odd requirement - why does it "need" (sic?) to do that?

There may be other ways to achieve the end goal ...

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
GaetanGodart
Technical Moderator
March 19, 2024

Hello @WPazH ,

 

Was any of the above comment helpful to you?

Were you able to succeed in your project?

 

Regards,