LCD Interfacing Using STM32 Blackpill

by Mohit1201 in Circuits > Microcontrollers

774 Views, 0 Favorites, 0 Comments

LCD Interfacing Using STM32 Blackpill

STM32-STM32F4-STM32F401-STM32F401CCU6-pinout-high-resolution.png
Screenshot 2023-04-15 223850.png

The STM32 Black Pill is a small, powerful microcontroller board based on the STM32F103C8T6 ARM Cortex-M3 processor. It has a rich set of peripherals, including GPIOs, UARTs, SPIs, I2Cs, and more, making it suitable for a wide range of applications. In this tutorial, we will learn how to display "Chitkara University" on a 16x2 LCD using the STM32 Black Pill and STM Cube IDE, without using an I2C module, but instead using HAL (Hardware Abstraction Layer) programming.


Prerequisites:


STM32 Black Pill board

16x2 LCD module

Jumper wires

STM Cube IDE installed on your computer

Basic knowledge of C programming and microcontroller concepts

1.Open STM32 Cube IDE and create a new Project.

2.Select the board (STM32F401CCU6) and click Next.

3.In the Pinout and Configuration tab of the IDE configure the GPIO Pins.

4.Select the Pins to which the LCD pins are connected and set them as "GPIO_Output".

5.In System Core menu , select RCC.

6.Set the mode of High speed clock and Low speed clock to "BYPASS Clock Source".

7.Now, in Clock configuration Tab.

8.Now, in the Connectivity menu , select I2C1 and do the following settings.

9.After doing all the above steps, open the main.c file.

10.Now,write the following code.

11.In the while loop statement, write the following code.

12.Now,Build the project to check if there are any errors.

13.Next right click on the project , open properties > C/C++ Build > Settings > MCU Post Build outputs and convert the project into Hex file.

14.After converting to Hex file, open STM32 Cube Programmer.

15.Open the HEX file in Cube Programmer.

16.After connecting the Board to your laptop or computer, click on Download and the code will be uploaded on the board

and LCD will start interfacing.