background image

2

X-CUBE-SPN12 software expansion for STM32Cube

2.1

Overview

The 

X-CUBE-SPN12

 software package expands 

STM32Cube

 functionality, and features:

STSPIN240

 configuration (bridge input and enabling signals)

flag interrupt handling (overcurrent and thermal alarm reporting)

handling of up to two bidirectional dual brush DC motors

STM32 Nucleo

 and expansion board configuration (GPIOs, PWMs, IRQs, etc.)

To use the 

STSPIN240

 driver library, first call its initialization function to:

set up the required GPIOs to handle the bridge enabling pins and the FLAG interrupt which reports
overcurrent detection or thermal protection

set up the drivers

load the driver parameters with the values in "stspin240_250_target_config.h", in order to program the PWM
frequency of the bridge inputs and the number of brush DC motors .

You can easily modify the driver parameters through specific functions able to change the bridge configuration,
the number of motors or the PWM frequency.
You can also use callback functions with:

the flag interrupt handler, when 

a failure is reported by the 

STSPIN240

;

the error handler, called by the library when it reports an error.  

Then, you can drive different brush DC motors by setting a specified running direction and by changing the
maximum speed. When a motor is requested to run, the related bridge is automatically enabled.
A motion command can be stopped at any moment:

by a hard stop which immediately stops the motor

or by a hardHiz command which immediately stops the motor and disables the bridge it uses.

The library also provides functions to disable or enable the bridges independently of the run or stop commands.

2.2

Architecture

This 

STM32Cube

 software expansion enables development of applications using low voltage dual brush DC

motor drivers.

Figure 1. 

X-CUBE-SPN12 software architecture

Application

Example for 2 brush DC motors

STM32Cube Hardware Abstraction Layer (HAL)

Hardware
Abstraction

Hardware

NUCLEO-F401RE, NUCLEO-F334R8, NUCLEO-F030R8, NUCLEO-L053R8

X-NUCLEO-IHM12A1

STM32 Nucleo expansion boards

STM32 Nucleo development board

UM2110

X-CUBE-SPN12 software expansion for STM32Cube

UM2110

 - 

Rev 2

page 3/14

Summary of Contents for X-CUBE-SPN12

Page 1: ...R8 NUCLEO F030R8 or NUCLEO L053R8 development boards connected to an X NUCLEO IHM12A1 expansion board The software comes with a sample implementation driving two bidirectional low voltage dual brush DC motors RELATED LINKS Visit the STM32Cube ecosystem web page on www st com for further information Getting started with the X CUBE SPN12 low voltage dual brush DC motor driver software expansion for ...

Page 2: ...tion programming interface BSP Board support package CMSIS Cortex microcontroller software interface standard HAL Hardware abstraction layer SPI Serial port interface IDE Integrated development environment LED Light emitting diode UM2110 Acronyms and abbreviations UM2110 Rev 2 page 2 14 ...

Page 3: ...so use callback functions with the flag interrupt handler when a failure is reported by the STSPIN240 the error handler called by the library when it reports an error Then you can drive different brush DC motors by setting a specified running direction and by changing the maximum speed When a motor is requested to run the related bridge is automatically enabled A motion command can be stopped at a...

Page 4: ...BSP in the X CUBE SPN12 software provides the drivers to manage the STSPIN240 motor driver 2 3 Folder structure Figure 2 X CUBE SPN12 package folder structure The software is packaged in the following main folders Drivers STM32Cube HAL driver files which directly derive from the STM32Cube framework CMSIS folder with the CMSIS Cortex microcontroller software interface standard files from ARM These ...

Page 5: ...er value setup for the STSPIN240 bridge configuration number of brush DC motors bridge input PWMs frequency When used with an STSPIN240 driver as in the case of the X NUCLEO IHM12A1 expansion board this component requires the compilation flag declaration STSPIN_240 2 3 2 Project folder For each STM32 Nucleo development board the example projects are in the folder stm32_cube Projects Multi Examples...

Page 6: ...GPIO PA8 D7 Direction for B PHB DIR_B bridge GPIO PA0 TIM2 CH1 GPIO PA9 TIM1 CH2 GPIO PA0 TIM2 CH1 A0 or D8 for F0 REF GPIO PC7 D9 reset 2 5 APIs Detailed function and parameter descriptions for the user APIs are compiled in an HTML file in the software package Documentation folder X CUBE SPN12 software API is defined in the BSP motor control functions predefined through BSP_MotorControl_ Note Not...

Page 7: ... functionality of the STM32 Nucleo open development platform with a wide range of specialized expansion boards to choose from The STM32 Nucleo board does not require separate probes as it integrates the ST LINK V2 1 debugger programmer The STM32 Nucleo board comes with the comprehensive STM32 software HAL library together with various packaged software examples for different IDEs IAR EWARM Keil MD...

Page 8: ...ow voltage dual brush DC motor an external DC power supply with two electric cables up to 10 V a USB type A to mini B USB cable to connect the STM32 Nucleo to a PC laptop a Windows v 7 and above laptop or PC 3 3 Software requirements The following software components are needed for a suitable development environment for applications based on the motor driver expansion board ST LINK V2 1 USB driver...

Page 9: ...EO IHM12A1 bridge output connector A A and the second to connectors B B Step 4 Power on theX NUCLEO IHM12A1 expansion board by connecting its connectors Vin and Gnd to the DC power supply The DC supply must be set to deliver the required voltage to the three phase brushless motor Step 5 Open your preferred toolchain Step 6 Depending on the used STM32 Nucleo board open the software project from stm...

Page 10: ... Overview Section 2 2 Architecture Section 2 3 Folder structure Section 2 3 2 Project folder Section 3 3 Software requirements and Section 3 4 3 Setup to drive two bidirectional brush DC motors Removed Section 2 What is STM32Cube and Section 2 1 STM32Cube architecture and replaced them with a link in the Introduction UM2110 UM2110 Rev 2 page 10 14 ...

Page 11: ...cription 7 3 1 1 STM32 Nucleo 7 3 1 2 X NUCLEO IHM12A1 low voltage dual brush DC motor driver expansion board 8 3 2 Hardware requirements 8 3 3 Software requirements 8 3 4 Hardware and software setup 9 3 4 1 Common setup for all configurations 9 3 4 2 REF pin setup on X NUCLEO IHM12A1 expansion board 9 3 4 3 Setup to drive two bidirectional brush DC motors 9 Revision history 10 Contents 11 List of...

Page 12: ...List of tables Table 1 List of acronyms 2 Table 2 Required resources for the X CUBE SPN12 software 6 Table 3 Document revision history 10 UM2110 List of tables UM2110 Rev 2 page 12 14 ...

Page 13: ... Figure 1 X CUBE SPN12 software architecture 3 Figure 2 X CUBE SPN12 package folder structure 4 Figure 3 STM32 Nucleo board 7 Figure 4 X NUCLEO IHM12A1 expansion board 8 UM2110 List of figures UM2110 Rev 2 page 13 14 ...

Page 14: ...cts and ST assumes no liability for application assistance or the design of Purchasers products No license express or implied to any intellectual property right is granted by ST herein Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such product ST and the ST logo are trademarks of ST For additional information about S...

Reviews: