stm32l476 discovery tft lcd free sample

The LCD I am using is a 2.8″ TFT LCD with SPI communication. I also have another 16-bit Parallel TFT LCD but it will be another story for another time. For this post, let’s focus on how to display what you want on the 2.8″ LCD. You can find all details about this LCD from this page:http://www.lcdwiki.com/2.8inch_SPI_Module_ILI9341_SKU:MSP2807
First thing first, this LCD use SPI as the main communication protocol with your MCU. For STM32 users, HAL Library has already implemented this protocol which makes this project easier for us. But, a little knowledge about this protocol does not hurt anyone. SPI is short for Serial Peripheral Interface which, aside from two data lines, also has a clock line and select lines to choose between devices you want to communicate with.
This LCD uses ILI9341 as a single-chip SOC driver for a display with a resolution of 240×320. More details can be found in the official document of ILI9341. But the most important thing is that we have to establish astart sequencein order for this LCD to work. The “start sequence” includes many other sequences which are also defined in the datasheet. Each sequence starts when you send a command to ILI9341 and then some parameters to follow up. This sequence is applied for all communication between MCU and ILI9341.
For this project, I recommend using theSystem Workbench for STM32for coding and building the code. After installing and open the program, go to the source code you have just downloaded and double click the.cprojectfile. It will automatically be open in your IDE. Then build the program by right click on the folder you just open (TFTLCD) and chooseBuild Project. Wait for it to finish and upload it to the board by right clicking the folder, choose Run As and then clickAc6 STM32C/C++ Application. And that’s it for running the example.
The most important library for this project is obviously the ILI9341_Driver. This driver is built from the provided source code in the lcdwiki.com page. I only choose the part that we need to use the most in many applications like writing string, displaying image and drawing symbols. Another library from the wiki page is the TOUCH library. Most of the libraries I got from the Internet were not working properly due to some adjustments to the original one.
To draw symbols or even display images, we need a “byte array” of that image or symbol. As an illustration, to display an image from a game called Transistor, I have a “byte array” of that image stored in a file named transistor.h. You can find this file in the link below. Then, I draw each pixel from the image to the LCD by adding the code in the Display_Picture() function in the Display folder.void Display_Picture()

These hardware tools allow modular designs and customization, thanks to extension connectors that enable access to most device I/Os. Several STM32 discovery kits come with application-specific features. They also integrate on-board debuggers and programmers, making them ideal for project prototyping and evaluation.

The official STM32L Discovery boards (http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/PF250990?sc=internet/evalboard/product/250990.jsp) come with tiny glass LCDs. ST"s official firmware package for this kit contains examples using this LCD. Till now there has been no library support for it in MikroC for ARM compiler and very little info on this kit is available in the internet. I made a literal code translation of the glass LCD library from the official firmware package and converted it for MikroC for ARM. I also made some improvements and ported it with my version of SPL which is very easy to use. Enjoy!

FATFS library can be used everywhere, but really, everywhere, not just SDCARD or USB flash drive. I’ve made an update to use source for FATFS SDRAM on STM32F429-Discovery or STM32F4x9-EVAL boards. Click here for more info.

STM32L4 microcontrollers offer dynamic voltage scaling to balance power consumption with processing demand, low-power peripherals (LP UART, LP timers) available in Stop mode, safety and security features, smart and numerous peripherals, advanced and low-power analog peripherals such as op amps, comparators, LCD, 12-bit DACs and 16-bit ADCs (hardware oversampling).
The Discovery kit combines STM32L476 features with LCD, LEDs, audio DAC, sensors (microphone, 3 axis gyroscope, 6 axis compass), joystick, USB OTG, Quad-SPI Flash memory, expansion and probing connectivity.
The STM32L476G-EVAL evaluation board has been designed as a complete demonstration and development platform for STMicroelectronics ARM® Cortex®-M4 core-based STM32L476ZGT6 microcontroller with three I2C, three SPI, six USART, CAN, SWPMI, two SAI, 12bit ADC, 12bit DAC, LCD driver, internal 128 Kbyte SRAM and 1 Mbyte Flash memory, Quad SPI, Touch sensing, USB OTG FS, LCD controller, FMC, JTAG debugging support.
The full range of hardware features on the board can be used to evaluate all peripherals (USB OTG FS, USART, digital microphones, 12bits ADC and DAC, dot-matrix TFT LCD, LCD glass, IrDA, LDR, SRAM, Nor Flash, Quad SPI memory, MicroSD card, Sigma-delta modulators, Smartcard with SWP, CAN, I2C EEPROM, RF-EEPROM) and develop user’s applications.

You may notice some flickering that happens because we start modifying a buffer without waiting for the LCD controller to finish the previous frame and actually switch the frame buffer. To wait for the end of frame add the following line at the end of SwitchBuffer():

