0% found this document useful (0 votes)
285 views5 pages

Lab Manual MES Experiment 2

This experiment manual outlines how to use an STM32 microcontroller board to implement basic programs. The objectives are to study the STM32 board, learn its programming commands, and implement an LED blink test and traffic light control system. STM32CubeIDE software is used to write code, compile programs, and debug. The manual provides instructions on connecting LEDs to the board, writing a blink program using toggle commands, and rewriting the code for a traffic light controller using delay functions. Students are asked to document all code, include a Proteus simulation, and answer questions in a lab report.

Uploaded by

Kazi Al - Kabid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
285 views5 pages

Lab Manual MES Experiment 2

This experiment manual outlines how to use an STM32 microcontroller board to implement basic programs. The objectives are to study the STM32 board, learn its programming commands, and implement an LED blink test and traffic light control system. STM32CubeIDE software is used to write code, compile programs, and debug. The manual provides instructions on connecting LEDs to the board, writing a blink program using toggle commands, and rewriting the code for a traffic light controller using delay functions. Students are asked to document all code, include a Proteus simulation, and answer questions in a lab report.

Uploaded by

Kazi Al - Kabid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Experiment 2 Lab Manual

American International University- Bangladesh


Department of Electrical and Electronic Engineering
EEE 4103: Microprocessor and Embedded Systems Laboratory

Title: Familiarization with an STM32 Microcontroller Board, the study of an LED blink test,
and implementation of a traffic light control system using an STM32 microcontroller board.

Introduction:

The objectives of this experiment are to-


1. Study the STM32 Microcontroller Board.
2. Learn basic programming commands of the STM32 Microcontroller Board.
3. Apply the coding techniques of the STM32 Microcontroller Board.
4. Implement the LED blink test using STM32 Board.
5. Implement a traffic light control system using STM32 Board.

Theory and Methodology:

STM32CubeIDE is an advanced C/C++ development platform with peripheral configuration,


code generation, code compilation, and debug features for the STM32 microcontrollers and
microprocessors. STM32CubeIDE includes build and stack analyzers that provide the user with
useful information about project status and memory requirements. STM32CubeIDE includes
standard and advanced debugging features including views of CPU core registers, memories,
and peripheral registers, a live variable watch, a serial wire viewer interface, or a fault analyzer.

Overview of STM32 Nucleo-F401RE Board:

Fig. 1 STM32 Nucleo-F401RE Microcontroller Board.


© Dept. of EEE, Faculty of Engineering, American International University-Bangladesh (AIUB) 1
Experiment 2 Lab Manual
Pin Configuration:

Fig. 2 Pin Configuration of the STM32 Nucleo-F401RE Microcontroller Board.

Pin Configuration from STM32Cube IDE:

Fig. 3 Pin Configuration of the STM32 Nucleo-F401RE from the STM32Cube IDE.

Apparatus:
1) STM32 Cube IDE (1.0.1 or any recent version)
2) STM32 Microcontroller board
3) LED lights (Red, Green, and Yellow), three 100  resistors, and jumper wires
© Dept. of EEE, Faculty of Engineering, American International University-Bangladesh (AIUB) 2
Experiment 2 Lab Manual
Experimental Procedure:
The main task of this experiment is to understand and implement an LED blinking and traffic
light control system. Connect the circuits as per the diagram of Fig. 4. Then plug in the STM32
Nucleo board to the PC.

Fig. 4 Connection diagram of the LEDs with the STM32 Nucleo-F401RE Board.

Using STM32Cube IDE to write code for a simple LED blink program:
1. Open the STM32Cube IDE and in the first while(1){} loop write the program as in Fig. 5.
Here, the TogglePin command toggles the signal level between HIGH and LOW levels sent
to the I/O pin 5 from the STM32 microcontroller.

Fig. 5 Writing the program in the while(1){} loop.


© Dept. of EEE, Faculty of Engineering, American International University-Bangladesh (AIUB) 3
Experiment 2 Lab Manual
2. After that, save the project file and then build the project as shown in Fig. 6.

Fig. 6 Saving the program written in the while(1){} loop.

3. Next, run the program to debug as STM32 MCU C/C++ Application as shown in Fig. 7.

Fig. 7 Running the program written in the while(1){} loop.

© Dept. of EEE, Faculty of Engineering, American International University-Bangladesh (AIUB) 4


Experiment 2 Lab Manual
4. Click on the resume option or press the function button (F8) to see that the board is showing
the results of blinking the LED light.

Fig. 8 Resuming the program written in the while(1){} loop.

Now, try to rewrite the code for the traffic light control system
Here, the WritePin command may be used instead of TogglePin command to send the HIGH
and LOW level signals to the I/O pins from the STM32 microcontroller. To apply a delay to a
pin for a signal level, you can use the HAL_Delay(red_on) command with the red_on
parameter meaning the duration of the delay. Other methods of writing the code are like the
method stated in experiment 1 for the traffic light control system.

Questions for report writing:

1) Include all codes and scripts in the lab report following the lab report writing template.
2) Include the Proteus simulation of the blink program and traffic light control system. You
may learn the simulation from the following link:
https://www.youtube.com/watch?v=MDsoLQicdAk.

Reference(s):

[1] https://www.st.com/en/evaluation-tools/nucleo-f401re.html for STM32F401RE datasheet.


[2] www.st.com.
[3] https://www.st.com/resource/en/user_manual/dm00105879-description-of-stm32f4-hal-and-ll-
drivers-stmicroelectronics.pdf.
[4] www.st.com/en/development-tools/stm32cubeide.html.

© Dept. of EEE, Faculty of Engineering, American International University-Bangladesh (AIUB) 5

You might also like