stm32 nucleo lcd display supplier
Worldwide,Asia,Europe,Africa,North America,South America,Oceania,Afghanistan,Bahrain,Bangladesh,Bhutan,Brunei,Burma (Myanmar),Cambodia,China,East Timor,India,Indonesia,Iraq,Japan,Jordan,Kazakhstan,Kuwait,Kyrgyzstan,Laos,Malaysia,Maldives,Mongolia,Nepal,Oman,Pakistan,Philippines,Qatar,Russian Federation,Saudi Arabia,Singapore,South Korea,Sri Lanka,Taiwan,Tajikistan,Thailand,Turkmenistan,United Arab Emirates,Uzbekistan,Vietnam,Yemen,Albania,Andorra,Armenia,Austria,Azerbaijan,Belarus,Belgium,Bosnia and Herzegovina,Bulgaria,Croatia,Cyprus,Czech Republic,Denmark,Estonia,Finland,France,Georgia,Germany,Greece,Hungary,Iceland,Ireland,Israel,Italy,Latvia,Liechtenstein,Lithuania,Luxembourg,Macedonia,Malta,Moldova,Monaco,Montenegro,Netherlands,Norway,Poland,Portugal,Romania,San Marino,Serbia,Slovakia,Slovenia,Spain,Sweden,Switzerland,Turkey,Ukraine,United Kingdom,Vatican City,Algeria,Angola,Benin,Botswana,Burkina,Burundi,Cameroon,Cape Verde,Central African Republic,Chad,Comoros,Democratic Republic of Congo,Djibouti,Egypt,Equatorial Guinea,Eritrea,Ethiopia,Gabon,Gambia,Ghana,Guinea,Guinea-Bissau,Ivory Coast,Kenya,Lesotho,Liberia,Libya,Madagascar,Malawi,Mali,Mauritania,Mauritius,Morocco,Mozambique,Namibia,Niger,Nigeria,Rwanda,Sao Tome and Principe,Senegal,Seychelles,Sierra Leone,Somalia,South Africa,Swaziland,Tanzania,Togo,Tunisia,Uganda,Zambia,Zimbabwe,Antigua and Barbuda,Bahamas,Barbados,Belize,Canada,Costa Rica,Dominica,Dominican Republic,El Salvador,Grenada,Guatemala,Haiti,Honduras,Jamaica,Mexico,Nicaragua,Panama,Saint Kitts and Nevis,Saint Lucia,Saint Vincent and the Grenadines,Trinidad and Tobago,United States,Argentina,Bolivia,Brazil,Chile,Colombia,Ecuador,Guyana,Paraguay,Peru,Suriname,Uruguay,Venezuela,Australia,Fiji,Kiribati,Marshall Islands,Micronesia,Nauru,New Zealand,Palau,Papua New Guinea,Samoa,Solomon Islands,Tonga,Tuvalu,Vanuatu Active TouchGFX advanced and free of charge graphical framework optimized for STM32 microcontrollers STM32Cube Expansion Packages ST X-CUBE-TOUCHGFX
Worldwide,Asia,Europe,Africa,North America,South America,Oceania,Afghanistan,Bahrain,Bangladesh,Bhutan,Brunei,Burma (Myanmar),Cambodia,China,East Timor,India,Indonesia,Iraq,Japan,Jordan,Kazakhstan,Kuwait,Kyrgyzstan,Laos,Malaysia,Maldives,Mongolia,Nepal,Oman,Pakistan,Philippines,Qatar,Russian Federation,Saudi Arabia,Singapore,South Korea,Sri Lanka,Taiwan,Tajikistan,Thailand,Turkmenistan,United Arab Emirates,Uzbekistan,Vietnam,Yemen,Albania,Andorra,Armenia,Austria,Azerbaijan,Belarus,Belgium,Bosnia and Herzegovina,Bulgaria,Croatia,Cyprus,Czech Republic,Denmark,Estonia,Finland,France,Georgia,Germany,Greece,Hungary,Iceland,Ireland,Israel,Italy,Latvia,Liechtenstein,Lithuania,Luxembourg,Macedonia,Malta,Moldova,Monaco,Montenegro,Netherlands,Norway,Poland,Portugal,Romania,San Marino,Serbia,Slovakia,Slovenia,Spain,Sweden,Switzerland,Turkey,Ukraine,United Kingdom,Vatican City,Algeria,Angola,Benin,Botswana,Burkina,Burundi,Cameroon,Cape Verde,Central African Republic,Chad,Comoros,Democratic Republic of Congo,Djibouti,Egypt,Equatorial Guinea,Eritrea,Ethiopia,Gabon,Gambia,Ghana,Guinea,Guinea-Bissau,Ivory Coast,Kenya,Lesotho,Liberia,Libya,Madagascar,Malawi,Mali,Mauritania,Mauritius,Morocco,Mozambique,Namibia,Niger,Nigeria,Rwanda,Sao Tome and Principe,Senegal,Seychelles,Sierra Leone,Somalia,South Africa,Swaziland,Tanzania,Togo,Tunisia,Uganda,Zambia,Zimbabwe,Antigua and Barbuda,Bahamas,Barbados,Belize,Canada,Costa Rica,Dominica,Dominican Republic,El Salvador,Grenada,Guatemala,Haiti,Honduras,Jamaica,Mexico,Nicaragua,Panama,Saint Kitts and Nevis,Saint Lucia,Saint Vincent and the Grenadines,Trinidad and Tobago,United States,Argentina,Bolivia,Brazil,Chile,Colombia,Ecuador,Guyana,Paraguay,Peru,Suriname,Uruguay,Venezuela,Australia,Fiji,Kiribati,Marshall Islands,Micronesia,Nauru,New Zealand,Palau,Papua New Guinea,Samoa,Solomon Islands,Tonga,Tuvalu,Vanuatu Active TouchGFX advanced and free of charge graphical framework optimized for STM32 microcontrollers STM32Cube Expansion Packages ST X-CUBE-TOUCHGFX
STM32 pays more attention to engineering practice. In fact, there are many simple instruments in the factory, such as temperature controllers, ordinary motor controllers, low-end PLCs, and some civilian toys, game controllers, wired keyboards and mice, and other peripherals and so on are very practical.
STM32 is mainly used as products for professional developers, which requires certain professional knowledge, but at the same time, it is relatively complicated to write code to realize functions. For example, the serial port outputs a simple string. For Arduino, it may start from a new project and it can be realized with 10 lines of code. However, if you use STM32 development tools such as Keil, it may require hundreds of lines of code or more.
In terms of open source: things made with STM32 can be open source if you want to open source, and you can not publish anything if you don’t want open source.
If you are an ordinary student below the university level who does not have a deep understanding of programming languages, it is recommended to get started with Arduino. If the C skills are weak and come up with STM32, you will soon have the idea of giving up.
If you have good programming skills, STM32 is recommended. After you get it done, you can take a look at the things made by the Arduino open-source community, and you can easily get it done with STM32.
Of course, if you have the ability, you can make contact with both. Generally, you can master the basic features of Arduino in less than a week. If you need it in the future, you can freely transplant the Arduino code to MCU platforms such as STM32.
In fact, the two are actually aimed at slightly different directions. Arduino is the choice of general electronics hobbyists and DIY, while STM32 is often used for the development and manufacturing of actual products.
The graphic display used in this application note is Focus LCD’s G12864B-BW-LW63. Icons will be programmed into the display as bitmaps for non-moving images. The dynamic functions such as interactive buttons will be programmed on top of the bitmaps and will be continuously updated.
G12864C-BW-LW63 is a transmissive STN blue LCD with a white LED backlight. The embedded display driver is ST7565 which contains an internal oscillator and on chip RAM used to store display data. Features of this display are reviewed in the table below.
This display offers multiple interfaces to select from and is chosen through the hardware connections. The interface used in this application is a parallel 8-bit 8080 type. The alternative interfaces to select from are SPI and 6800 parallel. The display is interfaced with a STM32 Nucleo board. A simple 8-bit microcontroller would be sufficient to control this display because many of the features are provided internally by the display driver.
Graphic LCD’s provide internal RAM to support the frame buffer of images projected onto the display. This display has an internal RAM capacity of 8580 bits or approximately 1kB. Additional RAM can be provided externally or with the microcontroller.
The connection of the display to the microcontroller is through 30 pins which include the data lines, the voltage boosting circuit and the backlight. The voltage boosting circuit will step up the input voltage 3 times. There are different configurations for selecting the voltage boosting multiple which can be found in the datasheet of the driver. The 3X boost was chosen because the input voltage at VDD is at 3.3V and VLCD requires a voltage of 8.5V.
The voltage boosting circuit is used in configuration with the voltage divider circuit to produce a voltage of 8.5V for the display. This value can be measured at the pin VOUT. The capacitors used in the circuit can be in a range of values specified in the datasheet. Below is an outline of the hardware connections of the display.
The pin connections to the microcontroller and power supply are reviewed below. This application is using the 8080 parallel interface and all the data lines will need to be used. For the SPI interface the parallel data bus pins 6 and 7 will alternatively function as the clock and data pins. Some interface and display function pins are specified by pinning them to ground or to VDD. Below is a description of each of the pins and their connection.
The graphic LCD needs to be initialized before sending display data. This is done through a series of commands that specify voltage settings, bias, and display area. A detailed explanation of each of these commands can be found in the controller datasheet. This application will review a minimal initialization sequence used to set up the display.
The bias of the display is set by selecting the duty cycle specified in the datasheet. The duty cycle is 1/65 which means that the voltage bias ratio can be either 1/9 or 1/7. For this display, the 1/7 voltage bias ratio is selected. Below is the command to select the voltage bias ratio of 1/7.
The segment direction is set through the command “ADC Select”. This command can reverse the column address and the segment output. This would reverse the location of pixels projected onto the display. There is also a command to select the direction of the COM output. These commands are listed sequentially below.
The display start line will need to be set to indicate where the display data begins in RAM. The display start line can be a value from 0-65 corresponding to the vertical lines of pixels on the display. This value will be set the start address of line 0 to start at the top of the display lines.
The power functions of the display driver are set through a sequence of commands. These functions indicate which internal power systems are used. For this example, all of the power supply circuits are used. This is indicated by the following commands. These commands turn on the voltage converter, regulator and follower then sets the resistor ratio for the voltage divider.
The final commands are to turn the display on, active all points and set the electronic volume of the display. This is done by the following command sequence.
The controller in the display has a feature to program icons into different page addresses of RAM. This allows for multiple pages to be stored internally and to be accessed later. The controller offers eight pages of storage for the 128x64 pixels of visible display area. The pages are chosen through commands by setting the data bus pins D3, D2, D1 and D0 to a value from 0 to 8.
One full page consists of the data for each pixel of the display. The total RAM required for one page of data is calculated by the area of the resolution, 128x64=1024 pixels. Since the total RAM available in the controller chip is 8580 bits, the number of pages that can be stored is eight. Multiple icons can be stored in display RAM individually where each icon is less than the full area of the display.
A bitmap is created for the icons which contains the data for each pixel on the screen. Since the display has a resolution of 128x64, the icons will have to be very small. This makes the icon choices slim for graphic LCDs because there are only so many pixels to work with. This graphic LCD is monochrome and can only display pixels as on or off. Some creativity is needed when creating these icons because of these challenges.
Creating icon images can be done on Microsoft paint. The image can be a full page or individual icons that only take a portion of the resolution. You will zoom into the Paint application until the frame matches the resolution of the display (128x64). Now images can be created within these boundaries to be displayed on the screen.
Some available icons can be found when searching “vector icons”. The resolution is limited, so finding a standard set of tiny icons can be helpful when choosing what to display. Below are some examples of low-resolution icons that can be stored on the display.
A simple menu was created for this application that shows the options for setting the next display page. Each of these menu items can be selected to display the specified page in RAM where their bitmaps are stored. The menu was created on MS Paint and saved as a Monochrome .BMP file.
Once the bitmap is created it will need to be converted to an array of hexadecimal values to specify the on or off attribute of the pixels. The application that was used for this is called “LCD-imageconverter”. There are many applications that can be used for converting bitmap images into hexadecimal, binary, and c file types.
The bitmap can be uploaded onto one of the pages in RAM and accessed based on selection. Push buttons can be added to select menu options which will indicate which page is selected. The display has internal RAM of 1kB so there are eight possible page addresses to save data to. Below is the menu created from this application when read from page 0.
Buyers and others who are developing systems that incorporate FocusLCDs products (collectively, “Designers”) understand and agree that Designers remain responsible for using their independent analysis, evaluation and judgment in designing their applications and that Designers have full and exclusive responsibility to assure the safety of Designers" applications and compliance of their applications (and of all FocusLCDs products used in or for Designers’ applications) with all applicable regulations, laws and other applicable requirements.
Designer agrees that prior to using or distributing any applications that include FocusLCDs products, Designer will thoroughly test such applications and the functionality of such FocusLCDs products as used in such applications.
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()
The above example is just only for displaying black and white image. In order to show a color image, we need to a little bit different. First, go tothis websiteto generate the array of the colour image. Remember to change your size to 320×240 and choose the 65K color option. Because it now takes up two bytes for one pixel, we need to send two bytes at once. You can check the Display_Color_Picture() function in the Display folder.void Display_Color_Picture()
STM32 is a family of 32-bit microcontroller integrated circuits by STMicroelectronics. The STM32 chips are grouped into related series that are based around the same 32-bit ARM processor core, such as the Cortex-M33F, Cortex-M7F, Cortex-M4F, Cortex-M3, Cortex-M0+, or Cortex-M0. Internally, each microcontroller consists of the processor core, static RAM, flash memory, debugging interface, and various peripherals.
The STM32 is a family of microcontroller ICs based on the 32-bit RISC ARM Cortex-M33F, Cortex-M7F, Cortex-M4F, Cortex-M3, Cortex-M0+, and Cortex-M0 cores.STMicroelectronics licenses the ARM Processor IP from ARM Holdings. The ARM core designs have numerous configurable options, and ST chooses the individual configuration to use for each design. ST attaches its own peripherals to the core before converting the design into a silicon die. The following tables summarize the STM32 microcontroller families.
In November 2010, ST announced the STM32 F2-series chips based on the ARM Cortex-M3 core, and future development of chips based on the ARM Cortex-M4 and ARM Cortex-M3 cores.
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.
In October 2018, ST announced the STM32L5 series, ultra-low-power MCUs based on the ARM Cortex-M33 core with a variety of security features, such as TrustZone, Secure Boot, active IO tamper detection, Secure Firmware Install loader, certified cryptolib etc.
In February 2021, ST announced the STM32U5 series, ultra-low-power MCUs based on the ARM Cortex-M33 core with a variety of low power and security features, such as TrustZone, Secure Boot, active IO tamper detection, hardware-based protection targeting PSA and SESIP assurance level 3, etc.
The STM32 family consists of 17 series of microcontrollers: H7, F7, F4, F3, F2, F1, F0, G4, G0, L5, L4, L4+ L1, L0, U5, WL, WB.Cortex-M7F, Cortex-M4F, Cortex-M33, Cortex-M3, Cortex-M0+, or Cortex-M0 ARM processor core. The Cortex-M4F is conceptually a Cortex-M3DSP and single-precision floating-point instructions.
The STM32 H7-series is a group of high performance STM32 microcontrollers based on the ARM Cortex-M7F core with double-precision floating point unit and optional second Cortex-M4F core with single-precision floating point. Cortex-M7F core can reach working frequency up to 480 MHz, while Cortex-M4F - up to 240 MHz. Each of these cores can work independently or as master/slave core.
The STM32H7 Series is the first series of STM32 microcontrollers in 40 nm process technology and the first series of ARM Cortex-M7-based microcontrollers which is able to run up to 480 MHz, allowing a performance boost versus previous series of Cortex-M microcontrollers, reaching new performance records of 1027 DMIPS and 2400 CoreMark.
The STM32 F7-series is a group of STM32 microcontrollers based on the ARM Cortex-M7F core. Many of the F7 series are pin-to-pin compatible with the STM32 F4-series.
The STM32 F4-series is the first group of STM32 microcontrollers based on the ARM Cortex-M4F core. The F4-series is also the first STM32 series to have DSP and floating-point instructions. The F4 is pin-to-pin compatible with the STM32 F2-series and adds higher clock speed, 64 KB CCM static RAM, full-duplex I²S, improved real-time clock, and faster ADCs. The summary for this series is:
The STM32 F3-series is the second group of STM32 microcontrollers based on the ARM Cortex-M4F core. The F3 is almost pin-to-pin compatible with the STM32 F1-series. The summary for this series is:
The STM32 F2-series of STM32 microcontrollers based on the ARM Cortex-M3 core. It is the most recent and fastest Cortex-M3 series. The F2 is pin-to-pin compatible with the STM32 F4-series. The summary for this series is:
The STM32 F1-series was the first group of STM32 microcontrollers based on the ARM Cortex-M3 core and considered their mainstream ARM microcontrollers. The F1-series has evolved over time by increasing CPU speed, size of internal memory, variety of peripherals. There are five F1 lines: Connectivity (STM32F105/107), Performance (STM32F103), USB Access (STM32F102), Access (STM32F101), Value (STM32F100). The summary for this series is:
The STM32 G4-series is a next generation of Cortex-M4F microcontrollers aiming to replace F3 series, offering the golden mean in productivity and power efficiency, e.g. better power efficiency and performance compared to the older F3/F4 series and higher performance compared to ultra low power L4 series, integrated several hardware accelerators.
The STM32 G0-series is a next generation of Cortex-M0/M0+ microcontrollers for budget market segment, offering the golden mean in productivity and power efficiency, e.g. better power efficiency and performance compared to the older F0 series and higher performance compared to ultra low power L0 series
The STM32 L4+-series is expansion of STM32L4-series of ultra-low power microcontrollers, providing more performance, more embedded memory and richer graphics and connectivity features while keeping ultra-low-power capability.
The STM32 L4-series is an evolution of STM32L1-series of ultra-low power microcontrollers. An example of L4 MCU is STM32L432KC in UFQFPN32 package, that has:
The STM32 L1-series was the first group of STM32 microcontrollers with a primary goal of ultra-low power usage for battery-powered applications. The summary for this series is:
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.
The STM32 L0-series is the first group of STM32 microcontrollers based on the ARM Cortex-M0+ core. This series targets low power applications. The summary for this series is:
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).
All Nucleo boards by STMicroelectronics support the mbed development environment,Nucleo boards can be converted to the SEGGER J-Link debugger protocol.
NUCLEO-G431KB board for STM32G431KB6U MCU with 170 MHz Cortex-M4F core, 128 KB flash (HW ECC), 16 KB SRAM (HW parity), 6 KB SRAM, 10 KB CCM SRAM, STLINK-V3E.
NUCLEO-L412KB board for STM32L412KBU6 MCU with 80 MHz Cortex-M4F core, 128 KB flash (HW ECC), 32 KB SRAM, 8 KB SRAM (HW parity), external quad-SPI memory interface.
NUCLEO-L432KC board for STM32L432KCU6 MCU with 80 MHz Cortex-M4F core, 256 KB flash (HW ECC), 48 KB SRAM, 16 KB SRAM (HW parity), external quad-SPI memory interface.
NUCLEO-F303RE board for STM32F303RET6 MCU with 72 MHz Cortex-M4F core, 512 KB flash, 32 KB SRAM, 48 KB SRAM (HW parity), external static memory interface.
NUCLEO-F446RE board for STM32F446RET6 MCU with 180 MHz Cortex-M4F core, 512 KB flash, 128 KB SRAM, external quad-SPI memory interface, external flexible memory interface.
NUCLEO-L433RC-P board for STM32L433RCT6P MCU with 80 MHz Cortex-M4F core, 256 KB flash (HW ECC), 48 KB SRAM, 16 KB SRAM (HW parity), external quad-SPI memory interface, SMPS power.
NUCLEO-L452RE-P board for STM32L452RET6P MCU with 80 MHz Cortex-M4F core, 512 KB flash (HW ECC), 128 KB SRAM, 32 KB SRAM (HW parity), external quad-SPI memory interface, SMPS power.
NUCLEO-L452RE board for STM32L452RET6 MCU with 80 MHz Cortex-M4F core, 512 KB flash (HW ECC), 128 KB SRAM, 32 KB SRAM (HW parity), external quad-SPI memory interface.
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.
This family has 144-pin STM32 ICs, Arduino Uno Rev3 female headers, ST Zio female headers, ST Morpho male pin headers (two 19x2), second Micro-AB USB connector, and RJ45 Ethernet connector (some boards).
NUCLEO-F207ZG board for STM32F207ZGT6 MCU with 120 MHz Cortex-M3 core, 1024 KB flash (HW ECC), 128 KB SRAM, 4 KB battery-back SRAM, external static memory interface, ethernet.
NUCLEO-F303ZE board for STM32F303ZET6 MCU with 72 MHz Cortex-M4F core, 512 KB flash (HW ECC), 32 KB SRAM, 48 KB SRAM (HW parity), external static memory interface.
NUCLEO-F412ZG board for STM32F412ZGT6 MCU with 100 MHz Cortex-M4F core, 1024 KB flash, 256 KB SRAM, external quad-SPI memory interface, external static memory interface.
NUCLEO-F429ZI board for STM32F429ZIT6 MCU with 180 MHz Cortex-M4F core, 2048 KB flash, 256 KB SRAM, 4 KB battery-back SRAM, external flexible memory interface, ethernet.
NUCLEO-F439ZI board for STM32F439ZIT6 MCU with 180 MHz Cortex-M4F core, 2048 KB flash, 256 KB SRAM, 4 KB battery-back SRAM, external flexible memory interface, ethernet, cryptographic acceleration.
NUCLEO-F446ZE board for STM32F446ZET6 MCU with 180 MHz Cortex-M4F core, 512 KB flash, 128 KB SRAM, 4 KB battery-back SRAM, external quad-SPI memory interface, external flexible memory interface.
NUCLEO-F746ZG board for STM32F746ZGT6 MCU with 216 MHz Cortex-M7F core (4 KB data cache, 4 KB instruction cache), 1024 KB flash, 336 KB SRAM, 4 KB battery-back SRAM, 1 KB OTP, external quad-SPI memory interface, external flexible memory interface, ethernet.
NUCLEO-F767ZI board for STM32F767ZIT6 MCU with 216 MHz Cortex-M7F-DP core (16 KB data cache, 16 KB instruction cache), 2048 KB flash, 528 KB SRAM, 4 KB battery-back SRAM, external quad-SPI memory interface, external flexible memory interface, ethernet.
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 ready-to-use Java development kits for its STM32 microcontrollers. The STM3220G-JAVA Starter Kit combines an evaluation version of IS2T"s MicroEJ® Software Development Kit (SDK) and the STM32F2 series microcontroller evaluation board providing everything engineers need to start their projects.
MicroEJ provides extended features to create, simulate, test and deploy Java applications in embedded systems. Support for Graphical User Interface (GUI) development includes a widget library, design tools including storyboarding, and tools for customizing fonts.STM32F205VGT6J.
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.
All STM32 microcontrollers have a ROM"ed bootloader that supports loading a binary image into its flash memory using one or more peripherals (varies by STM32 family). Since all STM32 bootloaders support loading from the USART peripheral and most boards connect the USART to RS-232 or a USB-to-UART adapter IC, thus it"s a universal method to program the STM32 microcontroller. This method requires the target to have a way to enable/disable booting from the ROM"ed bootloader (i.e. jumper / switch / button).
STMicroelectronics has additional documents, such as: evaluation board user manuals, application notes, getting started guides, software library documents, errata, and more. See External Links section for links to official STM32 and ARM documents.
The Insider"s Guide To The STM32 ARM Based Microcontroller; 2nd Edition (v1.8); Trevor Martin; Hitex; 96 pages; 2009; ISBN 0-9549988-8-X. (Download) (Other Guides)
µC/TCP-IP: The Embedded Protocol Stack for the STMicroelectronics STM32F107; 1st Edition; Christian Légaré; Micrium; 824 pages; 2010; ISBN 978-0-9823375-0-9.
STM32 Nucleo boards from the SNT educational kit can be purchased online or by order form from electronic component suppliers such as Farnell, RS Online, Conrad, Digikey or Mouser.
As you learn about more of your microcontroller’s peripherals and start to work with more types of sensors and actuators, you will probably want to add small displays to your projects. Previously, I wrote about creating a simple program to draw data to an SSD1331 OLED display, but while they look great, the small size and low resolution can be limiting. Fortunately, the larger (and slightly cheaper) ILI9341 TFT display module uses a nearly-identical SPI communication protocol, so this tutorial will build on that previous post by going over how to draw to a 2.2″ ILI9341 module using the STM32’s hardware SPI peripheral.
We’ll cover the basic steps of setting up the required GPIO pins, initializing the SPI peripheral, starting the display, and then finally drawing pixel colors to it. This tutorial won’t read any data from the display, so we can use the hardware peripheral’s MISO pin for other purposes and leave the TFT’s MISO pin disconnected. And as with my previous STM32 posts, example code will be provided for both the STM32F031K6 and STM32L031K6 ‘Nucleo’ boards.
As with most STM32 projects, the first thing we should do is enable the peripherals that we will use. In this case, that’s just GPIOA, GPIOB, and SPI1. As in previous STM32 posts, I will use the device header files provided by ST for basic peripheral variable definitions, and determine the target chip from definitions passed in from the Makefile:
With the peripherals powered on, we need to set up the GPIO pins used for communicating with the screen. To power the SSD1331 display in my previous tutorial, we configured all of the pins as ordinary push-pull outputs; as a quick refresher, we’ll use the SCK (Clock), MOSI (Data output), CS (Chip Select), D/C (Data or Command?), and RST (Reset) pins. The only difference with using the hardware peripheral is that we should configure the MOSI and SCK pins as ‘alternate function’ with high-speed output.
There are actually multiple sets of pins mapped to the SPI1 peripheral, even on the 32-pin STM32xKx chips. I’ll use pin B3 for SCK and pin B5 for MOSI. Pin B4 is mapped to MISO, but I’ll use it as a general-purpose output to drive the D/C pin on the TFT. As long as the MISO pin is not configured as ‘alternate function’, the peripheral will ignore it and we can use pin B4 as a normal GPIO pin. Finally, pins A12 and A15 are mapped to CS and RST respectively:
With the pins set up, it is also a good idea to set them all to a known starting state, and tell the ILI9341 display to reset by pulling the ‘Reset’ pin low/high with a delay to give the display time to perform its reset sequence:
I don’t want to complicate things by covering timers or precisely-timed assembly code in this tutorial, so I’m using a simple (but inaccurate) ‘delay_cycles’ method to give the display plenty of time to reset itself. If you want to use a better time-based delay, try waiting for about 100-150 milliseconds.
The STM32’s SPI peripheral resets to a convenient state for simple communication, but there are still a few options that we need to configure. First up is the clock ‘polarity’ and ‘phase’ – the SCK clock pin will toggle up and down as data is sent, and these two bits tell the peripheral when the data pins should be written and read. The ‘clock polarity’ defines the clock pin’s resting state when data is not being transferred, and the ‘clock phase’ defines whether the devices should read data on the ‘falling’ or ‘rising’ edge of the clock signal. The ILI9341 seems to like a polarity and phase of either 1 and 1 or 0 and 0; you can inspect the timing diagram in its datasheet, or just try and see what works best.
Next, we need to tell the peripheral that the STM32 will be the one initiating communications by setting its MSTR flag. And to avoid unnecessary complexity, it is also a good idea to tell the STM32’s SPI peripheral not to use its hardware CS pin – just like the ILI9341 has a CS (‘Chip Select’) pin which tells it whether it should listen to the clock/data lines, I think that the STM32 has a similar CS signal which tells it whether to read/write, called NSS in the datasheets. Fortunately, we can ignore all of that by using a software ‘Chip Select’ signal (the SSM flag) and leaving it ‘high’ to permanently enable communication (the SSI flag):
Then all we have to do is set the PE (Peripheral Enable) flag to start communications. The ILI9341 expects its data to be sent with the MSB (Most-Significant Bit) first with 8 bits per data frame, but those are the default reset settings on the STM32’s SPI peripheral so we don’t need to change them:
First, the STM32 has a small queue which it can use to store a few bytes of data while it is busy sending, and we shouldn’t try to send data if that queue is full. The peripheral sets a TXE (‘Transmit Buffer Empty’) flag when it is ready for new data to be written. This means that our ‘write 8 bits’ function should wait for that flag to be set before continuing:
I actually couldn’t get the STM32L0 line to write the full 16 bits this way – I think they have a slightly different peripheral configuration. Anyways, for the ILI9341’s “4-Wire” SPI protocol, we also need to write a ‘send command byte’ method which pulls the D/C pin low during communication. Since we don’t want to change the D/C pin while the peripheral is still sending data in its transmit queue, we should wait for the peripheral’s BSY (Busy) flag to be cleared before changing the state of the D/C GPIO pin:
Initializing the display and drawing to it isn’t too difficult, but if the previous steps aren’t done properly, it can be frustrating to debug the communications. If you run into problems, you can also use the same ‘software SPI’ methods presented in the previous SSD1331 tutorial – just don’t forget to set the SCK and MOSI pins as ‘output’ instead of ‘alternate function’ if you decide to try that.
The pins on your ILI9341 module should be labeled, although if you are using a generic module the labels might be on the back side of the board. The connections are about what you would expect; plug the VCC and LED pins into your board’s +3.3V supply, and connect GND to Ground. The CS, RESET, DC/RS, SDI/MOSI, and SCK pins should connect to the corresponding microcontroller pins, and the SDO/MISO pin can be left unconnected. DC/RS is a different acronym for our D/C ‘Data/Command’ pin, and SDO/SDI are starting to become popular labels on SPI boards – they stand for ‘Serial Data Out/In’, so SDI on the listening device corresponds to the MOSI SPI line and SDO is not needed since we won’t be listening to the display.
When the ILI9341 first powers on it should show a uniform bright white color, but that’s just the backlight LEDs. The display will not try to show anything at all until it is initialized. Be aware that a broken display might still show a bright white screen when power is applied, but these modules are fairly sturdy. I’ve gone so far as to pry them apart and remove the backlights, and the panels worked even after being bluntly removed from the case.
So short of taking a hammer to the screen, you shouldn’t be able to damage them too much by bumping them around or dropping them from a tabletop. Anyways, to start the display and put it into a state where it can draw things, we need to send it a series of startup commands. Like with the SSD1331 display, most commands are followed by one or more ‘option’ bytes, but unlike the SSD1331, those ‘option’ bytes should be sent with the D/C pin held high, not low. You can see all of the commands in the ILI9341 datasheet, but some commands appear to be undocumented, so it is a good idea to look at an existing library for a starting sequence that should work for most purposes.
After the display is reset and those commands are sent, the display should change to a flickering grey color. That tells you that the display is all set up and ready to go, but it has not received any pixel data yet so it is not showing any colors.
To draw to the display, we go through a similar process as we did with the SSD1331; send commands to say which rectangular area we want to draw to, then send one 16-bit color for each pixel in that rectangular area.
To refresh the entire 240 x 320 display, we can set the drawing area to be between (0, 0) and (239, 319) and then draw 320 * 240 = 76,800 pixels of data. That’s a lot of data – even at one bit per pixel, the small chips used in this example would not have enough RAM to store a full framebuffer. You’d need over 600KB of RAM to store a full 16 bits of color per pixel, so we’ll only draw some solid colors in this tutorial.
And that’s all there is to it! As the program runs, your display should cycle between a red and blue color as fast as the chip can send data. This could be made even faster by using hardware interrupts and/or DMA transfers, but that is a topic for a future tutorial.
The ILI9341 is a good display driver to know how to use. Screens using it come in sizes from about 2.2″ – 3.2″ with a resolution of 240 x 320 pixels, and they are very affordable. Their contrast is not as good as the SSD1331 OLED displays, but they get you a lot more pixels on a hobbyist’s budget.
So all in all, they’re nice choices for small applications which need an easy-to-read display. I’ve seen them used in devices ranging from handheld oscilloscopes to CNC machines. Chime in if you wind up making anything with one!