Introduction: LCD Interfacing Using STM32F401CCU6 on STM32 Cube Ide (##STM32)

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:

  1. STM32 Black Pill board
  2. 16x2 LCD module
  3. Jumper wires
  4. STM Cube IDE installed on your computer
  5. Basic knowledge of C programming and microcontroller concepts


Step 1:

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


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

Step 2:

3.Choose a name and location for your project.

Step 3:

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


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


Step 4:

1.In System Core menu , select RCC.


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

Step 5:

3.Now, in Clock configuration Tab

Step 6:

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


Step 7:

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


2.Now,write the following code.

Step 8:

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


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

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


2.Open the HEX file in Cube Programmer.

3.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.