- 1 Introduction
- 2 Development tool installation
- 3 Getting started
- 4 Power supply settings
- 5 LED indicators
- 6 Push button
- 7 JP2 (IDD) jumper settings
- 8 USART communication
- 9 ADC or I2C communication
- 10 SPI connector
- 11 USB connector
- 12 Solder bridges
- 13 10 Extension connector
- 14 How to compile and download program under mbed
- 15 How to export the Keil program from mbed
- 16 Connection between the Xnucleo board and Peripherals
- 17 Demo explanations
- 18 Related Modules
- 19 Resources
- 20 FAQ
- 21 Support
STM32 Development Board, Supports Arduino, Compatible with NUCLEO-F103RB
Development tool installation
CP2102 Virtual COM Port driver installation
STM32 Xnucleo includes an onboard USB TO UART interface based on CP2102 (“serial port” hereafter) for code debugging. Before using this interface, you should install a CP2102 driver firstly.
Run the installer: CP2102 Driver
When the installation finished, connect the XNucleo board to a PC via the USB TO UART interface. And you will find the CP210x USB to UART Bridge Controller in the Device Manager, if the driver is installed successfully.
STM32 ST-LINK Utility installation
Run the installer: STM32 ST-LINK Utility (For more detailed information about installation and usage of STM32 ST-LINK Utility, please refer to the document provided by ST: STM32-ST-LINK-Utility\Readme\STLINK Utility.pdf. You can also download the latest installer from the ST website).
When the installation finished, connect the ST-LINK/V2(mini) module to a PC. You will find the STMicroelectronics STLink dongle in the Device Manager, if the driver is installed successfully.
Please follow the sequence below to configure the STM32 Xnucleo board and launch the demo software:
- Jumper settings
- Set JP3 to U5V;
- Set JP2 to ON;
- Power supply and power selection
- For using a USB power supply, connect the Xnucleo board to a PC with a USB cable through the onboard USB connector;
- For using an external power supply, connect the power supply socket CN2 on the Xnucleo board to a 6~12V power adapter.
- Connect the ST-LINK/V2 (mini) debugger/programmer to the SWD connector
Notices: It is recommended to plug in the USB power supply or the external power supply before connecting the ST-LINK/V2(mini) module to the SWD interface. Otherwise, the ST-LINK/V2(mini) initialization may be failure.
Observing the actions
The blinking of the USER LED indicator will change from fast to slow or from slow to fast, when clicking the USER key.
Power supply settings
The power supply of the STM32 Xnucleo board is provided either by the host PC through the USB cable, or by an external source:
- VIN (7V~12V) or +3V3 power pins on CN6;
- E5V(5V) pin on CN7;
- CN2 power supply connector (7V~12V).
In case VIN, E5V, +3V3 or CN2 is used to power the Xnucleo board, you should use an external power supply unit.
Power supply input from the USB connector
All parts of the STM32 Xnucleo board and Shield can be powered from the ST-LINK/V2 (mini) USB connector by the host PC.
In case the ST-LINK/V2 (mini) USB connector is used to power the Xnucleo board, the host PC will provide 150mA current at maximum as 3.3V voltage is outputted from the ST-LINK/V2 (mini) USB connector to the Xnucleo board. And 300mA current at maximum may be provided when 5V voltage is outputted to the Xnucleo board. In case of the board requiring the current more than 300mA, it should be mandatory to use an external power supply as explained in the next chapter.
Each part of STM32 Xnucleo including the extension board can be powered by USB(U5V). However, if the maximum current consumption of the board exceeds 300mA, the USB may be damaged. When the board is power supplied by USB(U5V), a jumper must be connected between pin 1 and pin 2 of JP5 as shown in Table 2.
Table 2: Power-related jumper
|JP5||U5V (ST-LINK VBUS) is used as power source when JP5 is set as shown below (Default setting)|
|CN2, VIN or E5V is used as power source when JP5 is set as shown below|
Using CN2, VIN or E5V as external power supply
CN2, VIN or E5V can be used as external power supply in case the current consumption of Xnucleo and its extension boards exceeds the allowed current on USB. In this condition, it is mandatory to power supply the board using the external power source firstly, then connect the USB cable and ST-LINK/V2 (mini) to the PC to ensure that the Xnucleo board can work properly.
Table 3: External power source parameters
|Name||Pins||Voltage range||Max. current||Limitations|
|CN2||CN2||6V~12V||800mA||The inputted current is in connection with the inputted voltage:
For CN2/VIN = 7V,
the inputted current is 800mA.
For 6V < CN2/VIN <= 9V,
the inputted current is 450mA.
For 9V<CN2/VIN(< or =)12V,
the inputted current is 250mA
|VIN||CN6 pin 8
CN7 pin 24
|E5V||CN7 pin 6||4.75V~5.25V||500mA||------|
Notices: The following power sequence procedure must be respected when using an external power source:
- Set JP3 to U5V;
- Connect the external power source to CN2, VIN or E5V;
- Power on the external power supply CN2, VIN: 7V~12V, or E5V: 5V;
- Check that PWR LED is turned ON;
- Connect the PC to USB connector or ST-LINK/V2(mini) on Xnucleo.
If this order is not respected, the board may be supplied by VBUS or ST-LINK/V2(mini) firstly, and the following risks may be encountered:
If more than 300 mA current is needed by the board, the PC may be damaged or the current supply can be limited by the PC. As a consequence the board cannot work correctly.
External power supply output
- When powered by CN2, VIN or E5V, the +5V (CN6 pin 5 or CN7 pin 18) can be used as output power supply for an Arduino shield or an extension board. In this case, the maximum current of the power source specified in Table 3 needs to be respected.
- The +3.3 V (CN6 pin 4 or CN7 pin 12 & 16) can be used also as power supply output. The current is limited by the maximum current capability of the regulator U4 (500 mA max).
The LEDs on the STM32 Xnucleo board is used to provide information about the Xnucleo working status.
Table 4: The relationship between LED and the pins of MCU
|FLASH LED||MCU PIN|
It is easy to use each LED by setting JP7. For XNUCLEO-F302R8, the pin PB13 is connected to the MCU pin D13. And for other XNUCLEO devices, the pin PA5 is connected to the MCU pin D13. When the I/O is HIGH value, the FLASH LED is on. And when the I/O is LOW, the FLASH LED is off.
PWR LED Power supply indicator
The PWR LED default color is red. It indicates the power supply status of the STM32 Xnucleo board. The red LED indicates that the MCU part is powered by +5V.
Serial port working status LED indicators
TX indicator is in green, and RX indicator in blue. The blinking TX indicator means the MCU of STM32 Xnucleo board is sending message to the targeted PC. The blinking RX indicator means the MCU of STM32 Xnucleo board is receiving message from the targeted PC.
The USER button is connected to the I/O PC13(pin 2) of the targeted MCU by setting JP6 to ON;
This RESET button is connected to NRST, and is used to reset the targeted MCU.
JP2 (IDD) jumper settings
STM32 microcontroller is powered (default).
When this jumper is removed, STM32 microcontroller is not powered. But you can connect an ammeter on the JP6 to measure the STM32 microcontroller current.
The USART2 interface available on PA2 and PA3 of the STM32 microcontroller can be connected to Virtual COM Port, STMicroelectronics Morpho connector or to Arduino connector.
Connecting the targeted MCU to serial port
Please set the JP4 as follows, to connect the targeted MCU to serial port (For more information, please refer to Table 6 and Table 7).
- Connect the RX/PA3 of JP4 to the TXD;
- Connect the TX/PA2 of JP4 to the RXD.
Communication between the targeted MCU and shield or extension board
If the communication between the targeted MCU and shield or extension board is required, you should set the JP4 and the RX/D0 and TX/D1 on CN9 as follow (For more information, please refer to Table 6).
- Connect the RX/PA3 of JP4 to the RX/D0;
- Connect the TX/PA3 of JP4 to the TX/D1.
In such case it possible to connect another USART (if another USART is available on the targeted MCU) to the targeted MCU through Virtual COM Port using flying wires as follow
- Connect the TX/PC10/PC6 of JP4 to RXD;
- Connect the RX/PC11/PC of JP4 to TXD.
Here is the jumper setting for connecting to XNUCLEO-F030R8:
- Connect the TX/PA9 of JP4 to RXD;
- Connect the RX/PA10 of JP4 to TXD.
Notices: You should select a proper USART by referring to Table 5 and make corresponding hardware configurations, according to your actual demand. The USARTs (USART1 and USART3) listed in this table are unavailable under mbed, since only USART2(PA2, PA3) is defined for mbed. Therefore, when the USART-related APIs (such as printf) are required under mbed, you should select USART2(PA2, PA3) to connect to Virtual COM Port or CN9 on the pins RX/D0 and TX/D1.
Table 5: USART-related pins and jumpers
Table 6: Connections of JP4 pins
|ARDUINO PORT||MCU PIN||CP2102 PIN||MCU PIN|
Table 7: Connections of NUCLEO-F030R8 JP4
|ARDUINO PORT||MCU PIN||CP2102 PIN||MCU PIN|
ADC or I2C communication
If ADC or I2C communication is required, you can connect the ADC interface or the I2C interface to the Arduino connector or the ST Morpho connector by setting the JP5.
Here are the relative settings to JP5:
- The pins A4 and A5 of JP5 should be connected to the Arduino connector on the pins A4 and A5 (the pin 5 and the pin 6 of CN8) or the ST Morpho connector on the pins 36 and 38 of CN7 respectively;
- The pins SDA/PB9 and SCL/PB8 of JP5 corresponding to the I2C interface of STM32 MCU;
- The pins PC1/ADC and PC0/ADC of JP5 corresponding to the ADC interface of STM32 MCU.
Table 8: Connections of JP5 pins
|MCU PIN||ARDUINO PORT||MCU PIN|
The pins D11, D12 and D13 of Arduino connector are SPI interfaces. For XNUCLEO-F302R8, the pins PB13, PB14 and PB15 are connected to the pins D13, D12 and D11, respectively. And for other XNUCLEO devices, the pins PA5, PA6 and PA7 are connected to the pins D13, D12, and D11, respectively.
Except the XNUCLEO-F030R8, all the other XNUCLEO devices have reserved a USB connector which can be enabled by setting JP1 to ON.
Table 9: solder bridges
|SB74||ON||IOREF is connected to 3.3V|
|SB75||ON||IOREF is connected to 5V|
|SB45 (VBAT/VLCD)||ON||VBAT or VLCD on STM32 MCU is connected to VDD.|
|OFF||VBAT or VLCD on STM32 MCU is not connected to VDD.|
|SB57 (VREF+)||ON||VREF+ on STM32 MCU is connected to VDD.|
|OFF||VREF+ on STM32 MCU is not connected to VDD and can be provided from pin 7 of CN10|
Notes: All the other solder bridges present on the STM32 Xnucleo board are used to configure several IOs and power supply pins for compatibility of features and leads with STM32 MCU supported.
10 Extension connector
The following figures show the signals connected by default to Arduino connectors (CN5, CN6, CN8, CN9) and to ST Morpho connector (CN7 and CN10), for each STM32 Xnucleo board.
Figure 1: XNUCLEO-F030R8
Figure 2: XNUCLEO-F103RB
Figure 3: XNUCLEO-F302RC
Figure 4: XNUCLEO-F401RE
Figure 5: XNUCLEO-F411RE
Xnucleo series is fully compatible with Nucleo series and can run the Nucleo Demos directly. Therefore, you can develop your STM32 Xnucleo applications based on the applications of STM32 Nucleo. Table 10 gives the relationship between Xnucleo series and Nucleo series.
Table 10: Relationships between Xnucleo series and Nucleo series
The operations presented in this document are based on XNUCLEO-F103RB. For different Xnucleo devices, there may be some differences in configuring the development environment. So users should operate according to the actual conditions.
How to compile and download program under mbed
In this section, we only present the ways to compile and download program, since it does not have room to address every factor of mbed. For more detailed information about the usage of mbed, please refer to the documents provided by mbed organization.
Here we take XNUCLEO-F103RB as an example. Start the mbed software, and open a program, such as Nucleo_printf. Then, click the button Compile for program compiling. If the program has no error, Compile Output will show “Success!” after the compiling is finished. And the file Nucleo_printf_NUCLEO_F103RB.bin will be generated. This file can be found in the specified save path (This save path is modifiable).
- Run the STM32 ST-LINK Utility, and select file->Open file. Then, open the file Nucleo_printf_NUCLEO_F103RB.bin.
- Connect the USB TO UART interface on the board to your PC with a USB cable, and then connect ST-LINK/V2(mini) module to download the .bin file. Then, set the JP5 to U5V. For the JP4 setting, please refer to Section 2.5 USART communication. The serial port should be configured according to Table 11.
Table 11: Serial port configuration
- When the program downloading finished, COM port will receive the following information:
Hello World! This program runs since 1 second. This program runs since 2 seconds. This program runs since 3 seconds. This program runs since 4 seconds. This program runs since 5 seconds.
At this time, the USER LED is blinking in the frequency of 0.5Hz. And the TX LED keeps blinking to indicate that STM32 Xnucleo is sending message to the PC.
How to export the Keil program from mbed
Circuit debugging are unavailable in mbed. However, mbed has “Import Program” and “Export Program” functions. You can export the programs in mbed as Keil programs to perform debugging.
The mbed library file can also be exported, which includes the HAL library of STM32 MCU. Under the Keli environment, mbed libraries can be applied or modified directly, and can be transplanted into other applications.
The relative operations are as follow:
In the mbed, open the program you want to export. Then, right click the program name in the Program Workspace, and select Nucleo_printf->Export Program, as Figure 5 shows.
Figure 5: Exporting as Keil program
In the Export Toolchain pull-down menu of the pop-up window, select Keil μVision. Then, the programs in mbed can be exported as Keil programs and performed Keil debugging. For more detailed information, please refer to the Keil-related technical documents.
Besides Nucleo Demos, the Demos for different periphery modules provided by Waveshare are supported by Xnucleo series as well. The corresponding devices to the periphery module Demos include but not limited to: Temperature-Humidity Sensor, Rotation Sensor, Color Sensor, UV Sensor, Water Sensor, Moisture Sensor, Vibrating Sensor, Tilt Sensor, Laser Sensor, Gas Sensor, Sound Sensor, Flame Sensor, Hall Sensor, Metal Sensor, Infrared Reflective Sensor, OLED display module and so on. And these Demos for different periphery modules are integrated into a big Demo (“periphery module Demo” hereafter) for convenience.
Connection between the Xnucleo board and Peripherals
Table 12: Connection between the XNUCLEO and sensors
Infrared Reflective Sensor
- The pins VCC and GND of the sensors listed above should be connected to the pins VCC and GND of IO Expansion Shied. For more detailed information, please refer to IO Expansion Shied User Manual.
- Some of the sensors may only lead out the pin AOUT or the pin DOUT. In this case, the additional reserved pin(s) of IO Expansion Shied can be left unconnected. One IO Expansion Shied can only connect one sensor at a time.
When the Demo is running, the LED1 on the XNUCLEO board will blink at the rate of every 2 seconds.
Data display mode
For the periphery module Demo, there are two modes for displaying the returned information from the module: OLED and Screen Print (relative information is sent to the PC via the serial port every 500 ms). Here is an example:
Figure 6: OLED displays relative sensor parameters
At the same time, relative data will be outputted:
/*----------------------*/ T: 23 C H: 34 D: 3868 A: 3.116 S: OFF Rot: 227 SW: 52 R: 20 G: 6 B: 105 RTC: 12:1:4 KEY: 10 /*----------------------*/
The meanings of the returned data
Table 13: The meanings of relative symbols
|T||Temperature||Unit: Degrees Celsius|
|H||Humility||Air humility percentage (%)|
|D||AD value||Voltage value in the format of 12 BIT. It can be converted to actual value by linear transformation.|
|A||DA value||Voltage value|
|S||State||There are two states: ON and OFF|
|Rot||Rotation count for rotation encoder||For clockwise rotation, the counter value is incremented by 1; for anticlockwise rotation, the counter value is decremented by 1. The count can be a minimum of 0 and maximum 255.|
|SW||Button press count for rotation encoder||It supports single click, double click, long press and continued shot|
|R||Red value||Users can get the actual color on the basis of the RGB value. For more information, please refer to Color Sensor User Manual|
|G||Green value||Users can get the actual color on the basis of the RGB value. For more information, please refer to Color Sensor User Manual|
|B||Blue value||Users can get the actual color on the basis of the RGB value. For more information, please refer to Color Sensor User Manual|
|RTC||Real time clock||The outputted time information from RTC.|
|KEY||USER button press count for Xnucleo||Its usage is the same as the SW of the rotation encoder.|
- Sensors Pack
- IO Expansion Shield
- Analog Test Shield
- Accessory Shield
- Music Shield
- RS485 CAN Shield (Only for XNUCLEO-F103RB, XNUCLEO-F302R8)