[STM32 MCU Control Guide] Button Input – LED Output Operation Control

주피터 · 2019-11-25 · 7,139

The STM32F7 product family is a 32-bit microcontroller unit provided by STMicroelectronics. It is an ultra-high-performance MCU based on the ARM® Cortex®-M processor and features real-time control capabilities. The STM32F746 Discovery Kit used in this project is optimized primarily for prototyping and creating innovative demonstration products.

As a starting point for the control guide, we will use the most basic I/O functions and gain hands-on experience with the fundamental operating principles of the MCU.

1. Operating Principle

When a button is pressed, the LED turns ON; when not pressed, the LED turns OFF.

2. Required Materials

Type Product Name Purchase Source and Installation
Hardware STM32F746 Discovery Kit https://kr.mouser.com/ProductDetail/STMicroelectronics/STM32F746G-DISCO?qs=sGAEpiMZZMsMyYRRhGMFNlt5IaEdZrcOkzygY9sKdC8%3d
Software Atollic TrueSTUDIO https://atollic.com/resources/download/

3. Guide

(1) Connect the computer's USB port to the board as shown below.

(2) Go to Windows tab -> Search for 'Device Manager' -> Verify that the STM32 MCU is connected properly.

If the connection fails, install the STM32 Virtual Port driver.

* Virtual Port Installation

https://www.st.com/content/st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-utilities/stsw-stm32102.html
(3) To create the development environment, you must generate a C project optimized for the STM32F746 in TrueSTUDIO.
From the menu, select File -> New -> C Project.
(4) Enter the project name -> Select Embedded C Project.
(5) Search for STM32F746 in 'Target' -> Select STM32F746NG
(6) Select ST-LINK as the debug probe
※ For screens omitted in the above process, simply click the 'Next' button without additional configuration.
The basic configuration is now complete. Write the code as shown below. For explanations of each line of code, refer to the comments on the right.
(7) In the project explorer on the left, double-click main.c -> Enter the following code below int main(void) -> Execute debug.
※ Details on pin configuration for the board will be covered in depth later.
(8) When debug is executed, the following screen appears. If there are no errors, click the stop debug button and the code will be built to the board.
(9) If the build is successful, it will operate as shown in the video below. If a build error occurs, check for typos
or missing semicolons.
* The attached source file can be verified by extracting the compressed file and opening the .cproject file with Atollic TrueStudio.

7,139
댓글 0
등록된 댓글이 없습니다.