Download Databrief

X-CUBE-SPN1
STM32Cube software expansion for the X-NUCLEO-IHM01A1
expansion board
Data brief
Description
X-CUBE-SPN1 is a software package based on
STM32Cube for the X-NUCLEO-IHM01A1
expansion board. It is compatible with the
NUCLEO-F401RE, the NUCLEO-F030R8, the
NUCLEO-L053R8 and NUCLEO-F334R8 boards
equipped with one or more (up to 3) X-NUCLEOIHM01A1 boards.
The software is based on the STM32Cube
technology to facilitate portability across different
STM32 MCU families. Information regarding
STM32Cube is available on www.st.com at
http://www.st.com/stm32cube
Features




Driver layer for complete management of the
L6474 microstepping motor driver integrated
in the X-NUCLEO-IHM01A1 expansion
board
Examples for controlling up to three stepper
motors
Easy portability across different MCU
families, thanks to STM32Cube
Free, user-friendly license terms
February 2016
DocID027149 Rev 2
For further information contact your local STMicroelectronics sales
office
1/5
www.st.com
X-CUBE-SPN1
Description
What is STM32Cube?
STMCube™ represents the STMicroelectronics initiative to make developers’ lives easier
by reducing development effort, time and cost. STM32Cube covers the STM32 portfolio.
STM32Cube version 1.x includes:


STM32CubeMX, a graphical software configuration tool that allows the generation of
C initialization code using graphical wizards.
A comprehensive embedded software platform specific to each series (such as the
STM32CubeF4 for the STM32F4 series), which includes:

the STM32Cube HAL embedded abstraction-layer software, ensuring maximized
portability across the STM32 portfolio

a consistent set of middleware components such as RTOS, USB, TCP/IP and
graphics

all embedded software utilities with a full set of examples
How does this software complement STM32Cube?
The X-CUBE-SPN1 software package allows complete management of the L6474 fully
integrated microstepping motor driver by providing complete APIs. It offers the following
features:







L6474 registers read, write
Nucleo and expansion board configuration (GPIOs, PWMs, IRQs, etc.)
Speed profile configuration
Motion commands
FLAG interrupts handling (alarms reporting)
Microstepping handling
Daisy chaining handling
When initializing the L6474 driver, the user specifies the number of L6474 devices which
are connected to the STM32 Nucleo Board (i.e. the number of X-NUCLEO-IHM01A1
expansion boards). Once set, the number of devices must not be changed.
Depending on the number of devices, the driver:







sets up the required GPIOs to handle the motor directions and the FLAG interrupt
initializes the PWMs to act as step clock generators
initializes the speed profile (acceleration, deceleration, min and max speed) from the
parameters in l6474_target_config.h
starts the SPI driver to communicate with the L6474 devices
releases the reset of each of the L6474 devices
disables the power bridge and clears the status flags of the L6474 devices
loads the registers of each L6474 device with the predefined values in
l6474_target_config.h
Once initialization is complete, the user can modify the L6474 registers and speed profile
configurations as desired. Most of the functions of the driver take a device ID (from 0 to 2)
as an input parameter so users can specify which device configuration to modify.
The user can also write a callback function and attach it to the Flag interrupt handler,
depending on the actions to be performed when an alarm is reported (read the flags, clear
and read the flags, etc.).
The user can then request the movement of one or more motors (via device IDs). This
request can be:

2/5
to move for a given number of steps in a specified direction
DocID027149 Rev 2
X-CUBE-SPN1


How does this software complement STM32Cube?
to go to a specific position
to run until it receives a new instruction
On reception of this request, the driver enables the PWM which is used as the step clock of
the corresponding L6474.
For each pulse period, the motor performs one step and an ISR (interrupt service routine)
is triggered on the microcontroller side. This ISR is used by the firmware to count the
number of performed steps and to update the speed. Indeed, the motor starts moving by
using the minimum speed parameter. At each step, the speed is increased using the
acceleration parameter.
If the target position is far enough, the motor will perform a trapezoidal move:




acceleration phase using the device acceleration parameter
steady phase where the motor turns at maximum speed
deceleration phase using the device deceleration parameter
stop at the targeted position
Otherwise, if the target position does not allow it to reach maximum speed, the motor will
perform a triangular move:



acceleration phase using the device acceleration parameter
deceleration phase using the device deceleration parameter
stop at the targeted position
A move command can be interrupted at any time by either:


a soft stop or softHiz which progressively decreases the speed using the
deceleration parameter. Once the minimum speed is reached, the motor is stopped.
a hard stop or hardHiz command which immediately stops the motor.
When the motor is stopped using the softHiz or hardHiz command, the power bridge is
automatically disabled.
To inhibit the sending of a new command to a device before the completion of the previous
one, the driver offers the BSP_MotorControl_WaitWhileActive() command which
locks program execution until the motor stops moving. The driver also allows changing the
step mode (from full step to 1/16 microstep mode) for each device. When the step mode is
changed, the current position (ABS_POSITION register) is automatically reset, but the user
must update the speed profile (maximum and minimum speed, acceleration deceleration).
DocID027149 Rev 2
3/5
X-CUBE-SPN1
Revision history
Revision history
Table 1: Document revision history
Date
Version
Changes
07-Nov-2014
1
Initial release.
19-Feb-2016
2
Text changes throughout document
Updated cover page image
Added reference to NUCLEO-F334R8 compatibility
4/5
DocID027149 Rev 2
X-CUBE-SPN1
IMPORTANT NOTICE – PLEASE READ CAREFULLY
STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, enhancements, modifications, and
improvements to ST products and/or to this document at any time without notice. Purchasers should obtain the latest relevant information on ST
products before placing orders. ST products are sold pursuant to ST’s terms and conditions of sale in place at the time of order
acknowledgement.
Purchasers are solely responsible for the choice, selection, and use of ST products 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. All other product or service names are the property of their respective owners.
Information in this document supersedes and replaces information previously supplied in any prior versions of this document.
© 2016 STMicroelectronics – All rights reserved
DocID027149 Rev 2
5/5
Similar pages