💾
EC
  • Introduction
  • EC Course
    • Syllabus
    • Preparation for EC
    • Tutorial
      • Tutorial: arduino-stm32
        • Tutorial: arduino-stm32 Installation
        • Tutorial: arduino-stm32 Part1
        • Tutorial: arduino-stm32 Part2
      • Tutorial: MDK uVision
        • Tutorial: Installing MDK uVision
        • Tutorial: Create a Project with uVision
        • Tutorial: Adding library header in uVision
        • Tutorial: Re-using Project Configuration
        • Debugging in uVision
      • Tutorial: PlatformIO in CLion
      • Tutorial: PlatformIO in VSCode
      • Tutorial: Repository Management
      • Tutorial: Managing library header files
      • Tutorial: PinName Configuration
      • Tutorial: Bitwise Macro
      • Tutorial: Custom initialization
      • Tutorial: Documentation
      • Tutorial: Creating Application API
      • Tutorial: 7-Segment Display
      • Tutorial: DC motor driver connection
      • Tutorial: USART with TeraTerm
      • Tutorial: Finite State Machine programming
      • Tutorial: Bluetooth
      • Tutorial: Zigbee with Nucleo board
    • LAB
      • LAB Report Template
      • LAB: Smart mini-fan with STM32-duino
      • LAB: Portable Fan with mbed
      • LAB: GPIO Digital InOut
      • LAB: GPIO Digital InOut 7-segment
      • LAB: EXTI & SysTick
      • LAB: Timer & PWM
      • LAB: Stepper Motor
      • LAB: Input Capture - Ultrasonic
      • LAB: USART - LED, Bluetooth
      • LAB: ADC - IR reflective sensor
      • LAB: Line Tracing RC Car
    • Sample code
      • Code Templates
    • Hardware
      • Nucleo-F411RE
      • LAB Hardware
        • Electronic Chips
        • HUINS Embedded Kit
    • Projects
      • Line Tracing Car Project
      • Design Project
        • Past Projects
      • Project Grading Criteria
    • Study Resource for MCU
      • Hexa-Decimal Table
      • Bitwise Op for Register
      • System Clock
      • Timer
      • USART
      • ADC
  • STM32 M4 Programming
    • Documentation
      • C++ API Docs
    • Firmware Library
      • PinName Configuration
      • GPIO Digital
      • RCC
      • EXTI_SysTick
      • TIMER
      • USART
    • Troubleshooting
    • mbed for STM32
      • Tutorial: mbed-Part 1
      • Tutorial: mbed - Part 2
      • Tutorial: mbed - Part 3
      • Using mbed API on uVision
    • mbed OS
  • Other Programming
    • Arduino
    • Socket Programming
      • Window Socket Programming
      • Arduino WiFi
    • Cube-MX
    • Github
    • Markdown
      • Example: API documentation
    • MATLAB
  • C Programming
    • C-Programming Lessons
      • Installing Visual Studio Community
        • Visual Studio Community 2022
      • Installing VS Code(Mac/Linux)
      • Creating Header Lib
      • Pointer
      • Array
      • 2D Array
      • Structure
      • Dynamic Alloc
      • Bitwise Operation
  • Numerical Programming
    • Syllabus
    • Preparation for NP
    • Math Review
    • Tutorial
      • TA Session Video
      • Tutorial: NP Library Header Files
      • Tutorial - Sine Taylor
      • Tutorial: Passing a Function, Function callback
      • Tutorial: Nonlinear solver
      • Tutorial: Differentiation
      • Tutorial: Integration
      • Tutorial: Matrix Structure
      • Tutorial: Eigenvalue problem
      • Tutorial: ODE-IVP
      • Tutorial: Curve Fitting
      • Tutorial: Create Github Repos of NP lib
      • Tutorial: Version Control in Github
      • Tutorial: Documentation with Markdown
      • Exercise: Version Control and Documentation
    • Example: MATLAB
    • Example: NP Library
    • Assignment
      • Assignment Factorial and Power
      • Assignment: Version Control and Documentation
    • Problem Bank
