Quick Start to STM Nucleo on Arduino IDE

by sriksh9 in Workshop > Tools

112637 Views, 25 Favorites, 0 Comments

Quick Start to STM Nucleo on Arduino IDE

Nucleo.jpg

Nucleo boards are the highly affordable and powerful boards from the ST Microelectronics. STM32 Nucleo boards allow anyone to try out new ideas and to quickly create prototypes with any STM32 MCU.

However, Arduino is unbeatable in this segment due its simplicity and ease of its IDE. The performance to the cost ration of the Arduino boards is very low, which make some hobbyists to look into other boards. STM has bought up the Nucleo development boards, whose performance to the cost ratio is pretty high as compared to that of Arduino.

Thanks to "STM32 Core" (Official) team for porting some of their popular Nucleo boards into Arduino IDE and helping all the Arduino users happy to the core.

In the Arduino IDE

Arduino Preferences.PNG
Arduino_Preferences.PNG

Firstly open the Arduino IDE

Go to files and click on the preference in the Arduino IDE

Enter the 'https://raw.githubusercontent.com/stm32duino/BoardManagerFiles/master/STM32/package_stm_index.json' into the "Additional Boards Manager URLs"

Click "Ok" toclose the preference tab.

Installing the Package

Boards_Manager.PNG

Now Click on "Tools", click on "Board" a drop-down menu will be popped. Click on "Boards Manager". This opens the Boards Manager, scroll down and navigate to the "STM32 Core" package by ST-Microelectronics and install it.

And that's it, you've done with installing the Nucleo board packages into the Arduino IDE.

Pin Mapping

Mapped Pin Configuration.jpg
Mapped Pin Configuration.png

I have remapped the default pin map of Nucleo board to the Arduino IDE such that it would be much convenient to remember the pin notation.

The Header file can be downloaded from my GitHub profile, Click here.

Copy the downloaded folder to the Arduino-Library directory.

Default directory in Windows: 'C:\Program Files (x86)\Arduino\libraries'

Let's look at a basic example.

Blink Example

Blink.PNG
Nucleo Mapped to Arduino IDE

Before going to the coding part, firstly we have to select the Board and the port to which the board has been connected. For this;

Click on "Tools", click on "Board"- a drop-down box appears. scroll down and navigate to Nucleo-X (in my case, it is Nucleo-64) and select it, click on "Tools", click on "Board part number" and select your board (in my case, it is Nucleo F401RE) and again click on "Tools", click on "Port" and select the port on which your Nucleo board is mounted.

Now, let's head towards the coding part;

The source code for the basic blink program;

//Program to blink the onboard LED

#include <f401reMap.h>

int a = pinMap(12); //pinMap(Mapped Pin) - for mapped pin refer the attacted image int b = pinMap(1); void setup() { pinMode(a, OUTPUT); pinMode(b, OUTPUT); }

void loop() { digitalWrite(a, HIGH); digitalWrite(b, HIGH); delay(500); digitalWrite(a, LOW); digitalWrite(b, LOW); delay(500); }