STM32F7-Discovery digital photo frame

I’ve just realized a digital photo frame with the newly-released STM32F7-Discovery board from ST Microelectronics. A lot of software components are used in this project, such as: FreeRTOS, STemWin (with external resource load), LCD interface.

Digital photo frame application with STM32F7 Discovery board

Digital photo frame application with STM32F7 Discovery board


Discovery board and shipped free software

I must say that I’m quite impressed with the quality of the new STM32F7-Discovery board, specially taking into account the price. For less than 50€ I bought a 480×272 TFT panel with touchscreen, SDRAM, QSPI flash, Micro-SD card, Ethernet, dual USB interface, dual microphone, audio interface (line in and line out) and, finally, a Cortex-M7 microcontroller with Chrom-Art acceleration!

Moreover, ST is making a strong effort to provide not only the silicon but also the software behind. On one hand, we have the STemWin library, a quite powerful graphic package that integrates window management, plotting, touch (and mouse, keyboard) inputs and more. On the other hand, STM32CubeMX is a powerful software that provides a well-written HAL (Hardware Abstraction Layer), a graphical interface to configure the microcontroller peripherals, and also drivers for all the hardware components mounted on the development boards (such as SDRAM, LCD, accelerometers, audio codec, gyroscopes and much more).


Honestly, I’ve taken the idea of the digital photo frame from the ST example provided within the HAL package for STM32F7 (it can be downloaded through the STM32CubeMX application).

I was not satisfied with the approach taken by ST. I wanted to play with the STemWin library instead, using a GUI management, so I’ve written an application myself. Moreover, without a Jpeg or GIF library, the demo supplied was not able to reproduce these formats, that on the other hand are more than common. Within the STemWin package there are libraries for Jpeg and GIF, so the vast majority of the work was already done, I just have to glue pieces together.

Since this project is just the starting point to realize something more complex, I also needed an operative system on top of which execute the tasks required by my specific application. I normally use FreeRTOS, but other solutions should be also great.

Another thing that a digital photo frame should support is a filesystem. In the specific, I used Chan’s FatFs to support FAT filesystem. With this library is possible to access any FAT support, but within this project I used only the SD card.

STemWin and external resources

Here comes the funny stuff: searching on internet I have not found any already written code that shows how to load effectively the images from external memories within the STemWin package (that is, basically, a version of emWin made for ST microcontrollers).

After a bit of research within the user manual of emWin, I’ve found that exists a function for each kind of image that allows the external load of resources (in my case, images).

  • BITMAP – GUI_BMP_DrawEx()
  • JPEG – GUI_JPEG_DrawEx()
  • GIF – GUI_GIF_DrawEx()
  • PNG – GUI_PNG_DrawEx()  – I don’t cover it during this article

Each one of them uses an external function to access the actual image data inside the filesystem. Here is the function that I written to access the images, it works with FatFs:

It takes some parameters (listed below)

  • void * p     the file to access
  • const U8 ** ppdata      pointer to the beginning of the buffer
  • unsigned NumBytesReq      the number of bytes to read
  • U32 Off      the position (in bytes) from which read the file

Much of these parameters are managed by the STemWin package, so I just focused on the first one. This first parameter should be an already opened and valid file, as example a correct drawing of a bitmap image happens this way:

The function works correctly but also is important to notice that it uses an external buffer called _acBuffer that should be long enough to load a single line from the image.

Complete source code

You can download the source code here.


12 thoughts on “STM32F7-Discovery digital photo frame

    • Scusami per il ritardo nella risposta. Purtroppo utilizzo solamente Keil ma credo puoi modificare agilmente il codice per poterlo provare con IAR

  1. HI

    Very interesting project .Good work. I would like one infomation though .
    HOw much time does it need to decode 480×272 jpeg picture?. Have you measured?.
    Have you tried libjpeg to compare speed ?. I would like to know if it’s possible to support video ?,
    Nice work anyway

    • Currently I switched my focus on the low power series STM32L4 and I have not performed further tests on the STM32F7. I think the decode speed is too slow (at least within the STemWin) to reproduce a video. libjpeg can be a solution, please let me know if you find something interesting about

  2. hi, a great work you did, but I can not compile in Keil, a message appears indicating that some files missing, could help me understand this, thank you.

    (“no source”: Error: #5: cannot open source input file “..\..\..\Resources\FatFS\src\drivers\sd_diskio.c”: No such file or directory)

  3. Please share binary, would like to try some things out, but don’t want to install Keil/libs. Thanks!

    • I’m planning a huge migration to GitHub, then it will be available also with binaries ready to burn. Sorry for the inconvenience

  4. Hi Fabio, thank you for your sharing, it’s very interesting and helpful,however I have problem building the project in eclipse, it seems that certain files and defines are missing from the provided folder. Could u maybe check the files named “GUI_Private.h”, “GUIDRV_Lin.h” and the definition for “LCD_X….”? Also is it possible that you give me a .bin or .hex file for the project so that I can try it on my board? Because I just got my stm32f7 board, would like to see how the pictures look on the screen, I wrote my own programm to read the bmp files from sd card, but have problems with fatfs, I’d like to try yours if possible. Thanks a lot!

    • These names are correct, I used an old version of STemWin library, maybe now they are different, I don’t know. However, I”m planning a mayor migration to GitHub. When completed, all the code will be available also with examples. Sorry for the inconvenience

  5. Hi Fabio, thanks for the sharing, very interesting work. I just got my stm32f7 board, but I just started to learn how to program on microcontrollers, could you please share the hex or bin file as well? so that I can try to run it?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.