Powered by GitBook
On this page
  • Overview
  • Hardware
  • Tutorial
  • Installing arduino IDE
  • Installing STM32 MCU based boards in arduino IDE
  • Add STM32 MCU board manager URL
  • Install STM32 MCU based boards
  • Hardware Setting
  • Install ST-Link Driver
  • Connect STM32F401RE through USB port
  • Connect STM32F401RE to arduino IDE
  • Example - Blink

Was this helpful?

  1. EC Course
  2. Tutorial
  3. Tutorial: arduino-stm32

Tutorial: arduino-stm32 Installation

PreviousTutorial: arduino-stm32NextTutorial: arduino-stm32 Part1

Last updated 9 months ago

Was this helpful?

Overview

In this tutorial, you will use arduino IDE compiler to handle several peripherals of MCU (ARM-Cortex M4). Using the given platform, you will perform some tasks about GPIO, timer and interrupt.

The objectives of this lab are

  • Connect STM32F (MCU board) to arduino IDE.

  • Understand digital in/out peripheral in MCU.

  • Understand timer and interrupt function of MCU.

  • Handle GPIO, timer and interrupt using arduino library.

Hardware

​ Figure 1. Pin configuration for NUCLEO-F411RE board (same pin configuration with NUCLE-F401Re)

Tutorial

Installing arduino IDE

Click "Windows Win 7 and newer" in Download options. Then, you should click "JUST DOWNLOAD" for free.

경로에 한글이름, 띄어쓰기 금지(오직 영어만 있어야 함)

Installing STM32 MCU based boards in arduino IDE

Add STM32 MCU board manager URL

On menu bar, select File > Preferences

Then, add board manager URL

https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json

Install STM32 MCU based boards

On menu bar, select Tools > Board: " " > Boards Manager...

Install STM32 MCU based boards.

Hardware Setting

Install ST-Link Driver

ST-LINK, ST-LINK/V2, ST-LINK/V2-1, STLINK-V3 USB driver signed for Windows10. This USB driver (STSW-LINK009) is for ST-LINK/V2, ST-LINK/V2-1 and STLINK-V3 boards(STM8/STM32 discovery boards, STM8/STM32 evaluation boards and STM32 Nucleo boards).

It declares to the system the USB interfaces possibly provided by the ST-LINK: ST Debug, Virtual COM port and ST Bridge interfaces. The driver must be installed prior to connecting the device, in order to have a successful enumeration.

After you download "en.stsw-link009_v2.0.2.zip", unzip the file.

Connect MCU board to PC with USB cable.

Update the usb driver: 윈도우 장치 관리자 > 범용직렬버스장치> ST-Link Debug >드라이버 업데이트>

  • Select the folder where en-stsw-link009 is unzipped

MCU board (STM32F411) must be connected to your PC to install the USB driver

Connect STM32F401RE through USB port

Check the port number and settings in "device manager".

  • baudrate: 9600

  • data bits: 8

  • parity: None

  • Stop bit: 1

  • Flow control: None

Connect STM32F401RE to arduino IDE

Arduino Setting for STM32F401RE

  • Board: Nucleo-64

  • Board part number: Nucleo F401RE

  • Port: USB port number connected with STM32 Board

Example - Blink

There is a simple example, that LED blinks every 1 sec.

On menu bar of Arduino IDE, select File > Examples > 01.Basics > Blink

Then, new window will be opened. If you click upload button, the example code will be loaded on the MCU.

If the program is loaded successfully then LED(LD1) will be green light.

Open

image
image
image
image

What is ST Link utiliy?

image
image
image
https://www.arduino.cc/en/software
Option 1: Download en.stsw-link009_v2.0.2.zip from github
Option 2: Download driver (STSW-LINK009) from ST website
https://m.blog.naver.com/ansdbtls4067/221510252896