BLINKING LED CONNECTED EXTERNALLY USING STM32 CUBE IDE

by Jugraj Shergill in Circuits > Electronics

21 Views, 0 Favorites, 0 Comments

BLINKING LED CONNECTED EXTERNALLY USING STM32 CUBE IDE

LED.png
3.1 c SS9.png

STM32 is a microcontroller just like Arduino Uno and Rasberry pi which is considered an industry standard.

The microcontroller is a kind of integrated circuit chip, which uses VLSI technology to integrate the central processing unit CPU, random access memory RAM, read-only memory ROM, various I/O ports, interrupt systems, timers with data processing capabilities, counter and other functions (may also include display drive circuit, pulse width modulation circuit, an analog multiplexer, A/D converter, and other circuits) into a silicon chip to form a small and complete microcomputer system. Because 8-bit single-chip microcomputers have a simple internal structure, small size, and low cost, they are widely used in some simpler controllers. Common 8-bit microcontrollers mainly include Intel's 51 series, Atmel's AVR system, Microchip's PIC series, TI's MSP430 series, and so on.

Supplies

  1. STM 32 BOARD
  2. USB TYPE C CABLE
  3. LED
  4. JUMPER WIRES
  5. BREADBOARD (NOT COMPULSORY)

Downloading the STM 32 Cube IDE

Download the STM 32 Cube IDE in order to perform this task

The file can be downloaded from the following link:

https://github.com/eziya/STM32_HAL_I2C_HD44780/blob/master/Src/liquidcrystal_i2c.h

STARTING THE PROJECT

2.2 c file creation.png

As we head into programming in the CUBE IDE head over to the top left and create a new STM32 project by clicking on "FILE" and then "NEW" then after on new "STM32 Project"

SETTING PIN CONFIGURATION

2.2 d.png

Once the file is created select the required STM board and then after set the pin configuration as shown.

Here, basically we set pin C14 as our required pin.

NOTE: Set the pin in output configuration as we will be writing the data i.e. we will be giving the input through the code.

CLOCK CONFIGURATION

2.2 d clock config.png

In any synchronous circuit, clock frequency plays an integral part thereby we set the frequency as shown in order to execute the task.

CODE GENERATION

2.2 c code generation.png

One of the major advantages of using STM32 IDE is that the code is automatically adjusted according the the clock configuration and then we just have to make a little bit of changes using the required syntax.

The only change we make is that we add the following information in the existing code:

HAL_GPIO_WritePin(GPIOC,GPIO_PIN_14,1);

HAL_Delay(500);

HAL_GPIO_WritePin(GPIOC,GPIO_PIN_14,0);

HAL_Delay(500);

It basically means that we are adding a delay of 0.5 second between ON and OFF states of the LED to leading to its blinking

Using the Binary File

3.1 SS5.png

One of the tricky part is that we will require the binary file i.e. .elf file.

For that, we simply open the .elf file created in the system explorer by Right clicking on the project and clicking on show in system explorer and copying the path on the STM32Cube PROGRAMMER.

STM 32 CubeProgrammer

3.1 c SS7.png

Next we just need to copy the path of the file in the programmer connect the STM32 Board with the system and upload the code to get the required results.

In the hardware connections make sure to connect the pin C14 with the positive terminal of the LED and the GND pin of the board with the negative terminal of the LED.

RESULT!!

2.2 d re1.jpg
2.2 d re2.jpg

Finally after completing all the steps we will see that the LED on the STM board will blink with a delay of 0.5 seconds.

There we go, we have reached the end of the program and got the required result.