Тёмный

STM32F4 Discovery board - Keil 5 IDE with CubeMX: Tutorial 21 - TFT LCD ili9341 (using FSMC) 

Mutex Embedded
Подписаться 22 тыс.
Просмотров 41 тыс.
50% 1

This tutorial shows you how to use a TFT LCD using the FSMC interface of the STM32F4 Discovery board. It uses the ILI9341 2.4'' Arduino LCD shield. The concept is the same for other TFT LCD displays.
1. Source code (main.c + LCD library files + pinouts file):
drive.google.com/open?id=1f4W...
2. FSMC LCD Wiki:
github.com/hampussandberg/Hex...
3. Convert Image to C Array online tool:
www.digole.com/tools/Pictureto...

Наука

Опубликовано:

 

6 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 183   
@mUbase
@mUbase 4 года назад
Thank you so much for describing the FSMC and ILI9341 and how to use it in Cube. I am using an STM3220G Eval board which uses a 3.2" LCD and the ili9325 drivers but its very similar to your driver in the way of functionality. Thanks again. :)
@AB-zh6lp
@AB-zh6lp 5 лет назад
Thanks for that. Makes it easy to start my first STM project. Project, Presentation very good
@drewh0208
@drewh0208 3 года назад
THANK YOU SO MUCH! I got it working with the DevEBox STM32F407 breakout board with the 16-bit-interface TFT_320QVT_9341 display board! With your linked code and some tweaks for my setup I get exactly the same thing shown at 16:41! I had to change the data address 0x6004000 to 0x6002000 to use with my particular Register Select A16 setting per 6:47 ("Understanding FSMC addressing" paragraph). I also think that after HAL_GPIO_WritePin(RST_GPIO_Port, RST_Pin, GPIO_PIN_SET); in main.c there should be added another HAL_Delay(10); after raising the Reset line, but doesn't seem necessary from experimentation. I made a couple more tweaks to change to a 16-bit interface, changing *(__IO uint8_t *) to *(__IO uint16_t *) in the SendCommand/SendData functions, and adding another SendData function for 16-bit color data and editing the printImage function to combine the upper/lower bytes. 3:34 changing these timing settings from the 15/255/15 default settings sped up the drawings a lot. My circle function still seems a liiiitle bit slower than what's shown in the video. www.amazon.com/gp/product/B081BCXST2/ref=ppx_od_dt_b_asin_title_s00?ie=UTF8&psc=1 www.amazon.com/DIYmalls-ILI9341-Display-Resistive-320x240/dp/B086ZK6VG5/ref=cm_cr_arp_d_product_top?ie=UTF8
@erqiangtang9928
@erqiangtang9928 3 года назад
Very helpful tutorial. Thank you so much :)!
@HB9GZE
@HB9GZE 5 лет назад
thx a lot; followed yr instructions and the code and I got it to work! thx for sharing!
@abrahamrodriguez6462
@abrahamrodriguez6462 6 лет назад
gorgeus explanation
@mokhamadkhozin
@mokhamadkhozin 3 года назад
This is amazing tutorial! thanks!
@hoangphamtranminh
@hoangphamtranminh 5 лет назад
First of all, you're my best online teacher. I've learned many things from you. Your code always work! I'm done with displaying on lcd and now i want to do some touch things on this. Do you have library for that? Or can you give me some suggestions how to do that? Anyway, thank you
@mutexembedded2206
@mutexembedded2206 5 лет назад
Hi Hoang, Thanks for the nice words. I am planning to make a video about that, but might not be very soon though, sorry. But for now, check this out: core-electronics.com.au/resistive-touch-screen-controller-stmpe610.html
@omro1985
@omro1985 6 лет назад
ممتاز . بالتوفيق
@tebunia
@tebunia 6 лет назад
This is brilliant.
@chloemcholoe3280
@chloemcholoe3280 5 лет назад
wow. i did all those stuff by hand before. the cubemx looks so easy..
@luizajakostam7803
@luizajakostam7803 3 года назад
you are my hero, thank you so much
@mutexembedded2206
@mutexembedded2206 3 года назад
Thanks for the kind comment :)
@adrianmelon1087
@adrianmelon1087 5 лет назад
Thank you! :)
@prashkd7684
@prashkd7684 4 года назад
I've got all the hardware required for this project. Now i just need to find some time to get started with it.
@m-aliamouzgar4138
@m-aliamouzgar4138 5 лет назад
perfect
@kinsi55
@kinsi55 4 года назад
Thanks a lot.
@xilinx80
@xilinx80 4 года назад
Thank you
@iquitnow1
@iquitnow1 6 лет назад
Hi do have any tutorials for using the LCD on the stm32f429 discovery board
@bobchen4924
@bobchen4924 6 лет назад
Thank you very mouch!!!
@bobchen4924
@bobchen4924 6 лет назад
May I know which pin is "RST" ?
@mutexembedded2206
@mutexembedded2206 5 лет назад
Hi Bob, Good spot, just need to connect it to VCC to enable the LCD.
@rajeshn2600
@rajeshn2600 2 года назад
Thanks for the useful tutorial. Can I use the mentioned libraries (MA_ILI9341.h and MA_ILI9341.c) for interfacing my 3.2" LCD display having ILI9341 driver IC with STM32F401 based Nucleo-64 board through SPI?
@HB9GZE
@HB9GZE 5 лет назад
Great video thank you. I did follow your instructions and got my display working! The timing seems to be different from display board to display board; tried two TFT-Proto from MikroElektroika. Question: Have you tried a 16bit wide bus yet?
@mutexembedded2206
@mutexembedded2206 5 лет назад
Hi, Yes, I think I know what you talking about, do you have the Green LCD with both 16-bits line and SPI ?
@HB9GZE
@HB9GZE 5 лет назад
thats the one I use: www.mikroe.com/tft-proto-board One gets me a frame rate of 14Hz and a second of the same board type only of 5Hz. I just downloaded the 16bit example from MifroElektronicas webpage. I wonder how 16bit is improving the max. framerate in my application…
@ameliabuns4058
@ameliabuns4058 4 года назад
My board has NE4 Wired up to the LCD interface and I can't figure out where to find the figured in the datasheet no matter where I look. I also don't understand what "banks are". EDIT: Oh sections!
@usrrsr
@usrrsr 3 года назад
Modify the code with touchgfx gui builder. This will be best initiative never done before. It exist only in document but no source code with tutorials.
@fvgm
@fvgm 4 года назад
hi, thanks for your tutorial about this LCD in FSMC mode! I tried step-by-step and works! But i if run it in max speed (STM32F407VET6 @ 168 Mhz) the background colors (fills, etc) show wrong. If i reduce the clock speed to, let say, 76 Mhz, everything runs fine. Can you help me ? Thanks.
@hoangphamtranminh8344
@hoangphamtranminh8344 5 лет назад
This is what i need. But i think you should have a video clip to demo. But it’s still a nice vid. Tks
@alouanerim9882
@alouanerim9882 5 лет назад
great tutorial how can i get the library of ili9325 and ov7670 ?? I SEARCH IN IAR website but i didn't found
@hooligun90
@hooligun90 4 года назад
Hello, I have a 16 bit screen. Do i have to change parrameters in the .c and .h file?
@vipultyagi6590
@vipultyagi6590 5 лет назад
Please make a tutorial for STM32F407 with LCD35RT
@sayalijoshi5010
@sayalijoshi5010 4 года назад
Hello, Sir actually I want to interface this arduino shield with stm32f407vg using touchscreen. Could you please help me out. I am not getting any good reference.
@vipultyagi6590
@vipultyagi6590 5 лет назад
Can i interface stm32f407 to a 7inch resistive touch display using the same library files..?
@pankajkande4141
@pankajkande4141 4 года назад
I checked all rotation but my lcd shows Mirror image. what can i do to get proper text.
@kingame69
@kingame69 5 лет назад
is there any difference between fsmc and fmc ILI9341 2.4' display interface
@jakubstencel2314
@jakubstencel2314 3 года назад
what changes need to be made in this library to run the 16bit display with FSMC ?
@nourchenebradai5063
@nourchenebradai5063 5 лет назад
I HAVE A TFT LCD model HY32D so what changes to make?
@hakid314
@hakid314 Год назад
How do I have to alter the code for using it with STM32F746? I already tried just changing the stm32f4 HAL to f7 and generated code in CubeMX for f7 accordingly, but it doesn‘t work.
@Email1212xxpl
@Email1212xxpl 5 лет назад
Hello. Can i make a flappy bird game basen on arduino system and convert it into stm32 with CubemX?
@m.j.4924
@m.j.4924 6 лет назад
Hi, Is it possible to connect a TFT LCD ILI9225 or any other with an ISP to a NUCLEO unit, or whether there is a library for this TFT LCD. I am also interested in what sample FFT for NUCLEO boards. I use NUCLEO-144, STM32F767ZIT. best regards
@mutexembedded2206
@mutexembedded2206 6 лет назад
LMM LIGHT MY MUSIC Yes, it is possible of course.. as long as you have Parallel interface (8bits or 16 bits). You need to do the initialization sequence of the ili9225; you effectively need to have your own LCD driver but the FSMC Write concept is the same. Good Luck
@gennadyh
@gennadyh 6 лет назад
Hi , can you please make some manual with SSD1306 , and with RFID TAG? , Best regards!
@vnhan1168
@vnhan1168 5 лет назад
Do you have any touchscreen, if so for me please library? thank you much
@rezaghayoumianaraki2035
@rezaghayoumianaraki2035 5 лет назад
good
@mohdrafiqrahman
@mohdrafiqrahman 6 лет назад
جزاك الله خير الجزاء Thanks for the detailed explanation on FSMC LCD. Hence, if I were to use a 16 bit interface, my register select should be A19 right? And could you please, please do part 4 for the ENC28J60 ethernet module and perhaps a simple tcp client on the stm32. Thanks again.
@mutexembedded2206
@mutexembedded2206 6 лет назад
Rafiq Rahman That's right
@kgfathur
@kgfathur 6 лет назад
thanks for your great explanation and tutorial. with the same stm32 board what configuration must be changed if using a 16-bit FSMC on ili9341?
@gautamkashyap6865
@gautamkashyap6865 5 лет назад
please upload for stm32f429i discovery board.
@Ricarrr
@Ricarrr 5 лет назад
Many Thanks! How can I modify a the functions to work with 16bits ?
@mutexembedded2206
@mutexembedded2206 5 лет назад
Hi Erisson, Sorry for the late response, you can modify the FSMC settings to use 16-bits and some little changes to the address of read/write and wiring,, all other things will remain the same.
@OnirMasc98
@OnirMasc98 5 лет назад
This library that you mention on the video is only for one specific TFT or I can use it for other TFT. If it only can be use for your TFT, how you create a library for TFT. Thanks
@mutexembedded2206
@mutexembedded2206 5 лет назад
Hi, This can be used for any TFT with ILI9341 as LCD controller.
@EJPG3
@EJPG3 5 лет назад
¿que es y para qe Funciona ?.. ¿y con que conectores funciona ?...
@slojanko
@slojanko 5 лет назад
Great tutorial, the LCD works great except for me unable to write some specific colors, like 0x001F turns the screen white and I can't do anything unless I reset the STM board. Would you happen to know why this happens?
@mutexembedded2206
@mutexembedded2206 5 лет назад
Hi, Sorry for later reply.. that could be overclocking or long wires
@slojanko
@slojanko 5 лет назад
Thank you, the newest version of CubeMX has output speed values along with FSMC so I played with those a bit. I also switched to TrueSTUDIO which is a free and without limits alternative to uVision.
@slojanko
@slojanko 5 лет назад
So I'm looking at the datasheet of the display and was wondering if it was possible to write the entire frame to the display, then request a refresh to avoid the huge tearing I'm currently having. There seems to be no mention of this being possible, would you know anything about this?
@arhamtemi2865
@arhamtemi2865 5 лет назад
In the .txt file you didn't mention where to connect PD2 (from STM which you called RST) on LCD?
@mutexembedded2206
@mutexembedded2206 5 лет назад
Hi Arham, right, you need to connect this to 3v in normal condition, and to GND to implement Reset.
@neharikamsadhwani5140
@neharikamsadhwani5140 3 года назад
Amazing video! Thank you so much for all your work. Could you please help me understand if we can use SPI for this particular LCD instead of FSMC. I was trying to understand if I could use SPI to interface ILI9341 with STM32L4. Is SPI or FSMC better?
@caffeinatedinsanity2324
@caffeinatedinsanity2324 3 года назад
Depends. SPI uses 3-4 pins while FSMC uses over 10 pins. However FMSC can probably transfer at much higher rates since it's a parallel interface.
@rajeshn2600
@rajeshn2600 2 года назад
@@caffeinatedinsanity2324 Can I use the same libraries if I am interfacing the same LCD through SPI ?
@mohsenmazandarani7506
@mohsenmazandarani7506 2 года назад
Thank you for your Nice video...... Can you do something about the touch interface? it looks like it works analog too.....
@abbasnajam6935
@abbasnajam6935 3 года назад
Hello! I'm using HVGA 3.2 Arduino Sheild and wanted to use 16 bit can you tell how can i convert these drivers for 16 bit. The LCD is working with 8 bits but not properly. If you could help.
@mutexembedded2206
@mutexembedded2206 3 года назад
Hi, It uses ILI9481 driver, so need to program that a bit first.
@sohampurkait4430
@sohampurkait4430 5 лет назад
Why data address has 1 in bit 18 ? Shouldn't it be command address ?
@marekoens1296
@marekoens1296 4 года назад
Great video, can you please help me with adding touch here? I tried using your libraries from the other video where you work with SPI for touch but it doesn't work... I also have a display with x+,x-,y+,y- but I use a touch screen controller for that so I can work with I2C or SPI.
@mutexembedded2206
@mutexembedded2206 4 года назад
Hi, What touch controller you are using?
@marekoens1296
@marekoens1296 4 года назад
the STMPE610 , resistive touch screen controller
@mutexembedded2206
@mutexembedded2206 4 года назад
@@marekoens1296 Library I provided would not work with this controller. You need to write a driver for this specific chip.
@erfanniafard5645
@erfanniafard5645 5 лет назад
hello i have a stm32f3 discovery board and 3.2 tft colo lcd module v5 how can i launch this lcd because on cube mx i can't find the FSMC thank you very much in advance
@raduceban3446
@raduceban3446 5 лет назад
I ran into the same problem, but it seems that STM32F303RE doesn't support FSMC (I guess you have the same board)
@sandrok14
@sandrok14 6 лет назад
I subscribed to your awesome channel and like every video! You helped a lot in these playlist series. Can you make a video about 1.8 TFT ST7735 display but without any shields. It has only DIN and CLK pins for data and several pins for control. Thanks in advance
@mutexembedded2206
@mutexembedded2206 6 лет назад
Amfibrachy Hello! Good to hear that you're finding the videos helpful.. For the ST7735 LCD, it should not be too hard to look at an existing code alongside with its datasheet to create a driver for it. I have not worked on this before, but you should be fine if you spent sometime on it. Good luck
@sandrok14
@sandrok14 6 лет назад
Thanks you. That's my laziness I suppose )) I haven't watched all your videos yet. So do you think if i'll follow all of them, I'll be able to make the display work without any library, all on my own + CubeMX?
@siminamiri3335
@siminamiri3335 4 года назад
When i use rotation 2 and 4 mode, my sentence starts from right to left and it is mirror like. :(
@nemchen_ko
@nemchen_ko 3 года назад
In Display function control you have to change from ILI9341_SendData (0x82); to ILI9341_SendData (0xA2);
@edwardsoto3279
@edwardsoto3279 3 года назад
you will obtain a better performance using the HAL FMC library
@m.j.4924
@m.j.4924 6 лет назад
Hi, thanks for the reply, on the parallel interface I would argue that, in the case of an ISP connection. Does FSMC also support ISP? Is it possible to download any library for ARDUINO "TFT_22_ILI9225.h" in the STM32 environment. It is about using the least connection wires to the LCD display.
@mutexembedded2206
@mutexembedded2206 6 лет назад
LMM LIGHT MY MUSIC Hi mate, Does ISP = SPI Interface ?
@m.j.4924
@m.j.4924 6 лет назад
Hu, SPI is correct, my mistake!!
@mutexembedded2206
@mutexembedded2206 6 лет назад
LMM LIGHT MY MUSIC FSMC is a different interface.. If you wanna use SPI, then you just use SPI to write to the LCD.
@andrezsa23
@andrezsa23 4 года назад
Hello very good videos I have an lcd 3.2inches with ILI9341 and interfaces of 16bit LCD register select is A18 modify *(__IO uint16_t *)(0x60080000) data; and it works I see the color blue, but I can't change the colors when I write text or a figure the color is wrong I wanted to ask you that something else I have to modify so that the colors are displayed correctly with 16bit interfas thank you very much
@hooligun90
@hooligun90 4 года назад
Hello, I have the same problem. Did you find a sollution for it?
@baldebaldemord9588
@baldebaldemord9588 3 года назад
It's probably a bit late to ask, but do you think It's possible to achive a decent frame-rate with bit-banging? I don't have a fsmc on my Chip (STM32f405RGT6).
@mutexembedded2206
@mutexembedded2206 3 года назад
Yes.. for gui. For video, not sure
@baldebaldemord9588
@baldebaldemord9588 3 года назад
@@mutexembedded2206 I got It to work finally! With your code as foundation I only had to implement SendCommand and Send Data. Here is what worked for me: //1. Write Command to LCD void ILI9341_SendCommand(uint8_t com) { SELECT(); GPIOC->BSRR = (uint32_t) 0xFF0 BSRR = com BSRR = (uint32_t) 0xFF0 BSRR = data BSRR = (uint32_t) GPIO_PIN_15 BSRR = GPIO_PIN_15 #define WR_HIGH GPIOA->BSRR = GPIO_PIN_9 // WR on PA9 #define WR_LOW GPIOA->BSRR = (uint32_t) GPIO_PIN_9 BSRR = GPIO_PIN_10 // RS on PA10 #define RS_LOW GPIOA->BSRR = (uint32_t) GPIO_PIN_10 BSRR = GPIO_PIN_8 // RD on PA8 You also have to change the Init function as follows: void ILI9341_Init(void) { WR_HIGH; RS_HIGH; RD_HIGH; . . . } I did reset the display on the RST line but did not put it in the Init function. I'm using PC4-11 as the data lines, but you can take any consecutive pins from one port. Best would be to use PC0-7 for example since no shifting is required. Writing to ODR would be faster but only if you dont have to mask other pins from the same port.
@TheAlfe28
@TheAlfe28 5 лет назад
Hi, I have a tft display with ILI9325 driver. I followed the steps in the video, but only the back white lights worked. How do I run this screen?
@mutexembedded2206
@mutexembedded2206 5 лет назад
Cannot run ILI9325 with this library,, it is meant to be for the ILI9341 only.
@sindujatenth
@sindujatenth 4 года назад
@@mutexembedded2206 Do you have any suggestions to modify this for ILI9325? Or do you know where to find library for ILI9325.
@mutexembedded2206
@mutexembedded2206 4 года назад
@@sindujatenth Hi, I often look for Github open source libraries and port them to STM32, if I did not like their structure I write them from scratch. Start with Github, you should be able to port them. GL
@bascom1858
@bascom1858 3 года назад
need a bit help. i use a 320x480 display how to modify,
@mutexembedded2206
@mutexembedded2206 3 года назад
Look at low level code related to size, need to adjust it accordingly.
@KBera
@KBera 5 лет назад
Sir, I followed your instructions as it is. But it is not working. It is showing a grey screen upon reset. I am using FMC of NUCLEO-H743ZI and 8bit parallel 240x320 TFT. Kindly HELP!!
@rezaahmadifar6947
@rezaahmadifar6947 4 года назад
hi I'm having your problem too!! i have stm32h743zi nucleo board did you find any solutions?
@easyprocesscodingacademy488
@easyprocesscodingacademy488 3 года назад
Can u tell how to move the cursor position up, down , left, right with the coordinates value of x and y
@mutexembedded2206
@mutexembedded2206 3 года назад
Hi, There is a function to do that I believe for writing pixel
@easyprocesscodingacademy488
@easyprocesscodingacademy488 3 года назад
@@mutexembedded2206 Hi, There is a fun called draw pixel and set cursor position. In draw pixel if I set to (0,0, colour) will it put the cursor at start and (0,1, colour) for the next row ?
@mutexembedded2206
@mutexembedded2206 3 года назад
@@easyprocesscodingacademy488 Hi, that's right, next pixel (row, col)
@raoufjmal6674
@raoufjmal6674 4 года назад
im loading the code in the board but the lcd doesn't work
@civilsku1670
@civilsku1670 6 лет назад
Hello Dear Brother I have ssd1963 7 inch lcd your library work on it? If have library for that please give me if not how make one ? Dear brother I need your help. Tanks
@mutexembedded2206
@mutexembedded2206 6 лет назад
civil sku Hello, Yeah, same FSMC interface but you need the 16 bit mode for ur LCD.. I don't have a driver for this one, but you should be able to find Arduino libraries in github that you can re-use for STM. I have to say, this takes sometime, but I am sure you can manage.
@civilsku1670
@civilsku1670 6 лет назад
Tanks For your Hoping My Bro I change your code to ssd1963 because the regeister is same you think is do right? s8.picofile.com/file/8318562492/SSD1963.c.html s9.picofile.com/file/8318562500/SSD1963.h.html
@civilsku1670
@civilsku1670 6 лет назад
Dear Bro I found The site too that ssd1963 run with stm32f704VGT6 but i cant sign up are you can sign up and give me this code ? bro i need your help please do ever you doing chipmk.ru/index.php/10-raznoe/270-podklyuchaem-lcdssd1963-k-stm32-po-fsmc-16bit-touch tanks your helping dear Bro
@rezaahmadifar6947
@rezaahmadifar6947 4 года назад
hi thank you for your tutorial I have an exact LCD and stm32h743zit6 nucleo board. i have been trying like forever to do this tutorial with my board but i cant. my lcd just blink for a few times and goes white. please please can anyone help me?
@mutexembedded2206
@mutexembedded2206 4 года назад
Hi Reza, I don't have your board around.. but I can try setting up a project that should work with yours
@mutexembedded2206
@mutexembedded2206 4 года назад
Play around with FMC clock speed in Clock Configuration CubeMX and try getting it around 168Mhz. Also disable FMC FIFO from FMC CubeMX parameters.
@rezaahmadifar6947
@rezaahmadifar6947 4 года назад
​@@mutexembedded2206 thank you for time and answer Even with 168 MHz didn't work!!! this is my main: #include "main.h" /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ #include "MA_ILI9341.h" /* USER CODE END Includes */ /* Private typedef -----------------------------------------------------------*/ /* USER CODE BEGIN PTD */ /* USER CODE END PTD */ /* Private define ------------------------------------------------------------*/ /* USER CODE BEGIN PD */ /* USER CODE END PD */ /* Private macro -------------------------------------------------------------*/ /* USER CODE BEGIN PM */ /* USER CODE END PM */ /* Private variables ---------------------------------------------------------*/ SRAM_HandleTypeDef hsram1; /* USER CODE BEGIN PV */ /* USER CODE END PV */ /* Private function prototypes -----------------------------------------------*/ void SystemClock_Config(void); static void MX_GPIO_Init(void); static void MX_FMC_Init(void); /* USER CODE BEGIN PFP */ /* USER CODE END PFP */ /* Private user code ---------------------------------------------------------*/ /* USER CODE BEGIN 0 */ /* USER CODE END 0 */ /** * @brief The application entry point. * @retval int */ int main(void) { /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /* Enable I-Cache---------------------------------------------------------*/ SCB_EnableICache(); /* Enable D-Cache---------------------------------------------------------*/ SCB_EnableDCache(); /* MCU Configuration--------------------------------------------------------*/ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* USER CODE BEGIN Init */ /* USER CODE END Init */ /* Configure the system clock */ SystemClock_Config(); /* USER CODE BEGIN SysInit */ /* USER CODE END SysInit */ /* Initialize all configured peripherals */ MX_GPIO_Init(); MX_FMC_Init(); /* USER CODE BEGIN 2 */ HAL_Delay(1000); HAL_GPIO_WritePin(GPIOA, GPIO_PIN_3, GPIO_PIN_RESET); HAL_Delay(10); HAL_GPIO_WritePin(GPIOA, GPIO_PIN_3, GPIO_PIN_SET); ILI9341_Init(); HAL_Delay(1000); ILI9341_setRotation(3); ILI9341_Fill(COLOR_BLUE); //Draw and fill circle ILI9341_drawCircle(50,50, 40, COLOR_GREEN); ILI9341_fillCircle(110,190, 80, COLOR_RED); //Print text ILI9341_printText("HELLO", 60, 90, COLOR_YELLOW, COLOR_YELLOW, 5); //Print-Fill triangle ILI9341_fillTriangle(10, 160, 110, 160, 190, 300, COLOR_BLACK); HAL_Delay(1000); // ILI9341_printImage(50, 50, 80, 130, myImage, sizeof(myImage)); /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ } /* USER CODE END 3 */ } /** * @brief System Clock Configuration * @retval None */ void SystemClock_Config(void) { RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; /** Supply configuration update enable */ HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY); /** Configure the main internal regulator output voltage */ __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE0); while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {} /** Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; RCC_OscInitStruct.PLL.PLLM = 1; RCC_OscInitStruct.PLL.PLLN = 42; RCC_OscInitStruct.PLL.PLLP = 2; RCC_OscInitStruct.PLL.PLLQ = 16; RCC_OscInitStruct.PLL.PLLR = 2; RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_3; RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOWIDE; RCC_OscInitStruct.PLL.PLLFRACN = 0; if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { Error_Handler(); } /** Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2 |RCC_CLOCKTYPE_D3PCLK1|RCC_CLOCKTYPE_D1PCLK1; RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV1; RCC_ClkInitStruct.APB3CLKDivider = RCC_APB3_DIV2; RCC_ClkInitStruct.APB1CLKDivider = RCC_APB1_DIV2; RCC_ClkInitStruct.APB2CLKDivider = RCC_APB2_DIV2; RCC_ClkInitStruct.APB4CLKDivider = RCC_APB4_DIV2; if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) { Error_Handler(); } PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_FMC; PeriphClkInitStruct.FmcClockSelection = RCC_FMCCLKSOURCE_D1HCLK; if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) { Error_Handler(); } } /* FMC initialization function */ static void MX_FMC_Init(void) { /* USER CODE BEGIN FMC_Init 0 */ /* USER CODE END FMC_Init 0 */ FMC_NORSRAM_TimingTypeDef Timing = {0}; /* USER CODE BEGIN FMC_Init 1 */ /* USER CODE END FMC_Init 1 */ /** Perform the SRAM1 memory initialization sequence */ hsram1.Instance = FMC_NORSRAM_DEVICE; hsram1.Extended = FMC_NORSRAM_EXTENDED_DEVICE; /* hsram1.Init */ hsram1.Init.NSBank = FMC_NORSRAM_BANK1; hsram1.Init.DataAddressMux = FMC_DATA_ADDRESS_MUX_DISABLE; hsram1.Init.MemoryType = FMC_MEMORY_TYPE_SRAM; hsram1.Init.MemoryDataWidth = FMC_NORSRAM_MEM_BUS_WIDTH_8; hsram1.Init.BurstAccessMode = FMC_BURST_ACCESS_MODE_DISABLE; hsram1.Init.WaitSignalPolarity = FMC_WAIT_SIGNAL_POLARITY_LOW; hsram1.Init.WaitSignalActive = FMC_WAIT_TIMING_BEFORE_WS; hsram1.Init.WriteOperation = FMC_WRITE_OPERATION_ENABLE; hsram1.Init.WaitSignal = FMC_WAIT_SIGNAL_DISABLE; hsram1.Init.ExtendedMode = FMC_EXTENDED_MODE_DISABLE; hsram1.Init.AsynchronousWait = FMC_ASYNCHRONOUS_WAIT_DISABLE; hsram1.Init.WriteBurst = FMC_WRITE_BURST_DISABLE; hsram1.Init.ContinuousClock = FMC_CONTINUOUS_CLOCK_SYNC_ONLY; hsram1.Init.WriteFifo = FMC_WRITE_FIFO_DISABLE; hsram1.Init.PageSize = FMC_PAGE_SIZE_NONE; /* Timing */ Timing.AddressSetupTime = 6; Timing.AddressHoldTime = 0; Timing.DataSetupTime = 6; Timing.BusTurnAroundDuration = 0; Timing.CLKDivision = 0; Timing.DataLatency = 0; Timing.AccessMode = FMC_ACCESS_MODE_A; /* ExtTiming */ if (HAL_SRAM_Init(&hsram1, &Timing, NULL) != HAL_OK) { Error_Handler( ); } /* USER CODE BEGIN FMC_Init 2 */ /* USER CODE END FMC_Init 2 */ } /** * @brief GPIO Initialization Function * @param None * @retval None */ static void MX_GPIO_Init(void) { GPIO_InitTypeDef GPIO_InitStruct = {0}; /* GPIO Ports Clock Enable */ __HAL_RCC_GPIOC_CLK_ENABLE(); __HAL_RCC_GPIOH_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); __HAL_RCC_GPIOE_CLK_ENABLE(); __HAL_RCC_GPIOB_CLK_ENABLE(); __HAL_RCC_GPIOD_CLK_ENABLE(); __HAL_RCC_GPIOG_CLK_ENABLE(); /*Configure GPIO pin Output Level */ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_3, GPIO_PIN_RESET); /*Configure GPIO pin Output Level */ HAL_GPIO_WritePin(GPIOB, GPIO_PIN_14|GPIO_PIN_7, GPIO_PIN_RESET); /*Configure GPIO pin Output Level */ HAL_GPIO_WritePin(GPIOG, GPIO_PIN_6, GPIO_PIN_RESET); /*Configure GPIO pin : PC13 */ GPIO_InitStruct.Pin = GPIO_PIN_13; GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); /*Configure GPIO pin : PA3 */ GPIO_InitStruct.Pin = GPIO_PIN_3; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); /*Configure GPIO pins : PB14 PB7 */ GPIO_InitStruct.Pin = GPIO_PIN_14|GPIO_PIN_7; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); /*Configure GPIO pin : PG6 */ GPIO_InitStruct.Pin = GPIO_PIN_6; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(GPIOG, &GPIO_InitStruct); /*Configure GPIO pin : PG7 */ GPIO_InitStruct.Pin = GPIO_PIN_7; GPIO_InitStruct.Mode = GPIO_MODE_INPUT; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOG, &GPIO_InitStruct); } /* USER CODE BEGIN 4 */ /* USER CODE END 4 */ /** * @brief This function is executed in case of error occurrence. * @retval None */ void Error_Handler(void) { /* USER CODE BEGIN Error_Handler_Debug */ /* User can add his own implementation to report the HAL error return state */ /* USER CODE END Error_Handler_Debug */ } #ifdef USE_FULL_ASSERT /** * @brief Reports the name of the source file and the source line number * where the assert_param error has occurred. * @param file: pointer to the source file name * @param line: assert_param error line source number * @retval None */ void assert_failed(uint8_t *file, uint32_t line) { /* USER CODE BEGIN 6 */ /* User can add his own implementation to report the file name and line number, tex: printf("Wrong parameters value: file %s on line %d ", file, line) */ /* USER CODE END 6 */ } #endif /* USE_FULL_ASSERT */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
@rezaahmadifar6947
@rezaahmadifar6947 4 года назад
@@mutexembedded2206 Can i send my project to you please? can i have your email or something else?
@adnanafzal3908
@adnanafzal3908 4 года назад
i just wanted to know how to use 16 bit mode. Does the ILI9341 library work with 16bit mode
@mutexembedded2206
@mutexembedded2206 4 года назад
You need to make few changes to do that.
@adnanafzal3908
@adnanafzal3908 4 года назад
@@mutexembedded2206 can you kindly help me out with only the initialization part i am having troubles regarding it. thanks in advance
@adnanafzal3908
@adnanafzal3908 4 года назад
please make a video on dcmi as well
@wuerike
@wuerike 6 лет назад
Great video! I have a stm32L4 and it havent the FSMC option, could you teach how to do it by the SPI interface?
@mutexembedded2206
@mutexembedded2206 6 лет назад
Hi, Modify Read/Write functions to use SPI Write&Read instead of FSMC Read/Write,, as simple as that.
@mrudulaamirapu2472
@mrudulaamirapu2472 6 лет назад
Yes, I too would like to know how to do the same. If you can, please give a little more information. Thanks!
@mutexembedded2206
@mutexembedded2206 6 лет назад
Mrudula Amirapu Hi, Sure.. I will explain to you how to do that with some coding later today.
@mrudulaamirapu2472
@mrudulaamirapu2472 6 лет назад
Thank you very much! I find your tutorials very helpful! :)
@mutexembedded2206
@mutexembedded2206 6 лет назад
There are 4 changes you need to make to replace FSMC with SPI: Step(1): The wiring of LCD SPI interface is different MBED Display + 3,3V 3,3V GND GND MOSI SDI MISO SDO SCK RS CS CS Reset RST DC WR/SCL GND RD Step(2): Need to enable a Digital Output pin DC pin (Data/Command) - At the start of ILI9341_SendCommand() function, set DC to LOW. - At ILI9341_SendData() function, set DC to HIGH. Step(3): replace "*(__IO uint8_t *)(0x60000000) = com;" in ILI9341_SendCommand() function with HAL_SPI_Transmit() function and transmit the command byte. Step(4): Similarly replace "*(__IO uint8_t *)(0x60040000) = data;" in ILI9341_SendData() function with HAL_SPI_Transmit() function and transmit the data byte. So, the modified functions should look something like this: ILI9341_SendCommand(uint8_t com) { HAL_GPIO_WritePin(DC_Port, DC_Pin, 0); HAL_SPI_Transmit(&hspi, com, 1, Timeout); } ILI9341_SendData(uint8_t data) { HAL_GPIO_WritePin(DC_Port, DC_Pin, 1); HAL_SPI_Transmit(&hspi, data 1, Timeout); } That's pretty much it,, Good luck
@jonathanrodriguez8219
@jonathanrodriguez8219 3 года назад
Hi Muhammed, Do you have for 16-bit FSMC??
@bochraakrout7840
@bochraakrout7840 5 лет назад
i have the ili 9341 3.2 tft with it's arduino shield can i use the same library??
@mutexembedded2206
@mutexembedded2206 5 лет назад
i believe so
@bochraakrout7840
@bochraakrout7840 5 лет назад
@@mutexembedded2206 hi there thanks for your response i am trying to get it work but i just can't compile the MA_ILI9341.h the problem is on the declaration of the fount1[] the error say it has alredy declared and thanks alot for your help
@bochraakrout7840
@bochraakrout7840 5 лет назад
​@@mutexembedded2206 i fixed it and i downloaded the code but it doesn't work the ili9341 3.2 is a 16 bit not 8 i think that's why i am trying to find the right library
@arhamtemi2865
@arhamtemi2865 5 лет назад
Is there any problem if I change the clock configuration to 72 MHz instead of setting it to 168MHz? If there is any change in the code kindly let me know.
@mutexembedded2206
@mutexembedded2206 5 лет назад
Hi Arham mate, It should not make a difference as long as FSMC speed is consistent.
@arhamtemi2865
@arhamtemi2865 5 лет назад
Sir we are using parallel communication instead of I2C or SPI? What if we use, then which one is more efficient?
@mutexembedded2206
@mutexembedded2206 5 лет назад
@@arhamtemi2865 Hi Arham, Parallel is way faster x4 times than SPI. I2C is slowest, 30 times slower than SPI. Can use SPI for less wires.
@meohoang7741
@meohoang7741 3 года назад
can u give me the library of lcd tft ili9341 16 bit?
@hoangphamtranminh8344
@hoangphamtranminh8344 5 лет назад
Is it a possible to touch on screen? Because i see you only display the pic on screen. Hope you answer my question. I need to know because i’m ready to buy that screen. Tks
@mutexembedded2206
@mutexembedded2206 5 лет назад
Hi, Yes, this one has got resistive touch, but touch pins (x+, x-, y+, y-) are shared with communication pins, look that up. There is a good alternative too, that works with this library: www.mikroe.com/tft-proto-board Good luck
@hoangphamtranminh8344
@hoangphamtranminh8344 5 лет назад
Tks for your quink reply but I still have some question. You said that touch pins are shared with communication pins. So you mean that is impossible to do touch action on that screen with stm32f4, isn't it? Hope you rep soon because i'm ready to buy that touch screen (in you vid) to use for kit stm32f4 :D
@mutexembedded2206
@mutexembedded2206 5 лет назад
Hi mate, What I meant by touch pins are shared at this particular module is that, X+, X-, Y+, Y- are connected directly to LCD_WR, LCD_RD, and so on. So in order to take Touch reading, you need to stop communicating to the LCD temporarily and convert LCD_WR pin from Output to Input in order to read touch value. But there are better ili9341 screen boards where touch pins are separate.
@nicknagy8903
@nicknagy8903 4 года назад
I'm using this with an STM32F767ZI and getting weird results. It looks as if the functions and examples are ALMOST working. For example, printImage(50, 50, 80, 130, myImage, sizeof(myImage)) creates an image that's way too thin, in the bottom corner, and looks discolored. Or Fill(COLOR_RED) will create some red pixels at the edge but not cover the screen. I've disabled the FMC FIFO, the FMC clock SHOULD be at 168MHz, I'm using single jumper wires between each connection to try and minimize signal travels, and I've checked the connections multiple times. I have also tested in Arduino with at ATMega and a different class-distributed library for the TFT, and have verified that with that code the TFT works fine. So I know that the problem must have to do with the STM32/Nucleo, not the TFT itself. I can't figure out what I am doing incorrectly. I'm using TrueSTUDIO instead of Keil, would that make a difference??
@yordaniferreiras6995
@yordaniferreiras6995 4 года назад
I have your same Development Board and it works perfectly with what he did in this tutorial.
@nicknagy8903
@nicknagy8903 4 года назад
@@yordaniferreiras6995 All is well! I figured out the issue, I had to enable memory-swapping and replace the 0x6x.. addresses with 0xCx...
@shamssalehin2376
@shamssalehin2376 5 месяцев назад
Please do same for SSD1963
@psyduckel
@psyduckel 6 лет назад
Hi there MYaqoobEmbedded, Would the tutorial work using the NUCLEO-L476RG, if not what would you need to change? Thanks for any help.
@mutexembedded2206
@mutexembedded2206 6 лет назад
Hi, No, the L476 does not seem to have an FSMC NOR interface.
@psyduckel
@psyduckel 6 лет назад
Do you have any recommendations on how to get an TFT LCD ILI9341 screen working on the NUCLEO-L476RG?
@mutexembedded2206
@mutexembedded2206 6 лет назад
Psyduck Hi, You can replace FSMC Read/Write functions with SPI read/write .. but needs to set your display to spi mode.
@psyduckel
@psyduckel 6 лет назад
MYaqoobEmbedded thanks for the reply, unfortunately the screen I'm using does have spi :'(
@mutexembedded2206
@mutexembedded2206 6 лет назад
Psyduck You can try implementing the parallel interface timing yourself; Set the data on 8bits or 16 bits pins and trigger WR pin to write data to lcd.. There are a lot more details about this on lcd data sheet.. Just google lcd parallel interface 8080
@sonnguyen6992
@sonnguyen6992 4 года назад
Hello guide, I use FSMC for LCD TFT 5'' SSD1963 mode 16 bit. But It has a error. This is a image when run function Init drive.google.com/file/d/17jd5oKFFLMNyya8cKo2-zeFUZq4R164u/view?usp=sharing
@mahmoudelghzaly4918
@mahmoudelghzaly4918 5 лет назад
لو سمحت ممكن تفاصيل اكتر عن ال FSMC انا شغال بشاشه تانيه رقمها ili9486 لما دورت لقيت انها هي هياها ال ili9341 و راجعت علي ال commands و قارنتها بينهم في الداتا شيت كانوا زي بعض بس في نفس الوقت مش بتعرض علي الشاشه غير لما غيرت ال frequance و العرض كان في نص الشاشة ف هل في امكانيه لو يكون في شرح مفضل اكتر عن FSMC لو ممكن اتواصل مع حضرتك عشان احل المشكلة ؟ و شكرا جدا لمجهود حضرتك
@mutexembedded2206
@mutexembedded2206 5 лет назад
مرحبا محمد Showing content on half of the screen only is usually caused by data bus width; if you are using 8 data lines and LCD is set to use 16 data lines mode, it will only fill half of the screen. Thanks
@mahmoudelghzaly4918
@mahmoudelghzaly4918 5 лет назад
@@mutexembedded2206 شكرا لردك :D بس اظن المشكله مش في ال data bus width هي الشاشه مش النص بالظبط يعني و النص التاني بيظهر فيه خطوط عشوائيه غير انا انا مستخدم shield جاهز و متصمم علي 8 bit زي اللي حضرتك مستخدمه لما فتحت الداتا شيت لقت ان في اكتر من مود تمام اقدر استخمه 8-16 bit بس عشان اعدم هيبقي من خلال IM pins و هما مش ظاهرين علي البورده دي الشاشه للي بستخدمها ram-e-shop.com/product/kit-lcd-tft3-2-touch/
@mahmoudelghzaly4918
@mahmoudelghzaly4918 5 лет назад
Hi again i have found the problem it was in the initialization function under display section i have changer the value of " ILI9341_SendData (0x27)" to " ILI9341_SendData (0x3b)" and it worked fine ::D but now i need to change the refresh rate of the lcd ... any idea ?
@mutexembedded2206
@mutexembedded2206 5 лет назад
@@mahmoudelghzaly4918 Good job Mahmoud! Do you mean how fast display controller scan across LCD or how fast STM updates data to LCD ?
@mahmoudelghzaly4918
@mahmoudelghzaly4918 5 лет назад
@@mutexembedded2206 i think how fast display controller scan across LCD the lcd blinking can be noticed
@raoufjmal6674
@raoufjmal6674 4 года назад
I use Atollic True Studio and i have a problem in the path MA_ILI9341.h
@mutexembedded2206
@mutexembedded2206 4 года назад
What sort of Path problem? Or actually a compiling error?
@raoufjmal6674
@raoufjmal6674 4 года назад
@@mutexembedded2206 a compiling error, i think that because i don't know the place of MA_ILI9341.h when added
@mutexembedded2206
@mutexembedded2206 4 года назад
@@raoufjmal6674 easiest way is to add MA_ILI9341.h in inc folder and .c in src folder.
@raoufjmal6674
@raoufjmal6674 4 года назад
@@mutexembedded2206 i do these but doesn't work
@mutexembedded2206
@mutexembedded2206 4 года назад
@@raoufjmal6674 What is the error Msg
@arhamtemi2865
@arhamtemi2865 5 лет назад
Sir can I get your mail? I have something to discuss with you.
@mutexembedded2206
@mutexembedded2206 5 лет назад
That's fine, can do. But if it is related to the video above, would certainly help others to raise it here.
@usrrsr
@usrrsr 5 лет назад
The Code is well explained however it will be further useful if you create video of .. A ILI9341 2.4 keil Project configured with cubemx , gui created with GUIBuilder, and touch screen code To add further you can really demostrate the use of gui development tool like "μGUI - free Open Source GUI module for embedded systems" [embeddedlightning.com/ugui/] EasyGUI - Easy GUI for microcontrollers [github.com/MaJerle/EasyGUI] littlev - [littlevgl.com/porting] Since these three tools are free of cost and really contributes a main step of product development thanks
@designworks7347
@designworks7347 6 лет назад
Sdcard plz
@mutexembedded2206
@mutexembedded2206 6 лет назад
I thought I already have one
Далее
Me: Don't cross there's cars coming
00:16
Просмотров 12 млн
I 3D Printed a $1,224 Chair
23:56
Просмотров 192 тыс.
Punch Card Programming - Computerphile
14:55
Просмотров 873 тыс.
STM32 FSMC || LCD PART 1 || How to configure
22:17
Просмотров 4,3 тыс.
Hacker's Guide to UART Root Shells
17:40
Просмотров 466 тыс.
STM32 Guide #2: Registers + HAL (Blink example)
30:02
Просмотров 186 тыс.
Сложная распаковка iPhone 15
1:01
Просмотров 13 тыс.
ИГРОВОВЫЙ НОУТ ASUS ЗА 57 тысяч
25:33
Blackview N6000SE Краш Тест!
1:00
Просмотров 38 тыс.