📜 ⬆️ ⬇️

Quick Start ST Nucleo-F401 + Quick Start Guide

In my previous post I tried to brief you on the ST Nucleo platform.
In this post, I want to tell you, on a live example, some of the strengths of this platform, which has every chance to press the bored to all Arduino, and show that all the Arduino code samples and shields are great for the Nucleo platform.



Why Nuleo-F401?



Nuleo Platform It is a hybrid of DISCOVERY and Arduino platforms, allowing users to easily use almost all extensions and all code examples for
')
Arduino. This platform supports MBED.ORG , which eliminates the headache of many newbies in installing, configuring, and using compilers for ARM. Almost all existing extensions for Arduino are imported to mbed.org. Unlike the widely used DISCOVERY platform, which is widely used by many, the platform has no peripherals on its board, such as an accelerometer, a compass, etc. But the Nucleo platform is designed to make work on it as simple as on the platforms from the Arduino. The platform also has a flexible power scheme (3.3V-5V-7V-12V), a built-in updated ST-LINK / V2.1 programmer for programming any STM32, an integrated virtual COM port (connected to USART by default), a simplified microcontroller programming procedure thanks to emulation removable media giving access to the flash memory of the microcontroller.

You can study the features of the STM32F401RE microcontroller on your own , I chose the ST Nucleo-F401, due to the fact that at the time of purchase it was the oldest available model, different from the rest, with its higher performance and large memory capacity.

Beginning of work!


To get started, we need to register on Mbed.org and add the platform we need to our list of devices.

Instructions for dummies, click to see
Register at Mbed.org


To do this, follow the link mbed.org/account/signup and follow the instructions, fill out the registration form.



Select "No, I have not created an account before" (No, I have not previously created an account)



Fill in the registration form and click "SignUp" (Register)



The message “Welcome to mbed!” Should appear. Click here for MBED.HTM



After this at the top left, click "Platform" and open the list of all platforms supported by the project, and in the list go to our platform (in our case it is Nucleo-F401RE).



Having opened the platform description, we find the button “Add to your mbed Compiler” on the left. Clicking it we add the selected platform to the list of our platforms.



Now let's click on your nickname (at the top right) and go to the main page of your profile, here at the bottom right we can see the newly added platform.



Actually, we all registered and added our own platform.


Installing drivers.

On the site Mbed.org in the section of our platform, at the bottom we can see the link by clicking on which we need to download, install and run:
  1. you must first install the ST-LINK / V2-1 USB driver for the programmer, for Windows Vista, 7 and 8 STSW-LINK008 or STSW-LINK009 for Windows XP
  2. Update firmware of ST-LINK / V2-1 STSW-LINK007 USB-connected programmer

Instructions for dummies, click to see
Let's start in order, download the current Driver and firmware update on this page KLAC
we supposedly need two files one " ST-LINK / V2-1 firmware upgrade " the second is allowed " ST-LINK / V2-1 USB driver on Windows Vista, 7 and 8 "



We unpack the archives downloaded by us, and we start.
Start the installation of the drivers: in the unpacked STSW-LINK008 or STSW-LINK009 archive, launch the file under the name stlink_winusb_install for our board (the board is not yet connected via USB).



Run this file, which will determine the system width and type of installation. We agree with everything, and click yes, further, etc.
Now we can connect our board via USB and see that the LEDs light up and you have decided on a new removable media.

We launch the firmware update of our platform programmer:
To do this, we connect our debugging platform to the computer, go to the folder with the unpacked update archive of the STSW-LINK007 programmer and launch the ST-LinkUpgrade file



In the window that appears, click "Device Connect" (Device Connect), after updating the device and connecting to it, click "Yes >>>" the program itself will do everything and disconnect from the device at the end, then you can close it.

All this installation of fresh drivers and firmware updates is over.


Platform Connection:

For the curious, I will try to explain some modes of operation in more detail:
Information for the curious, click to see. CAUTION!
Brief technical information from the manual

image
Modes of operation of the LEDs.

3 LEDs are implemented on the board
Three-color LED (green, orange, red) LD1 (COM) provides information on the status of ST-LINK connection. LD1 color is red by default. LD1 turns green, indicating that in the process of making the connection between the PC and ST-LINK / V2-1, in the following:
  • “Slow flashing red” / “Off” - when power on prior to establishing a USB connection
  • “Flashing red quickly” / “Off” - after the first correct data exchange between the PC and STLINK / V2-1 (connection process)
  • “Red LED on” - if the connection between the PC and ST-LINK / V2-1 is established
  • “Green is on: connection succeeded or operation completed correctly
  • "Flashing red" / "green" - during data transfer. (The firmware process itself)
  • “Orange on”: Communication failure.


USER LD2 : green user LED, the LED is connected to the Arduino contact D13, corresponding to the input / output contact of the PA5 microcontroller (pin 21) or PB13 (pin 34)
  • When the input / output (I / O) value is high, the LED is on.
  • When the input / output (I / O) value is low, the LED is off.


LD3 PWR : a red LED indicates that the microcontroller part is powered and +5 V power is being supplied.

Buttons

B1 USER : user button is connected to PC13 input / output (pin 2) of the STM32 microcontroller.
B2 RESET : this button connects to the NRST , and is used to reset the STM32 microcontroller.

Note: Blue and black plastic caps on the buttons can be removed if necessary, for example, when the shield or expansion card is connected on top of the Nucleo. This will avoid pressure on the buttons and consequently possible constant accidental pressing.


Jumper JP6 (IDD)

