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)
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
Get the Software: Click "Get Software" to download the latest version. You may need to create a free ST account.
Install It: Run the downloaded installer. The default settings are fine, so just click through the installation. The tool will typically be installed at: C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer
STM32CubeProgrammer Installer
Step 2: Set Up the Environment Path 🗺️
This step tells your computer where to find the program.
Open Environment Variables: In the Windows search bar, type "Edit the system environment variables" and open it.
Click "Environment Variables...": A new window will open.
Edit the Path: In the "System variables" section, find and double-click on the Path variable.
Add the New Path: Click New and add the path to the bin folder from your installation. It should look like this: C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin
Confirm: Click OK on all windows to close and save the changes.
Step 3: Configure Arduino IDE & Upload 🔄
Restart Arduino IDE: This is very important! Completely close and reopen the Arduino IDE for the new settings to take effect.
Set the Upload Method: In the Arduino IDE, go to the Tools menu.
Board: Make sure your Nucleo-F411RE is selected.
Upload Method: Click on this and select STM32CubeProgrammer (SWD).
Upload Your Sketch: Try uploading your code again. It should now work perfectly!