stm32 fsmc tft lcd factory
I am working on STM32F103ZT6 and with SSD1963. I have connected 480X272 and 320X240 LCD’s. I am initializing SSD1963 with the Init Commands on same pins as you use, but in GPIO mode & not in FSMC mode. The Clock Freq from Crystal is 8MHz and in STM32 acitvating PLL is made to 72MHz. So, Clk Freq for SSD1963 is 8MHz. Hope we should configure the PLL in SSD1963. So below is my Initialisation Sequence details.
I"ve written some code to make a FSMC connection between my STM32F407VET6 and a TFT LCD 240x320 pixels. I was checking this several times, however I can"t recognize what"s wrong.
I"m using 16-bit data bus with FSMC_NE1, FSMC_A16, FSMC_NWE, FSMC_NOE. I"ve connected PE6 pin which is FSMC_A22 in FSMC interface. Now I"m wondering weather it can work with such configuration (I mean PE6 pin). All I get is white screen on my LCD as it is in RESET state.
This second article in the series of documentation-by-example posts will present a C++ driver for 320×240 (QVGA) TFT LCD panels that have an ILI9325 controller built in to them. This driver is included with my open source stm32plus C++ library and this article will show you how to use it with the STM32F103* ARM Cortex M3 microcontroller family running at 72Mhz. As of stm32plus 2.0.0 the driver is fully compatible with the STM32 F4 series of microcontrollers.
I like Ilitek controllers. They’re consistent across the range, they’re well documented and they’re easy to program if you’re familiar with TFT controllers, which I am.
Here’s the panel that I’ll be demonstrating. Mine happened to arrive as part of a “Mini STM32” development board that I got on ebay but they’re also available in various incarnations either ‘bare’ or pre-mounted on to a PCB that breaks out the controller pins for you.
The schematic for the STM32 dev board documents the pinout for the TFT panel. Helpfully, the port numbers are annotated as well as the function of each pin. 16 data lines are broken out, so that implies we’re talking to the controller over its 16 bit bus (it has 18-bit, serial and RGB capabilities as well). Register-select (/RS), chip-select (CS), read (nOE) and write (nWE) are all there. There are additional pins for the reset line (RST) and the backlight. A pleasant surprise is the presence of the touch-screen interface on SPI1 up at the top right; we’ll be kicking the tires of the ADS7843 touch screen IC in a future article.
This dev board plays host to the STM32F103VET6 MCU. The V in ST’s nomenclature means that the device has 100 pins. Those of you that are familiar with the limitations of the 100 pin device will know that means that the Flexible Static Memory Controller (FSMC) only has one 64Mbyte NOR/SRAM bank at address 0x60000000. That’s fine, it gives me the chance to show stm32plus addressing a different bank than the usual #4 that I use on the STM32F103ZET6 board I use most often.
Since we’re using the FSMC, we need to choose an address line to attach to the RS line to control whether we are writing data or register selection to the controller. We’ll use line 16, resulting in the following addressing.
Here’s the code used to initialise the LCD. When this code has completed the LCD will be reset, initialised with your chosen colour mode, gamma and orientation and ready to use.
That’s all there is to it. If you’ve also read my previous article on driving the HX8347A controller then this will all look familiar. That’s because stm32plus hides away all the device-specific details and presents you with a unified interface for controlling graphic devices. Here’s a quickie image taken from the rolling demo. As usual the camera is less than kind to the TFT. The actual display is sharp and contrasty.
Firstly we need to include the headers that define the classes we’re going to use. Secondly, since all of stm32plus lives either in the stm32plus namespace or a sub-namespace (in this case stm32plus::display) we will import them into the global namespace to make the declarations of the objects less clumsy looking.
We use an ‘access-mode’ class to control how we communicate with the panel. Here we initialise it to use the FSMC in 16-bit mode with A16 as the RS line (PD11). We will also be wiring up the panel’s RESET line to PE1.
We declare an Fsmc8080Lcdtiming object that takes care of the timing details. The two parameters are the address setup and data setup times in HCLK cycles. At full speed the STM32F1 has a 36MHz FSMC bus and the STM32F4 has a 60MHz bus. Therefore the timings may be different for each MCU if the bus is faster than the panel.
Our example initialises it in portrait mode, 18 bit colour (262K). If you take a look at TftInterfaces.h you will see that following modes are available:
stm32plus includes an interactive gamma adjustment application, and that will be introduced in a future blog post. For now, you can just use the default settings and maybe come back to it later.
stm32plus comes with a PWM backlight controller template class, and a subclass of that called DefaultBacklight that assumes you can connect the backlight regulator to PD13.
I have tried to compile the example file GxTFT_FSMC_BlackSTM32F407V.ino. The necessary assisting files should be in place including STM32GENERIC in the hardware folder. After having worked for quite some time Arduino IDE stops with an error message. I list the last page of the verbose output:
"C:\Users\Peas\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++" -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DF_CPU=168000000L -mthumb -DSTM32GENERIC -DRAM_LENGTH=131072 -DFLASH_LENGTH=524288 -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -nostdlib -fno-threadsafe-statics --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -Dprintf=iprintf -MMD -DSTM32F4 -DARDUINO=10807 -DARDUINO_BLACK_F407VE -DARDUINO_ARCH_STM32 -DSTM32F407VE -DHSE_VALUE=8000000 -DMENU_SERIAL_AUTO=SerialUSB "-IC:\Users\Peas\Documents\Arduino\hardware\STM32GENERIC-master\STM32\cores\arduino/stm32" "-IC:\Users\Peas\Documents\Arduino\hardware\STM32GENERIC-master\STM32\cores\arduino/usb" "-IC:\Users\Peas\Documents\Arduino\hardware\STM32GENERIC-master\STM32\system/CMSIS" "-IC:\Users\Peas\Documents\Arduino\hardware\STM32GENERIC-master\STM32\system/STM32F4/CMSIS_Inc" "-IC:\Users\Peas\Documents\Arduino\hardware\STM32GENERIC-master\STM32\system/STM32F4/CMSIS_Src" "-IC:\Users\Peas\Documents\Arduino\hardware\STM32GENERIC-master\STM32\system/STM32F4/HAL_Inc" "-IC:\Users\Peas\Documents\Arduino\hardware\STM32GENERIC-master\STM32\system/STM32F4/HAL_Src" "-IC:\Users\Peas\Documents\Arduino\hardware\STM32GENERIC-master\STM32\system/STM32F4/stm32_chip" "-IC:\Users\Peas\Documents\Arduino\hardware\STM32GENERIC-master\STM32\cores\arduino" "-IC:\Users\Peas\Documents\Arduino\hardware\STM32GENERIC-master\STM32\variants\BLACK_F407VE" "-IC:\Users\Peas\Documents\Arduino\libraries\GxTFT\src" "-IC:\Users\Peas\Documents\Arduino\hardware\STM32GENERIC-master\STM32\libraries\SPI\src" "-IC:\Users\Peas\Documents\Arduino\libraries\Adafruit_GFX_Library" "-IC:\Users\Peas\Documents\Arduino\hardware\STM32GENERIC-master\STM32\libraries\stm32_dma\src" "C:\Users\Peas\Documents\Arduino\libraries\GxTFT\src\GxIO\STM32GENERIC\GxIO_STM32F407ZGM4_FSMC\GxIO_STM32F407ZGM4_FSMC.cpp" -o "C:\Users\Peas\AppData\Local\Temp\arduino_build_724464\libraries\GxTFT\GxIO\STM32GENERIC\GxIO_STM32F407ZGM4_FSMC\GxIO_STM32F407ZGM4_FSMC.cpp.o"
C:\Users\Peas\Documents\Arduino\libraries\GxTFT\src\GxIO\STM32GENERIC\GxIO_STM32F407ZGM4_FSMC\GxIO_STM32F407ZGM4_FSMC.cpp: In constructor "GxIO_STM32F407ZGM4_FSMC::GxIO_STM32F407ZGM4_FSMC(bool)":
C:\Users\Peas\Documents\Arduino\libraries\GxTFT\src\GxIO\STM32GENERIC\GxIO_STM32F407ZGM4_FSMC\GxIO_STM32F407ZGM4_FSMC.cpp:97:11: error: "PG12" was not declared in this scope
C:\Users\Peas\Documents\Arduino\libraries\GxTFT\src\GxIO\STM32GENERIC\GxIO_STM32F407ZGM4_FSMC\GxIO_STM32F407ZGM4_FSMC.cpp:98:11: error: "PG0" was not declared in this scope
Abstract: AM-240320L8TNQW00H ILI9320 Ampire LCD AM-240320L8TNQW00H TFT LCD Connecting the FSMC to the LCD nand512w3a2cnb intel 8080 AN2790 Color TFT LCD Module intel 8080
Text: Typical use of the FSMC to interface with an LCD module . . . . . . . . . . . 10 2.3 Connecting the FSMC to the LCD Intel 8080-like(I80) interface . . . . . . . 10 2.4 Connecting the FSMC to the , . . . . . . . . . . . . . . . . . . . . . . . . 8 Connecting the FSMC to an LCD Intel 8080-like interface . . . . . . . . . . . . . . . . . . . . . . . . . 11 Connecting the FSMC to an LCD Motorola 6800-like interface . . . . . . . . . . . . . . . . . . . . . 12 Connecting the FSMC to an LCD Motorola 6800
Abstract: Ampire mb694 AM-240320L8TNQW00H P9603-20-15-1 microSD card reader circuit diagram STM32F103VET6 LGA16 footprint AM-240320L8TNQW00H TFT LCD ILI9320 30 pin LCD connector
Text: with SDIO and the TFT with FSMC . The STLM75 and STMPE1208SQTR use I2C-2 and the STW4102 uses I2C-1 to , available to connect the TFT module MB694. The LCD module is mounted on the board. It is interfaced through , used for the micro-SD card. The TFT is connected to the controller through the FSMC interface. Refer , slideshow. The core of this demonstration board is the STM32 microcontroller which is able to read the memory card of the photographs and display them on the screen. The memory used to store the JPEG images
Text: Emlink for ARM(EAH1) JTAG adapter, so the developers can easy start to learn and test all the relevant , Supports USB port connecting to host PC Downloads and debugs speed up to 250KBytes/s(about 1.5Mbps , convenience to provide further information. They do not signify that we endorse the website(s). We have no , STM32F103C8T6 32-Bit Cortex ARM 1.1MB Application Notes: File Name Size How to migrate from the STM32F10xxx firmware library V2.0.3 to the STM32F10xxx 1.5MB standard peripheral library V3.0.0 Clock
Abstract: IHI Rotary Encoder Samsung Nexus S JTAG pins sharp CMOS Camera Module CSI lm 741 using schmitt trigger Nexus S camera SCR FIR 3 D LCD MIPI PANEL sharp mmu ericsson Camera mod ccp2
Abstract: Connecting the FSMC to the LCD Intel STM32f4xx reference manual STM32f4xx user manual STM32F4xx STM32F4 UFBGA176 ball package UFBGA 176 ball package STM32F437IG STM32F10xx
Text: frequency for synchronous accesses is 60 MHz. LCD parallel interface The FSMC can be configured to , regulator is activated by connecting BYPASS_REG to VSS. The internal reset is controlled by applying an , Master clock (MCK) used to drive the external audio DAC. . . . . . . . . . . . . . . . . . . . . . . . . 78 Master clock (MCK) not used to drive the external audio DAC. . . . . . . . . . . . . . . . . . . . , to Section 2.1: Full compatibility throughout the family. The STM32F437xx datasheet should be read in
Text: interface The FSMC can be configured to interface seamlessly with most graphic LCD controllers. It supports the Intel 8080 and Motorola 6800 modes, and is flexible enough to adapt to specific LCD interfaces , , the internal regulator must be activated by connecting BYPASS_REG to VSS and by setting PDR_ON to VDD , pin. On UFBGA176 and LQFP176 packages, the internal regulator is activated by connecting BYPASS_REG to , Master clock (MCK) used to drive the external audio DAC. . . . . . . . . . . . . . . . . . . . . . . . .
Text: controller ( FSMC ) The flexible static memory controller offers: QQ 4 independent banks to support external , connecting a standard USB mass storage device to the STM32. Adding a USB keyboard, mouse or any other , www.st.com/mcu Welcome to the world of STM32 Releasing your creativity The STM32 family of 32-bit Flash , extending in capability, price range and features to cover the needs of microcontroller convergence. The , full integration and ease of development. It eases migration from the 16-bit world thanks to its high
Text: Flexible static memory controller ( FSMC ) up to 16-bit data bus width, supporting NAND Flash External , Peripherals supported TFT/STN LCD controller (resolution up to 1024 x 768 and up to 24 bpp) Touchscreen , based on the powerful ARM926EJ-S processor (up to 333 MHz), widely used in applications where high , allows the system to be used in many applications, some typical applications being factory automation , timer IrDA Up to 102 GPIOs 2x Ethernet 10/100 (SMII/MII interface) 2x CAN 3x UART LCD
Text: ) SPEAr320 provides a Flexible Static Memory Controller ( FSMC ) which interfaces the AHB bus to external , controller ( FSMC ) up to 16-bit data bus width, supporting NAND Flash â External memory interface (EMI , prescaler, 4 capture inputs â Up to 102 GPIOs with interrupt capability Applications The SPEAr320, Order code â Peripherals supported â TFT/STN LCD controller (resolution up to 1024 x 768 and , (Embedded Trace Macrocellâ¢) for debug operations. A full set of peripherals allows the system to be used
Text: 240x320 TFT color LCD connected to bank1 NOR/PSRAM4 of FSMC interface of the STM32F103ZGT6 and four , -pin male header is available on the board to connect the LCD module board MB895 to the FSMC interface of , JP27 SRAM 512Kx16 SRAM is connected to bank1 NOR/PSRAM3 of the FSMC interface and both 8-bit and , NAND Flash The 512 Mbit x8 or 1 Gbit x8 NAND Flash is connected to bank2 of the FSMC interface. The , Flash is connected to bank1 NOR/PSRAM2 of the FSMC interface. The 16bit operation mode is selected by a
Text: . Display and input devices The 240x320 TFT color LCD connected to bank1 NOR/PSRAM4 of FSMC interface of , connect the LCD module board MB694 to the FSMC interface of the STM32F103Z. Refer to Section 2.17 , JP27 SRAM 512Kx16 SRAM is connected to bank1 NOR/PSRAM3 of the FSMC interface and both 8-bit and , NAND Flash The 512 Mbit x8 or 1 Gbit x8 NAND Flash is connected to NAND bank2 of the FSMC interface , connected to bank1 NOR/PSRAM2 of the FSMC interface. The 16bit operation mode is selected by a pull-up
Abstract: STM32F103-ZE S29GL128P STM32F103ZE stm3210e-eval stm32 smartcard jtag s29gl128p STM3210E USART STM32F103xE stm32f103xx technical reference manual
Text: Figure 28 is displayed on the LCD when this submenu is selected. Figure 28. Alarm Show submenu To , interface that is used with a parallel LCD . The Animation submenu is used to demonstrate the LCD control , LCD . Figure 44. USB cable connected To Stop Press SEL Once the cable has been connected, the PC , the demonstration firmware running on the STM3210E-EVAL evaluation board. It can be used to evaluate , reset (board power-up, external reset, etc.) the demonstration is executed. To run the DFU, the Key
Text: trademarks of Olimex Ltd. Other product names may be trademarks of others and the rights belong to their , subject to continuous development and improvements. All particulars of the product and its use contained , document is intended only to assist the reader in the use of the product. OLIMEX Ltd. shall not be liable , by OLIMEX to be a finished end-product fit for general consumer use. Persons handling the product , MATERIALS AND THE COMPONENTS USED TO CREATE STM32-H407. THEY ARE CONSIDERED SUITABLE ONLY FOR STM32-H407
Abstract: STM3210E USART STM32F103Z STM32F103ZET6 S29GL128P90 HXM122032-GB1 STM32F103 with sd card MC306-G-06Q-32.768 schematic diagram motor control ARM7 16bit DATASHEET
Text: available on the board to connect the LCD module board MB895 to the FSMC interface of the STM32F103Z. Refer , CoreSight debug tools. Display and input devices The 240x320 TFT color LCD connected to bank1 NOR/PSRAM4 , to bank1 NOR/PSRAM3 of the FSMC interface and both 8-bit and 16-bit access are allowed by BLN0 and , x8 NAND Flash is connected to bank2 of the FSMC interface. The ready/busy signal can be connected to , FSMC interface. The 16bit operation mode is selected by a pull-up resistor connected to the BYTE pin of
Text: . Display and input devices The 240x320 TFT color LCD connected to bank3 of FSMC interface of STM32F103Z, connect the LCD module board MB694 to the FSMC interface of the STM32F103Z. Refer to Section 1.17 , JP27 SRAM 512Kx16 SRAM is connected to bank2 of the FSMC interface and both 8 bit and 16 bit , The 512 Mbit x8 or 1 Gbit x8 NAND Flash is connected to bank0 of the FSMC interface. The ready/busy , Hardware layout and configuration NOR Flash 128 Mbit Nor Flash is connected to bank1 of the FSMC
Text: interface â Serial Flash memory interface (SMI) â Flexible static memory controller ( FSMC ) up to 16 , Peripherals supported â TFT/STN LCD controller (resolution up to 1024 x 768 and up to 24 bpp) â , applications. It is based on the powerful ARM926EJ-S processor (up to 333 MHz), widely used in applications , operations. A full set of peripherals allows the system to be used in many applications, some typical , diagram EMI NOR Flash/ FPGA interface Up to 102 GPIOs FSMC NAND Flash interface 2x Ethernet 10
Text: ) provides a 2-pin (clock + data) interface to the AHPAP port. 1.6 Display devices 1.6.1 LCD A color LCD module is mounted on the STM3210E-EVAL board. It is interfaced through the embedded FSMC , Figure 28 is displayed on the LCD when this submenu is selected. Figure 28. Alarm Show submenu To , a parallel LCD . The Animation submenu is used to demonstrate the LCD control performance using the , push-button, the message shown in Figure 44 is displayed on the LCD . Figure 44. USB cable connected To
Abstract: DCMI timing specification STM32F20xxx programming manual stm32f205rx STM32F20xxx reference manual STM32F207ZE programming manual stm32f205 STM32F20x STM32F20xxx STM32F207ZG
Text: . . . . . . . . . . . . . . . . . . . . . . . 100 Characteristics of TIMx connected to the APB1 domain . . . . . . . . . . . . . . . . . . . . . . . . . 101 Characteristics of TIMx connected to the , . . . . . . . . . . . . . . . . . . . . . . . . . . 162 Master clock (MCK) used to drive the , microcontrollers. For more details on the whole STMicroelectronics STM32TM family, please refer to Section 2.1 , conjunction with the STM32F20x/STM32F21x reference manual. They will be referred to as STM32F20x devices
Text: . . . . . . . . . . . . . . 100 Characteristics of TIMx connected to the APB1 domain . . . . . . . . . . . . . . . . . . . . . . . . . 101 Characteristics of TIMx connected to the APB2 domain . . . , (MCK) used to drive the external audio DAC. . . . . . . . . . . . . . . . . . . . . . . . 163 Master clock (MCK) not used to drive the external audio DAC. . . . . . . . . . . . . . . . . . . . . 163 MII , , please refer to Section 2.1: Full compatibility throughout the family. The STM32F205xx and STM32F207xx
Text: Serial Flash memory interface (SMI) Flexible static memory controller ( FSMC ) up to 16-bit data bus , (resolution up to 1024 x 768 and up to 24 bpp) Touchscreen support The SPEAr320 embedded MPU is , (Embedded Trace Macrocell) for debug operations. A full set of peripherals allows the system to be used in , applications. Figure 1. Functional block diagram EMI NOR Flash/ FPGA interface Up to 102 GPIOs FSMC , 8/16-bits NAND Flash controller ( FSMC ) External memory interface (EMI) for connecting NOR
Abstract: STM32 F4 touch frame STM32F20xxx reference manual Connecting the FSMC to the LCD Intel STM32F20x Connecting the FSMC to the LCD DCMI timing specification STM32F10xx diode S6 78A stm32f217xx
Text: 89. Table 90. Table 91. Table 92. STM32F21xxx Characteristics of TIMx connected to the APB1 domain . . . . . . . . . . . . . . . . . . . . . . . . . 100 Characteristics of TIMx connected to the , Master clock (MCK) used to drive the external audio DAC. . . . . . . . . . . . . . . . . . . . . . . . 159 Master clock (MCK) not used to drive the external audio DAC. . . . . . . . . . . . . . . . . . . . , family, please refer to Section 2.1: Full compatibility throughout the family. The STM32F215xx and
Abstract: SPEAr320-2 Atmel touchscreen upd programmable timer 24 pin stn lcd pinout details capacitive touchscreen ARM926 ARM926EJ ARM926EJ-S LFBGA289
Text: : PL_GPIO multiplexing scheme and to the Figure 1: Functional block diagram) Memory: 32 , interface Serial Flash Memory interface (SMI) Flexible static memory controller ( FSMC ) up to 16 , prescaler, 4 capture inputs Up to 102 GPIOs with interrupt capability Applications The SPEAr320, Peripherals supported TFT/STN LCD controller (resolution up to 1024 x 768 and up to 24 bpp) Touchscreen , industrial automation and consumer applications. It is based on the powerful ARM926EJ-S processor (up to 333
Text: 106 Characteristics of TIMx connected to the APB1 domain . . . . . . . . . . . . . . . . . . . . . . . . . 107 Characteristics of TIMx connected to the APB2 domain . . . . . . . . . . . . . . . . . . , STM32F20x/STM32F21x reference manual. They will be referred to as STM32F20x devices throughout the document. For information on programming, erasing and protection of the internal Flash memory, please refer to , Cortexâ¢-M3 core please refer to the Cortexâ¢-M3 Technical Reference Manual, available from the www.arm.com
Text: controllers. One of the typical uses of UART is connecting the SPEAr-based platforms to debugging consoles , all the necessary control signals to interface directly to a variety of TFT LCD panels. Main features , Description The SPEAr1340 device is a system-on-chip belonging to the SPEAr® (Structured Processor Enhanced , hardware-compliant to the support of both real-time (RTOS) and high-level (HLOS) operating systems, such as Android , enables different data flows to be carried out concurrently, improving the overall platform efficiency. In
Text: . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 Characteristics of TIMx connected to the , STMicroelectronics STM32⢠family, please refer to Section 2.1: Full compatibility throughout the family. The , manual. They will be referred to as STM32F21x devices throughout the document. For information on programming, erasing and protection of the internal Flash memory, please refer to the STM32F20x/STM32F21x, the STMicroelectronics website www.st.com. For information on the Cortexâ¢-M3 core please refer to
This FSMC issue should have been implemented before the compiler was released for sale as it is only half a tool as it is and is becoming very limited.
This second article in the series of documentation-by-example posts will present a C++ driver for 320×240 (QVGA) TFT LCD panels that have an ILI9325 controller built in to them. This driver is included with my open source stm32plus C++ library and this article will show you how to use it with the STM32F103* ARM Cortex M3 microcontroller family running at 72Mhz. As of stm32plus 2.0.0 the driver is fully compatible with the STM32 F4 series of microcontrollers.
I like Ilitek controllers. They’re consistent across the range, they’re well documented and they’re easy to program if you’re familiar with TFT controllers, which I am.
Here’s the panel that I’ll be demonstrating. Mine happened to arrive as part of a “Mini STM32” development board that I got on ebay but they’re also available in various incarnations either ‘bare’ or pre-mounted on to a PCB that breaks out the controller pins for you.
The schematic for the STM32 dev board documents the pinout for the TFT panel. Helpfully, the port numbers are annotated as well as the function of each pin. 16 data lines are broken out, so that implies we’re talking to the controller over its 16 bit bus (it has 18-bit, serial and RGB capabilities as well). Register-select (/RS), chip-select (CS), read (nOE) and write (nWE) are all there. There are additional pins for the reset line (RST) and the backlight. A pleasant surprise is the presence of the touch-screen interface on SPI1 up at the top right; we’ll be kicking the tires of the ADS7843 touch screen IC in a future article.
This dev board plays host to the STM32F103VET6 MCU. The V in ST’s nomenclature means that the device has 100 pins. Those of you that are familiar with the limitations of the 100 pin device will know that means that the Flexible Static Memory Controller (FSMC) only has one 64Mbyte NOR/SRAM bank at address 0x60000000. That’s fine, it gives me the chance to show stm32plus addressing a different bank than the usual #4 that I use on the STM32F103ZET6 board I use most often.
Since we’re using the FSMC, we need to choose an address line to attach to the RS line to control whether we are writing data or register selection to the controller. We’ll use line 16, resulting in the following addressing.
Here’s the code used to initialise the LCD. When this code has completed the LCD will be reset, initialised with your chosen colour mode, gamma and orientation and ready to use.
That’s all there is to it. If you’ve also read my previous article on driving the HX8347A controller then this will all look familiar. That’s because stm32plus hides away all the device-specific details and presents you with a unified interface for controlling graphic devices. Here’s a quickie image taken from the rolling demo. As usual the camera is less than kind to the TFT. The actual display is sharp and contrasty.
Firstly we need to include the headers that define the classes we’re going to use. Secondly, since all of stm32plus lives either in the stm32plus namespace or a sub-namespace (in this case stm32plus::display) we will import them into the global namespace to make the declarations of the objects less clumsy looking.
We use an ‘access-mode’ class to control how we communicate with the panel. Here we initialise it to use the FSMC in 16-bit mode with A16 as the RS line (PD11). We will also be wiring up the panel’s RESET line to PE1.
We declare an Fsmc8080Lcdtiming object that takes care of the timing details. The two parameters are the address setup and data setup times in HCLK cycles. At full speed the STM32F1 has a 36MHz FSMC bus and the STM32F4 has a 60MHz bus. Therefore the timings may be different for each MCU if the bus is faster than the panel.
Our example initialises it in portrait mode, 18 bit colour (262K). If you take a look at TftInterfaces.h you will see that following modes are available:
stm32plus includes an interactive gamma adjustment application, and that will be introduced in a future blog post. For now, you can just use the default settings and maybe come back to it later.
stm32plus comes with a PWM backlight controller template class, and a subclass of that called DefaultBacklight that assumes you can connect the backlight regulator to PD13.