In September 2012, ST announced full-production of STM32 F3-series chips and STM32F3DISCOVERY board. The STM32 F050-series will also be available in a TSSOP20 package.
Common peripherals included in all IC packages are USB 2.0 FS, two SPI, two I²C, three USART, eight 16-bit timers, two watchdog timers, temperature sensor, 16 to 24 channels into one ADC, two DACs, 37 to 83 GPIOs, seven DMA, real-time clock (RTC), cyclic redundancy check (CRC) engine. The STM32FL152 line adds a LCD controller.
capacitive touch sense and 32-bit random number generator (only L0x2 and L0x3 chips), LCD controller (only L0x3 chips), 128-bit AES engine (only L06x chips).
NUCLEO-L476RG board for STM32L476RGT6 MCU with 80 MHz Cortex-M4F core, 1024 KB flash (HW ECC), 96 KB SRAM, 32 KB SRAM (HW parity), external quad-SPI memory interface, external static memory interface.
The following Discovery evaluation boards are sold by STMicroelectronics to provide a quick and easy way for engineers to evaluate their microcontroller chips. These kits are available from various distributors for less than US$20. The STMicroelectronics evaluation product licence agreement forbids their use in any production system or any product that is offered for sale.
Each board includes an on-board ST-LINK for programming and debugging via a Mini-B USB connector. The power for each board is provided by a choice of the 5 V via the USB cable, or an external 5 V power supply. They can be used as output power supplies of 3 V or 5 V (current must be less than 100 mA). All Discovery boards also include a voltage regulator, reset button, user button, multiple LEDs, SWD header on top of each board, and rows of header pins on the bottom.
A discovery board for STM32F429ZIT6 microcontroller with 180 MHz ARM Cortex-M4F core, 2048 KB flash, 256 KB RAM, 4 KB battery-backed RAM in LQFP144 package.
This board includes an integrated ST-LINK/V2 debugger via Mini-B USB connector, 8 MB SDRAM (IS42S16400J), 2.4-inch 320x200 TFT LCD color display (SF-TC240T), touchscreen controller (STMPE811), gyroscope (L3GD20), 2 user LEDs, user button, reset button, Full-Speed USB OTG to second Micro-AB USB connector, and two 32x2 male pin headers.
A discovery board for STM32F407VGT6 microcontroller with 168 MHz ARM Cortex-M4F core, 1024 KB flash, 192 KB RAM, 4 KB battery-backed RAM in LQFP100 package.
A discovery board for STM32L152RBT6 microcontroller with 32 MHz ARM Cortex-M3 core, 128 KB flash (with ECC), 16 KB RAM, 4 KB EEPROM (with ECC) in LQFP64 package.
This board includes an integrated ST-LINK/V2 debugger via Mini-B USB connector, 24-segment LCD, touch sensors, 2 user LEDs, user button, reset button, and two 28x1 male pin headers.
A discovery board for STM32L152RCT6 microcontroller with 32 MHz ARM Cortex-M3 core, 256 KB flash (with ECC), 32 KB RAM, 8 KB EEPROM (with ECC) in LQFP64 package.
This board includes an integrated ST-LINK/V2 debugger via Mini-B USB connector, 24-segment LCD, touch sensors, 2 user LEDs, user button, reset button, and two 28x1 male pin headers.
A discovery board for STM32L100RCT6 microcontroller with 32 MHz ARM Cortex-M3 core, 256 KB flash (with ECC), 16 KB RAM, 4 KB EEPROM (with ECC) in LQFP64 package.
A prototyping environment for a variety of STM32 variants, which allows users to create their applications using an application programming interface (API) to implement device peripherals and a range of evaluation features on the EvoPrimer base including TFT color touchscreen, graphical user interface, joy stick, codec-based audio, SD card, IrDA and standard peripherals such as USB, USART, SPI, I2C, CAN, etc.
Simulink, by MathWorks provides model-based design solutions to design embedded systems. The Embedded Coder Support Package for STMicroelectronics Discovery Boards and the Simulink Coder Support Package for STMicroelectronics Nucleo Boards provide parameter tuning, signal monitoring and one-click deployment of Simulink algorithms to STM32 boards with access to peripherals like ADC, PWM, GPIOs, I²C, SPI, SCI, TCP/IP, UDP, etc.

Using st7789 tearing pin interrupt for synchronization of lcd display. But getting interrupt at very high rate hence all other tasks are getting delayed. Help me in configuration of tearing pin interrupt at lower rate so other task will get MCU time and get executed.

To start with, let’s go over the most common type of STM32 DMA peripheral and use it to send some simple audio data to the chip’s DAC peripheral. I’ll be using an STM32F303 core for these examples; something like a ‘Nucleo-32‘ board or an ‘F3 Discovery Kit‘ should work.
If you’re using a ‘Discovery Kit’ board, your STM32F303VC chip has two groups of DMA channels, and you can choose which one the DAC peripherals map to. If you’re using the ‘Nucleo-32’ board, your STM32F303K8 chip only has one group of DMA channels, and these bits need to be set if we want to use DMA with the DAC peripheral. So I’m going to set these bits and use DAC channel 1 with DMA1 channel 3.
Okay, now let’s get to the fun stuff. Everybody likes colorful lights and displays, and everybody likes to see them refresh quickly. We’ll start with using SPI to drive ‘NeoPixel’ LEDs, then we’ll use I2C to drive a small monochorme OLED and SPI to drive a larger color TFT display.
Finally, let’s look at some popular SPI TFT displays. The ILI9163C and ILI9341 controllers are used in many affordable display modules. Usually ILI9341 displays have a resolution of 240×320 and ILI9163C displays are 128×128 or 128×160, but there are exceptions.
But sadly, unlike the I2C display, we can’t send all of the initialization commands in a single DMA burst. These TFT displays’ “4-wire SPI” modes expect a “Data / Command” selection pin to be toggled between a command and the configuration data which follows. But once we’ve finished initializing the display, we can set up an ordinary circular DMA transfer to send the framebuffer:
If you connect the TFT to the appropriate pins and run that code, it should flash between purple and teal colors. It does require a whopping 32KB of RAM, and even in an 8-bit color mode, a 240×320 ILI9341 display will require at least 75KB of RAM. That’s more than most MCUs have on-board, but that’s a problem for another day.
This should help to demonstrate why DMA is useful, if you’ve been following along with any of my previous tutorials. The OLED and TFT display demos are noticeably faster than the previous examples which used polling to wait until the peripheral was ready to receive each byte. DMA is faster and more power-efficient if your application can sleep when it is idle, so it’s a good choice for a wide variety of applications.
Ms.Josey
Ms.Josey