2
X-CUBE-SPN12 software expansion for STM32Cube
2.1
Overview
The
functionality, and features:
•
configuration (bridge input and enabling signals)
•
flag interrupt handling (overcurrent and thermal alarm reporting)
•
handling of up to two bidirectional dual brush DC motors
•
and expansion board configuration (GPIOs, PWMs, IRQs, etc.)
To use the
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
•
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
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