Introduction: UGFX on STM32f4 and ILI9341
Hello, this is my first Instructable.
For those of you out there who want to take GUIs on embedded systems from Adafruit GFX , U8Glib and Ucglib to a more comprehensive GUI platforms µGFXis a good start. µGFXis used mainly with 32-bit ARM Cortex processors.
µGFX is a lightweight embedded library for displays and touchscreens providing everything required to build a fully featured embedded GUI. The library is very small and fast because every unused feature is disabled and not linked into the finished binary.
Some of the best features are it runs on any display, Code is super portable and sign for beta testing to get GUI designer on PC.
With GUI designer making UI becomes far simpler than manually coding all the layouts.
µGFX also supports tonnes of OSes including but not limited to FreeRTOS, chibiOS etc
Step 1: Hardware Setup
i am using STM32F4 Discovery and ILI9341.
Display is Connected to STM32F4 via SPI, the display and cpu are both 3.3V logic so its a perfect match and no need of level shifters.
STM32F4 has 3 SPI ports you are free to chose any of the ports by making appropriate changes in users/defines.h for my project i am using SPI1
SPI_SCK --> PA5
SPI_MISO --> PA6
SPI_MOSI --> PA7
CS Pin --> PC2
DC pin --> PD3
RST --> PD12 or Pull high
Thats about it.
Step 2: Software Setup
I am using Keil MDK5 as the IDE and i have attached the project workspace that can be build and uploaded.
The same setup can be replicated on other IDEs such as Eclipse, TrueStudio but needs some manual effort to orgainze the .c and .h files for compilation and trust me the project has lot of dependencies..
The keil project can be found in the folder 01-STM32F4xx_Keil_CMSIS_uGFX after extracting the project from the GitHub link.
The main.c file is found in 'User' group.
UGFX requires low level drivers(LLD) for ili9341, fortunately the library is already written by tilen majerle and more info can be found at https://stm32f4-discovery.net/2014/04/library-08-i... .
Now that LLD is found it must be linked with ugfx for it access the display functions, this is achieved by editing the board_ILI9341.h (which i have already done).
Ugfx needs lots of configuration and you can learn more about config at https://wiki.ugfx.io/index.php/Configuration .
To try out more fonts you must enable fonts from user group gfxconf.h
if new source files are added, make sure to include it in the compiler path.
Once the fonts project work, you can explore more features of UGFX from \ugfx_keil_ili9341\ugfx_2.8\demos , demos found at ugfx_keil_ili9341\ugfx_2.8\demos\modules\gdisp are good to start with.
sorry for my bad english :P