Floyd-Fish / STM32-FSMC-ILI9341-Lib

Using STM32 HAL FSMC to drive ILI9341 based LCDs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

STM32-FSMC-ILI9341_Lib

This is a library for those LCDs using 16-bit parallel interface based on ILI9341.

Actually there isn't much information about HAL's FSMC's usage in LCD controller.
I have referred articles below and they did a lot help to me:

About FSMC in emWin
Martnak's ILI9341 Lib

Martnak's lib is based on SPI and in some occasions it's quite slow. So FSMC is a good choice to drive a high-speed lcd display.

How to use

Configure FSMC in cubeMX and other necessary params(For details you can look into the demo in the repo.)

And Generate Code, I use Clion + cmake to build project so i choose SW4STM32.

Then follow the procedure below :

  1. include "ili9341.h" in main.c
  2. refer ILI9341_Init(); in main() function(before while (1)).
  3. refer ILI9341_Test(); in while(1) to test whether it's fine.
  4. Enjoy :)

Notes

FSMC parameters generated by cubeMx is not quite perfect for lcd displays.
If you want faster speed, you can change the params in Src/fsmc.c 's MX_FSMC_Init() function

Here is an example:

//params generated be cubeMx automatically
/*
Timing.AddressSetupTime = 15;
Timing.AddressHoldTime = 15;
Timing.DataSetupTime = 255;
Timing.BusTurnAroundDuration = 15;
Timing.CLKDivision = 16;
Timing.DataLatency = 17;
*/

//Changed value as below
Timing.AddressSetupTime = 2;
Timing.AddressHoldTime = 2;
Timing.DataSetupTime = 16;
Timing.BusTurnAroundDuration = 2;
Timing.CLKDivision = 16;
Timing.DataLatency = 2;

This will improve the display speed a lot. Hope it helps.

PinMaps

STM32 ILI9341_LCD Comment
FSMC_Dx DBx 16 pins in total
FSMC_NOE LCD_RD Read
FSMC_NWE LCD_WR Write
FSMC_NEx LCD_CS Chip select
FSMC_Ax LCD_RS Register Select (Not Reset!)
User defined RST pin LCD_RST Reset

About

Using STM32 HAL FSMC to drive ILI9341 based LCDs

License:GNU General Public License v3.0


Languages

Language:C 93.7%Language:Makefile 4.4%Language:C++ 1.0%Language:CMake 0.5%Language:Assembly 0.5%