Arduino IDE configuration 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
  • USB Leaf
  • PC (Windows, Mac OS X or Linux)

Arduino IDE is assumed to be installed.

Configuration of the microcontroller board

To use the STM32 MCU leaf with the Arduino IDE, the STM32 Cores must be installed.

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

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

For more information on STM32 Cores, please see here.

Install STM32CubeProgrammer software V2.4.0 and you will be able to use STM32 MCUs.

Please note that V2.5.0 does not work.

Click the Get Software button.

Click Select versions and select 2.4.0.

Click ACCEPT.

Enter the First Name, Last Name and E-mail address, check □I have read and understood the Sales Terms & Conditions, Terms of Use and Privacy Policy and click Download.

You will see the following.

You will receive an email at the address you registered with, click Download now to download it.

Configuration of the microcontroller board

Click ToolBoardSTM32 Boards (Selected from submenu)Nucleo-64 .

Click ToolBoard part number: *****Nucleo L452RE.

Click ToolUpload method: *****STM32CubeProgrammer(Serial).

Now you can use the STM32 MCU leaf.

Writing to the microcontroller board

Turn the write switch on the STM32 MCU leaf to On. The red LED will then turn on. Click the Write to Arduino IDE microcontroller board button. The message Start operation achieved successfully is displayed if the writing was successful.

Once the writing is complete, turn off the write switch on the STM32 MCU leaf.The red LED will turn off. The red LED will turn off.Then press the reset switch on the STM32 MCU leaf.

If you write without setting the write switch to On The message Writing to the board is completed is displayed, but Timeout error occured is shown at the bottom.

Pin Specification

The pin layout of the STM32 MCU differs from that of the Nucleo L452RE, so please specify the pins to be used in the STM32L452RE’s port name.

The difference between sketches.

Timer

”MsTimer2” for AVR MCU is not available for STM32 MCU. You should use HardwareTimer and so on. The usage example is as follows. Please refer to here for more details.

Initialization

HardwareTimer *timer2 = new HardwareTimer (TIM2);

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


Interrupt routine ```c++ void intTimer(void){ bInterval = true;  :  : } ```

Use of SWD

By connecting the AX01 Shield, you can use SWD.



 SWD Connector Specifications
Model number of the connector FTSH-105-01-L-D
Number of pins 10
pin pitch 1.27mm

pin assignment


STLINK-V3SET comes with a cable that connects to the SWD connector of AX01 Shield, allowing you to connect it as it is.


If you have an ST-LINK-V2, you can connect it with a conversion adapter. You can also use a conversion adapter to connect to the Nucleo’s SWD using a jumper cable or other means.


If you want to connect to Nucleo’s SWD, you can also build your own.
Half-pitch ribbon cable
Half-pitch pin header
Pitch Conversion Board
Pin-socket

Last modified 01.01.0001