Jumper JP6 , labeled IDD , is used to measure the current consumption by the microcontroller, to do this, remove the jumper and connect an ammeter.
  • Jumper Enabled: STM32 microcontroller is powered (default).
  • Jumper OFF: the ammeter must be connected to measure the current of the STM32 microcontroller. If there is no ammeter, the STM32 microcontroller is not powered.


Built-in ST-LINK / V2-1

The in-circuit debugger / programmer ST-LINK / V2-1 only supports SWD for STM32 devices.
Changes from ST-LINK / V2 version:
New features supported in ST-LINK / V2-1:
  • USB drivers renumbered
  • Virtual COM Port USB Interface
  • Interface USB storage devices
  • USB power manager

Features not supported ST-LINK / V2-1:
  • SWIM interface. (Needed for STM8 programming)
  • Minimum supported application voltage limited to 3 V

Modes of operation of the built-in ST-LINK / V2-1:
Jumper StatusValue
both CN2 jumpers are dressedST-LINK / V2-1 works by programming the microcontroller on the board (default)
both CN2 jumpers removedST-LINK / V2-1 works by programming the microcontroller via external connector CN4 (SWD is supported)

SWD pinout:
PinCN4Value
oneVDD_TARGETVdd for device
2SWCLKSWD tact
3GNDLand
fourSWDIOSWD data input / output
fiveNRSTreset programmable MK
6SwoNot used


PCB Splitting

The STM32 Nucleo platform PCB is divided into two parts: the ST-LINK part and the target MCU part, which can be divided to reduce the size of the board. In this case, the remaining target MCU part can be powered only by VIN, E5V and 3.3V on the ST Morpho CN7 or VIN connector and 3.3 on the Arduino CN6. You can still use the ST-LINK part to program the main microcontroller using wires between the CN4 SWD and the connectors on the ST Morpho ( SWCLK CN7 pin-15 and SWDIO CN7 pin-13 ).

Board power modes.

The power supply is provided either from a computer via a USB cable or from an external source: VIN (7V-12V), E5V (5V) or + 3V3 power leads to CN6 or CN7.
ST-LINK / V2-1 supports platform power via USB, while the programmer itself consumes current up to 100 mA.

The entire STM32 Nucleo card including the expansion cards can be powered by ST-LINK USB provided that the total current consumption does not exceed 300mA (Including ST-LINK consumption 100 mA) when these conditions are met the red LD3 LED is on and the micro controller is working. If the current consumption is higher, then it is necessary to use an external power supply for the entire project or only for expansion cards (not forgetting the common ground).

When the board will be powered by USB (U5V), the jumper must be connected between pins 1 and 2 of JP5 to the U5V position. JP1 jumper can be installed only in the case when the board is powered by USB and the maximum current consumption on U5V should not exceed 100 mA (including various expansion cards or Arduino Shield).

VIN (7V-12V) or E5V (5V-5.5V) can be used as an external power source in the case when the current consumption of Nucleo and expansion cards exceeds the permissible current for USB. In this state, you can still use a USB connection, for programming or debugging, but first, be sure to connect the board to a power source using VIN or E5V, and then connect the USB cable to the PC.

When powered by VIN or E5V, the power-on algorithm should be followed:
  • Connect a jumper between pins 2 and 3 of JP5.
  • Make sure JP1 is removed.
  • Connect external power supply to VIN or E5V.
  • The voltage on the external power supply is 7 V <VIN <12 V to VIN or 5 V for E5V.
  • Make sure LD3 is on.
  • Connect your PC to the CN1 USB connector.

If this order is not observed, then the board can be powered first via VBUS and then via VIN or E5V, while the USB port on the computer may fail or glitches of the microcontroller may occur (! The same applies to the reset button!)
When the board is powered by VIN or E5V, the jumper configuration should be as follows:
  • Jumper on JP5 between pin 2 and pin 3.
  • Jumper removed on JP1.

External power supply:
Power inputConnector ContactsVoltageCurrentRestriction
VINCN6 pin 8, CN7 pin 24from 7V to 12V800 mA800 mA if Vin = 7 V, 450 mA if 7 V <Vin (<or =) 9 V, 250 mA if 9 V <Vin (<or =) 12 V
E5VCN7 pin 6from 4.75V to 5.25V500 mA


(Actually micro manul is over. You can exhale and continue)

For the rest, it is enough to remember that the board has a jumper JP5 and it has two positions, the microcontroller is powered from USB (U5V position is not more than 300mA) or from an external source (E5V) power supply, for example, from 5 volts connected to CN7 (the most Left connector, pin -6 E5V and pin-8 GND). Connector layout

And so we connected and saw that a removable media was detected in our computer, this is a sign that everything was done correctly and everything works. You can check whether the microcontroller itself works correctly by pressing the user button; when clicking on it, the flickering frequency of the user LED should change. Having played enough with the LED go further.

Now is the time to create our first program in Embed and flash our controller with it.
I will clean up similar subsections under spoler to save space.
First program and first programming
First program and first programming

Creating a draft program in Mbed

On the page of your profile in Mbed, we open a page with our platform, then using pictures as help, we do the following:
(1) Open online compiler

(2-3) Create a project called "Blinky LED test for the ST Nucleo boards" and click "OK"


(4 - 5) Open and compile the binary file (5).

After that, we will be asked to save this binary (the procedure depends on your browser). We simply copy the resulting binary or move it to Nucleo removable media, and if you update the content of the removable media immediately after copying, you will not be able to see it, which indicates that the micro controller is re-flashed! (during the firmware you will see the LED_COM LED blinking cheerfully)


The post was written all night and will soon be supplemented with examples, I want to note that any extensions from the Arduino easily fit under the Nucleo, there are no problems with the sketches either.

Source: https://habr.com/ru/post/230931/


All Articles