{"id":3201,"date":"2025-02-01T13:30:44","date_gmt":"2025-02-01T13:30:44","guid":{"rendered":"https:\/\/blog.embeddedexpert.io\/?p=3201"},"modified":"2025-02-01T14:05:08","modified_gmt":"2025-02-01T14:05:08","slug":"interfacing-the-128x64-st7920-glcd-with-stm32f4-via-spi-part-1-introduction-connection-and-stm32cubemx-setup","status":"publish","type":"post","link":"https:\/\/blog.embeddedexpert.io\/?p=3201","title":{"rendered":"Interfacing the 128\u00d764 ST7920 GLCD with STM32F4 via SPI \u2013 Part 1: Introduction, Connection, and STM32CubeMX Setup"},"content":{"rendered":"<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"1024\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/DALL\u00b7E-2025-02-01-16.09.09-A-technical-illustration-of-a-128\u00d764-graphical-LCD-GLCD-module-with-an-ST7920-controller-connected-to-an-STM32F4-microcontroller-via-SPI.-The-diagra.webp\" alt=\"\" class=\"wp-image-3202\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/DALL\u00b7E-2025-02-01-16.09.09-A-technical-illustration-of-a-128\u00d764-graphical-LCD-GLCD-module-with-an-ST7920-controller-connected-to-an-STM32F4-microcontroller-via-SPI.-The-diagra.webp 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/DALL\u00b7E-2025-02-01-16.09.09-A-technical-illustration-of-a-128\u00d764-graphical-LCD-GLCD-module-with-an-ST7920-controller-connected-to-an-STM32F4-microcontroller-via-SPI.-The-diagra-300x300.webp 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/DALL\u00b7E-2025-02-01-16.09.09-A-technical-illustration-of-a-128\u00d764-graphical-LCD-GLCD-module-with-an-ST7920-controller-connected-to-an-STM32F4-microcontroller-via-SPI.-The-diagra-150x150.webp 150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/DALL\u00b7E-2025-02-01-16.09.09-A-technical-illustration-of-a-128\u00d764-graphical-LCD-GLCD-module-with-an-ST7920-controller-connected-to-an-STM32F4-microcontroller-via-SPI.-The-diagra-768x768.webp 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/DALL\u00b7E-2025-02-01-16.09.09-A-technical-illustration-of-a-128\u00d764-graphical-LCD-GLCD-module-with-an-ST7920-controller-connected-to-an-STM32F4-microcontroller-via-SPI.-The-diagra-750x750.webp 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/DALL\u00b7E-2025-02-01-16.09.09-A-technical-illustration-of-a-128\u00d764-graphical-LCD-GLCD-module-with-an-ST7920-controller-connected-to-an-STM32F4-microcontroller-via-SPI.-The-diagra-400x400.webp 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/DALL\u00b7E-2025-02-01-16.09.09-A-technical-illustration-of-a-128\u00d764-graphical-LCD-GLCD-module-with-an-ST7920-controller-connected-to-an-STM32F4-microcontroller-via-SPI.-The-diagra-250x250.webp 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>The ST7920-based 128\u00d764 GLCD is a versatile graphical display commonly used in embedded systems for visualizing text and graphics. When interfaced with an STM32F4 using SPI, it enables efficient communication while minimizing pin usage. This guide covers the setup, wiring, and SPI communication necessary to integrate the display with STM32F4. The first part of your guide will cover the introduction, hardware connection, and STM32CubeMX setup.<\/p>\n\n\n\n<p>In this guide. we shall cover the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Introduction to GLCD.<\/li>\n\n\n\n<li>Gathering the required documents.<\/li>\n\n\n\n<li>Connection.<\/li>\n\n\n\n<li>STM32CubeIDE Setup.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">1. Introduction to GLCD:<\/h2>\n\n\n\n<p>At first glance, the 128\u00d764 Graphical LCD Module seems like a bigger brother to the famous 16\u00d72 LCD or 20\u00d74 LCD Modules, with their similar construction and almost similar pin layout.<\/p>\n\n\n\n<p>But there is a significant difference between those two. 16\u00d72 or 20\u00d74 LCDs are essentially character displays. They can only display alpha-numeric characters and some simple custom characters that are confined to a 5\u00d78 matrix.<\/p>\n\n\n\n<p>Coming to the 128\u00d764 Graphical LCD, as the name suggests, it is a Graphical Display consisting of 128\u00d764 i.e., 8192 individually controllable dots.<\/p>\n\n\n\n<p>By using different combinations of pixels, we can basically display characters of various sizes. But the magic doesn\u2019t end there. You can display images and graphics (small animations) as well. In a 128\u00d764 LCD Module, there are 64 rows and 128 columns.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"855\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/10\/BlueColor128By64GraphicalLCD.webp-1-1024x855.jpeg\" alt=\"\" class=\"wp-image-2032\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/10\/BlueColor128By64GraphicalLCD.webp-1-1024x855.jpeg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/10\/BlueColor128By64GraphicalLCD.webp-1-300x250.jpeg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/10\/BlueColor128By64GraphicalLCD.webp-1-768x641.jpeg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/10\/BlueColor128By64GraphicalLCD.webp-1-1150x960.jpeg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/10\/BlueColor128By64GraphicalLCD.webp-1-750x626.jpeg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/10\/BlueColor128By64GraphicalLCD.webp-1-400x334.jpeg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/10\/BlueColor128By64GraphicalLCD.webp-1-250x209.jpeg 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/10\/BlueColor128By64GraphicalLCD.webp-1.jpeg 1500w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">ST7920 LCD Controller<\/h3>\n\n\n\n<p>There are several versions of the Graphical LCD in the market. Even though the usage, application and implementations are almost identical, the main difference lies in the internal LCD Controller used to drive the dot matrix display.<\/p>\n\n\n\n<p>Some of the commonly used LCD Controllers are KS0108, SSD1306, ST7920, SH1106, SSD1322, etc. The pin out of the final LCD Module might vary depending on the LCD Controller used. So, please verify the LCD Controller as well as the pin out before making a purchase.<\/p>\n\n\n\n<p>The Graphical LCD Module I purchased consists of ST7920 Controller. It is manufactured by Sitronix and supports three types of bus interfaces i.e., 8-bit mode, 4-bit mode and Serial interface.<\/p>\n\n\n\n<p>If you have used 16\u00d72 LCD Display earlier, then you might be familiar with both 4-bit as well as 8-bit parallel interfaces. The serial interface is something new and we will explore this option in this project.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">128\u00d764 LCD Pinout<\/h3>\n\n\n\n<p>As I already mentioned, double-check with the manufacturer about the pinout of the Graphical LCD Module. The following table describes the pinout of the 128\u00d764 LCD Module that I have.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>Pin Number<\/td><td>Pin Name<\/td><td>Pin Description<\/td><\/tr><tr><td>1<\/td><td>GND<\/td><td>Ground<\/td><\/tr><tr><td>2<\/td><td>VCC<\/td><td>Supply Voltage<\/td><\/tr><tr><td>3<\/td><td>VO<\/td><td>Contrast Adjust<\/td><\/tr><tr><td>4<\/td><td>RS<\/td><td>Register Select (CS in Serial)<\/td><\/tr><tr><td>5<\/td><td>RW<\/td><td>Read \/ Write Control (Serial Data In)<\/td><\/tr><tr><td>6<\/td><td>E<\/td><td>Enable (Serial CLK)<\/td><\/tr><tr><td>7 \u2013 14<\/td><td>D0 \u2013 D7<\/td><td>Data<\/td><\/tr><tr><td>15<\/td><td>PSB<\/td><td>Interface Selection (0: Serial, 1: 8-bit\/4-bit Parallel)<\/td><\/tr><tr><td>16<\/td><td>NC<\/td><td>Not Connected<\/td><\/tr><tr><td>17<\/td><td>RST<\/td><td>Reset<\/td><\/tr><tr><td>18<\/td><td>VOUT<\/td><td>LCD Voltage Doubler Output<\/td><\/tr><tr><td>19<\/td><td>BLA<\/td><td>Backlight LED Anode<\/td><\/tr><tr><td>20<\/td><td>BLK<\/td><td>Backlight LED Cathode<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"517\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/10\/Untitled.png\" alt=\"\" class=\"wp-image-2033\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/10\/Untitled.png 640w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/10\/Untitled-300x242.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/10\/Untitled-400x323.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/10\/Untitled-250x202.png 250w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2. Gathering the Required Documents:<\/h2>\n\n\n\n<p>The following documents are needed:<\/p>\n\n\n\n<p>ST7920 datasheet from <a href=\"https:\/\/www.waveshare.com\/datasheet\/LCD_en_PDF\/ST7920.pdf\" data-type=\"link\" data-id=\"https:\/\/www.waveshare.com\/datasheet\/LCD_en_PDF\/ST7920.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n\n\n\n<p>STM32F411 Nucleo-64 User manual from <a href=\"https:\/\/www.st.com\/resource\/en\/user_manual\/um1724-stm32-nucleo64-boards-mb1136-stmicroelectronics.pdf\" data-type=\"link\" data-id=\"https:\/\/www.st.com\/resource\/en\/user_manual\/um1724-stm32-nucleo64-boards-mb1136-stmicroelectronics.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>That all for the required documents.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3. Connection:<\/h2>\n\n\n\n<p><\/p>\n\n\n\n<p>Since STM32F411 Nucleo-64 has Arduino Pins, we can use it as identifier for SPI pins.<\/p>\n\n\n\n<p>The pins as following:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"798\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-22-17-1024x798.jpg\" alt=\"\" class=\"wp-image-3203\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-22-17-1024x798.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-22-17-300x234.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-22-17-768x599.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-22-17-1536x1197.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-22-17-2048x1596.jpg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-22-17-1150x896.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-22-17-750x585.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-22-17-400x312.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-22-17-250x195.jpg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The needed pins are PA5, PA6 and PA7 which are for the SPI.<\/p>\n\n\n\n<p>We shall use PA0 and PA1 for RS (Register Select) and RST (Reset) respectively.<\/p>\n\n\n\n<p>Hence, the connection as following:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"900\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/10\/GLCD_bb-1-1024x900.png\" alt=\"\" class=\"wp-image-2036\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/10\/GLCD_bb-1-1024x900.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/10\/GLCD_bb-1-300x264.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/10\/GLCD_bb-1-768x675.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/10\/GLCD_bb-1-1536x1350.png 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/10\/GLCD_bb-1-1150x1011.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/10\/GLCD_bb-1-750x659.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/10\/GLCD_bb-1-400x352.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/10\/GLCD_bb-1-250x220.png 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/10\/GLCD_bb-1.png 1986w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>STM32F411 Nucleo-64<\/td><td>GLCD12864<\/td><\/tr><tr><td>5V<\/td><td>Vdd and LED+ (A)<\/td><\/tr><tr><td>GND<\/td><td>Vss, LED- (K) and PSB<\/td><\/tr><tr><td>PA0<\/td><td>RS<\/td><\/tr><tr><td>PA1<\/td><td>RST<\/td><\/tr><tr><td>PA7 (MOSI)<\/td><td>RW<\/td><\/tr><tr><td>PA5 (SCK)<\/td><td>En<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4. STM32CubeIDE Setup:<\/h2>\n\n\n\n<p>Open STM32CubeIDE after selecting the workspace and create new project as following:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"355\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-26-00-1024x355.jpg\" alt=\"\" class=\"wp-image-2940\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-26-00-1024x355.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-26-00-300x104.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-26-00-768x266.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-26-00-1536x532.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-26-00-2048x709.jpg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-26-00-1150x398.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-26-00-750x260.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-26-00-400x139.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-26-00-250x87.jpg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Select the MCU:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"832\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-27-14-1024x832.jpg\" alt=\"\" class=\"wp-image-2941\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-27-14-1024x832.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-27-14-300x244.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-27-14-768x624.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-27-14-1536x1248.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-27-14-2048x1664.jpg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-27-14-1150x934.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-27-14-750x609.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-27-14-400x325.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-27-14-250x203.jpg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Give the project a name:<\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"811\" height=\"1024\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_15-58-48-811x1024.jpg\" alt=\"\" class=\"wp-image-3204\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_15-58-48-811x1024.jpg 811w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_15-58-48-238x300.jpg 238w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_15-58-48-768x969.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_15-58-48-750x947.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_15-58-48-400x505.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_15-58-48-250x316.jpg 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_15-58-48.jpg 984w\" sizes=\"(max-width: 811px) 100vw, 811px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Once the STM32CubeMX window is open, from connectivity, select SPI1 and enable it in half duplex master as following:<\/p>\n\n\n\n<p>Configure the SPI as following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Set prescaler to achieve 8Mb\/s of baudrate.<\/li>\n\n\n\n<li>Set CPOL to low.<\/li>\n\n\n\n<li>Set CPHA to 2 Edge.<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"729\" height=\"1024\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-05-53-729x1024.jpg\" alt=\"\" class=\"wp-image-3205\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-05-53-729x1024.jpg 729w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-05-53-214x300.jpg 214w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-05-53-768x1079.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-05-53-1094x1536.jpg 1094w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-05-53-1458x2048.jpg 1458w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-05-53-1150x1615.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-05-53-750x1053.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-05-53-400x562.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-05-53-250x351.jpg 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-05-53.jpg 1498w\" sizes=\"(max-width: 729px) 100vw, 729px\" \/><\/figure>\n\n\n\n<p>Next, enable PA0 and PA1 as output give them as following including the SPI1 pins as following:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"822\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-07-04-1024x822.jpg\" alt=\"\" class=\"wp-image-3206\" style=\"width:840px;height:auto\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-07-04-1024x822.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-07-04-300x241.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-07-04-768x616.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-07-04-1536x1233.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-07-04-2048x1644.jpg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-07-04-1150x923.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-07-04-750x602.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-07-04-400x321.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-01_16-07-04-250x201.jpg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>From Project Manager tab, select Code Generation and enable Generate peripheral initialization as pair of .c\/.h files per peripheral as following:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"363\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-45-24-1024x363.jpg\" alt=\"\" class=\"wp-image-2949\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-45-24-1024x363.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-45-24-300x106.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-45-24-768x273.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-45-24-1536x545.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-45-24-2048x727.jpg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-45-24-1150x408.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-45-24-750x266.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-45-24-400x142.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/10\/2024-10-26_16-45-24-250x89.jpg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Save the project and this will generate the code.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Stay tuned for part2.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Happy coding \ud83d\ude09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The ST7920-based 128\u00d764 GLCD is a versatile graphical display commonly used in embedded systems for visualizing text and graphics. When interfaced with an STM32F4 using SPI, it enables efficient communication while minimizing pin usage. This guide covers the setup, wiring, and SPI communication necessary to integrate the display with STM32F4. The first part of your [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,19,11,12],"tags":[],"class_list":["post-3201","post","type-post","status-publish","format-standard","hentry","category-embedded-systems","category-lcd","category-peripheral-drivers","category-stm32"],"_links":{"self":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/3201"}],"collection":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3201"}],"version-history":[{"count":2,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/3201\/revisions"}],"predecessor-version":[{"id":3208,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/3201\/revisions\/3208"}],"wp:attachment":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}