STM32 Black Pill | Using HAL Programming to Use I2C LCD

by Maitali sharma in Circuits > Microcontrollers

28 Views, 0 Favorites, 0 Comments

STM32 Black Pill | Using HAL Programming to Use I2C LCD

Screenshot 2024-05-06 124750.png

In this tutorial, we'll use an STM32 Black Pill to program an I²C LCD on STM32CubeIDE using HAL programming.

Supplies

Hardware:

  • STM32 Black Pill
  • 16*2 I²C LCD
  • Laptop or desktop
  • USB-C cable
  • Few jumper wires

Software:

  • STM32CubeIDE
  • STM32CubeProgrammer

Project Creation

  • Create a new STM32 project from File > New > STM32 Project
  • Select the appropriate board.


Pinout Selection

Screenshot 2024-05-06 122605.png
Screenshot 2024-05-06 122740.png
  • Configure your board's clock.
  • Save using Ctrl + S.


STM32CubeProgrammer

Screenshot 2024-05-06 123757.png
Screenshot 2024-05-06 123836.png
Screenshot 2024-05-06 123901.png
Screenshot 2024-05-06 124355.png
  • We will bootload STM using USB, this tutorial does not use ST-Link.
  • Next, press on "Open file" and select the .elf file from the project folder.
  • Press on "Download".


  • Go to "Erasing and Programming" from the menu in the left.
  • Go to file path and select the .elf file and press "Start automatic mode".
  • Once compiled, disconnect and reconnect the STM board.