Introduction: STM32 Black Pill | Using HAL Programming to Use I2C LCD

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

Step 1: Project Creation

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


Step 2: Pinout Selection

  • Configure your board's clock.
  • Save using Ctrl + S.


Step 3: STM32CubeProgrammer

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