Arduino IDE settings for STM32 MCU

Install STM32 Cores in Arduino IDE

Follow these steps to set up your STM32 MCU development environment.

What to prepare

  • STM32 MCU Leaf
  • Basic Kit
  • PC (Windows, Mac OS X or Linux)

Installing the Arduino IDE

For instructions on how to install the Arduino IDE, please here.

Connect to PC

Connect it to your PC with a USB cable.


Configuration of the microcontroller board

To use the STM32 MCU leaf with the Arduino IDE, the STM32 Cores must be installed. Please follow the steps below to configure the settings. (For more information about STM32 Cores, see here).

  1. Open the File → Preferences in the Arduino IDE and enter the following URL in the Additional Board Manager URL: field.

https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json

  1. Select Tools -> Board -> Board Manager, search for STM32 Cores and press the Install button.

  2. Go to Tools → Board→ STM32 Boards (Selected from submenu)→ Nucleo-64 .

  3. Go to Tools → Board part number: *****→ Nucleo L452RE .

  4. Go to Tools → Upload method: ***** → STM32CubeProgrammer(Serial) .

  5. Go to Tools → Serial Port and select the serial port to which Leafony is connected.

Installing the STM32CubeProg

To be able to write programs to the STM32 MCU leaf, you need to install STM32CubeProg 1.The STM32CubeProg can be downloaded and installed on your PC here.

Checking the operation of the microcontroller board

  1. When the program switch on the STM32 MCU leaf is set to the program side, the LED will light up.

  2. Next, refer to the sample application “Temperature and humidity sensor” and write the program. If it is written successfully, the message Start operation achieved successfully will be displayed.If it is not displayed 2, be careful.

  3. When writing is complete, turn the STM32 MCU leaf’s Program switch to the Run side to turn off the LED.

  4. Press the Reset switch on the STM32 MCU leaf.

Specifying pins for a sketch

Since the pin layout of the STM32 MCU is different from that of the Nucleo L452RE, it is not possible to use names when specifying pins. For STM32 MCU leaf, specify pins by port (Port)

Installing libraries

To use some of the leaves, you will need to install additional libraries. Here to install all libraries in advance. However, you cannot use the timer interrupt library (MsTimer2.h) because it is an AVR MCU library. Please refer to the following HardwareTimer.

HardwareTimer

An example of use is given below. For more information here.

Initialization

HardwareTimer *timer2 = new HardwareTimer (TIM2);

  timer2->setOverflow(LOOP_INTERVAL, MICROSEC_FORMAT);       // 125ms
  timer2->attachInterrupt(intTimer);
  timer2->resume();

Interrupt routine

void intTimer(void){
  bInterval = true;
 
 
}

When in doubt

You can find the solution in “If it doesn’t work…”.

Back to previous page


  1. We have confirmed that V2.6.0 and V2.4.0 work on Windows 64bit. However, please note that V2.5.0 will not work. ↩︎

  2. When writing without the program switch on the program side, the message Writing to the board is complete is also displayed, but the bottom of the screen shows Timeout error occured while waiting for acknowledgement.

    ↩︎

Last modified 01.01.0001