RobertoBenjami / stm32_graphics_display_drivers

STM32 LCD drivers (currently: spi(dma), gpio, fsmc(dma), st7735, st7783, ili9325, ili9328, ili9341, ili9486, ili9488, hx8347g)
564 stars 110 forks source link
arm c cubemx gcc-arm hx8347g ili9325 ili9341 ili9486 ili9488 jpeg jpg lcd-driver st7735 st7783 stm32 touchscreen xpt2046

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 (lcdio...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):

How to adding the SWO support to cheap stlink ?

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