stm32_graphics_display_drivers

STM32Fxxx graphics display drivers

Layer chart, examples circuits and settings:

LCD I/O and touchscreen I/O driver:

stm family spi gpio8 gpio16 fsmc8 fsmc16 ts_gpio8 ts_fsmc8 ts_xpt2046 spi_xpt2046 note
STM32F0 + + +              
STM32F1 + + +     +   +    
STM32F2 + + + + + + + + +  
STM32F3 + + +              
STM32F4 + + + + + + + + +  
STM32F7 + + +              
STM32G0   + +             not tested
STM32G4   + +             not tested
STM32L0 + + +             not tested
STM32L1 + + +              
STM32L4 + + +             not tested
STM32L5   + +             not tested
STM32H7   + +              

LCD driver:

App:

How to use starting from zero?

  1. Create project for Cubemx or CubeIDE
    • setting the RCC (Crystal/ceramic resonator)
    • setting the debug (SYS / serial wire or trace assyn sw)
    • setting the timebase source (i like the basic timer for this)
    • if FSMC : setting the FSMC (chip select, memory type = LCD, Lcd reg select, data = 8 or 16 bits, timing)
    • if SDCARD : setting the SDIO mode, enable the FATFS, FATFS: USE_LFN, MAX_SS = 4096, FS_LOCK = 5, RTC enabled
    • if USB pendrive : setting the USB host, setting the USB power, enable the FATFS, USE_LFN, MAX_SS = 4096, FS_LOCK = 5
    • if JPG : enabled the LIBJPEG
    • setting the clock configuration
    • project settings: project name, toolchain = truestudio, stack size = 0x800
    • generate source code
  2. Truestudio or CubeIDE
    • open projects from file system (only Truestudio)
    • open main.c
    • add USER CODE BEGIN PFP: void mainApp(void);
    • add USER CODE BEGIN WHILE: mainApp();
    • open main.h
    • add USER CODE BEGIN Includes (#include “stm32f1xx_hal.h” or #include “stm32f4xx_hal.h” or …)
    • add 2 new folder for Src folder (App, Lcd)
    • copy file(s) from App/… to App
    • copy 4 or 7 files from Drivers to Lcd (lcd.h, bmp.h, stm32_adafruit_lcd.h / c, if touch: ts.h, stm32_adafruit_ts.h / c)
    • copy Fonts folder to Lcd folder
    • copy io driver to Lcd folder (lcd_io_…h / c or lcdts_io…h / c or…)
    • copy lcd driver to Lcd folder (st7735.h / c or ili9325.h /c or…)
    • if printf to SWO : copy syscalls.c to Src folder
    • setting the configuration the io driver header file (pin settings, speed settings etc…)
    • setting the LCD configuration (orientation, touchscreen)
    • add include path : Src/Lcd
    • setting the compile options (Enable paralell build, optimalization)
    • compile, run …

Example (please unzip the app you like):

https://lujji.github.io/blog/stlink-clone-trace/