Expansion SW library to control high power stepper motor(s) using IHM03A1 expansion board(s) with Powerstep01 driver.

Dependencies:   X_NUCLEO_COMMON ST_INTERFACES

Dependents:   IHM03A1_ExampleFor1Motor HelloWorld_IHM03A1 IHM03A1_ExampleFor3Motors KYPHOS_Stepper_Motor_Control

Fork of X_NUCLEO_IHM03A1 by ST Expansion SW Team

Motor Control Library

Library to handle the X-NUCLEO-IHM03A1 Motor Control Expansion Board based on the Powerstep01 component.

It features the:

  • read and write of Powerstep01 registers
  • Nucleo and expansion board configuration (GPIOs, PWMs, IRQs, etc.)
  • Powerstep01 application commands handling
  • FLAG and BUSY interrupt handling (alarm reporting)
  • Daisy chain handling

The API allows to easily:

  • perform various positioning, moves and stops
  • get/set or monitor the motor positions
  • set home position and mark another position
  • get/set minimum and maximum speed
  • get current speed
  • get/set acceleration and deceleration
  • get/set the step mode (up to 1/128)
  • get/set the control method
  • get/set parameters for voltage mode driving
  • get/set parameters for current mode driving
  • get/set parameters for gate driving
  • configure various protections such as overcurrent detection
  • enable/disable alarms
  • handle step-clock
  • get system status

Daisy-Chain Configuration

The IHM03A1 board can be stacked up to three times so that the Powerstep01 components will be connected in daisy-chain configuration. For this purpose, some resistors must be correctly connected on the boards as depicted here below:

/media/uploads/nucleosam/driving1steppermotor.png /media/uploads/nucleosam/driving2steppermotors.png /media/uploads/nucleosam/driving3steppermotors.png

Platform compatibility

Compatible platforms have been tested with the default configuration provided by the HelloWorld_IHM03A1 example.

Committer:
nucleosam
Date:
Tue Apr 05 15:18:56 2016 +0000
Revision:
0:00a3c3f5a8f0
Initial version

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nucleosam 0:00a3c3f5a8f0 1 /**
nucleosam 0:00a3c3f5a8f0 2 ******************************************************************************
nucleosam 0:00a3c3f5a8f0 3 * @file component.h
nucleosam 0:00a3c3f5a8f0 4 * @author AST
nucleosam 0:00a3c3f5a8f0 5 * @version V1.0.0
nucleosam 0:00a3c3f5a8f0 6 * @date 1 April 2015
nucleosam 0:00a3c3f5a8f0 7 * @brief Generic header file containing a generic component's definitions
nucleosam 0:00a3c3f5a8f0 8 * and I/O functions.
nucleosam 0:00a3c3f5a8f0 9 ******************************************************************************
nucleosam 0:00a3c3f5a8f0 10 * @attention
nucleosam 0:00a3c3f5a8f0 11 *
nucleosam 0:00a3c3f5a8f0 12 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
nucleosam 0:00a3c3f5a8f0 13 *
nucleosam 0:00a3c3f5a8f0 14 * Redistribution and use in source and binary forms, with or without modification,
nucleosam 0:00a3c3f5a8f0 15 * are permitted provided that the following conditions are met:
nucleosam 0:00a3c3f5a8f0 16 * 1. Redistributions of source code must retain the above copyright notice,
nucleosam 0:00a3c3f5a8f0 17 * this list of conditions and the following disclaimer.
nucleosam 0:00a3c3f5a8f0 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
nucleosam 0:00a3c3f5a8f0 19 * this list of conditions and the following disclaimer in the documentation
nucleosam 0:00a3c3f5a8f0 20 * and/or other materials provided with the distribution.
nucleosam 0:00a3c3f5a8f0 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
nucleosam 0:00a3c3f5a8f0 22 * may be used to endorse or promote products derived from this software
nucleosam 0:00a3c3f5a8f0 23 * without specific prior written permission.
nucleosam 0:00a3c3f5a8f0 24 *
nucleosam 0:00a3c3f5a8f0 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
nucleosam 0:00a3c3f5a8f0 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
nucleosam 0:00a3c3f5a8f0 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
nucleosam 0:00a3c3f5a8f0 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
nucleosam 0:00a3c3f5a8f0 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
nucleosam 0:00a3c3f5a8f0 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
nucleosam 0:00a3c3f5a8f0 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
nucleosam 0:00a3c3f5a8f0 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
nucleosam 0:00a3c3f5a8f0 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
nucleosam 0:00a3c3f5a8f0 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
nucleosam 0:00a3c3f5a8f0 35 *
nucleosam 0:00a3c3f5a8f0 36 ******************************************************************************
nucleosam 0:00a3c3f5a8f0 37 */
nucleosam 0:00a3c3f5a8f0 38
nucleosam 0:00a3c3f5a8f0 39
nucleosam 0:00a3c3f5a8f0 40 /* Define to prevent recursive inclusion -------------------------------------*/
nucleosam 0:00a3c3f5a8f0 41
nucleosam 0:00a3c3f5a8f0 42 #ifndef __COMPONENT_H
nucleosam 0:00a3c3f5a8f0 43 #define __COMPONENT_H
nucleosam 0:00a3c3f5a8f0 44
nucleosam 0:00a3c3f5a8f0 45
nucleosam 0:00a3c3f5a8f0 46 /* Types ---------------------------------------------------------------------*/
nucleosam 0:00a3c3f5a8f0 47
nucleosam 0:00a3c3f5a8f0 48 /**
nucleosam 0:00a3c3f5a8f0 49 * @brief Component's Context structure definition.
nucleosam 0:00a3c3f5a8f0 50 */
nucleosam 0:00a3c3f5a8f0 51 typedef struct
nucleosam 0:00a3c3f5a8f0 52 {
nucleosam 0:00a3c3f5a8f0 53 /* Identity. */
nucleosam 0:00a3c3f5a8f0 54 uint8_t who_am_i;
nucleosam 0:00a3c3f5a8f0 55
nucleosam 0:00a3c3f5a8f0 56 /* ACTION ----------------------------------------------------------------*/
nucleosam 0:00a3c3f5a8f0 57 /* There should be only a unique identifier for each component, which */
nucleosam 0:00a3c3f5a8f0 58 /* should be the "who_am_i" parameter, hence this parameter is optional. */
nucleosam 0:00a3c3f5a8f0 59 /* -----------------------------------------------------------------------*/
nucleosam 0:00a3c3f5a8f0 60 /* Type. */
nucleosam 0:00a3c3f5a8f0 61 uint8_t type;
nucleosam 0:00a3c3f5a8f0 62
nucleosam 0:00a3c3f5a8f0 63 /* Configuration. */
nucleosam 0:00a3c3f5a8f0 64 uint8_t address;
nucleosam 0:00a3c3f5a8f0 65
nucleosam 0:00a3c3f5a8f0 66 /* Pointer to the Data. */
nucleosam 0:00a3c3f5a8f0 67 void *pData;
nucleosam 0:00a3c3f5a8f0 68
nucleosam 0:00a3c3f5a8f0 69 /* Pointer to the Virtual Table. */
nucleosam 0:00a3c3f5a8f0 70 void *pVTable;
nucleosam 0:00a3c3f5a8f0 71
nucleosam 0:00a3c3f5a8f0 72 /* ACTION ----------------------------------------------------------------*/
nucleosam 0:00a3c3f5a8f0 73 /* There should be only a unique virtual table for each component, which */
nucleosam 0:00a3c3f5a8f0 74 /* should be the "pVTable" parameter, hence this parameter is optional. */
nucleosam 0:00a3c3f5a8f0 75 /* -----------------------------------------------------------------------*/
nucleosam 0:00a3c3f5a8f0 76 /* Pointer to the Extended Virtual Table. */
nucleosam 0:00a3c3f5a8f0 77 void *pExtVTable;
nucleosam 0:00a3c3f5a8f0 78 } Handle_t;
nucleosam 0:00a3c3f5a8f0 79
nucleosam 0:00a3c3f5a8f0 80 /**
nucleosam 0:00a3c3f5a8f0 81 * @brief Component's Status enumerator definition.
nucleosam 0:00a3c3f5a8f0 82 */
nucleosam 0:00a3c3f5a8f0 83 typedef enum
nucleosam 0:00a3c3f5a8f0 84 {
nucleosam 0:00a3c3f5a8f0 85 COMPONENT_OK = 0,
nucleosam 0:00a3c3f5a8f0 86 COMPONENT_ERROR,
nucleosam 0:00a3c3f5a8f0 87 COMPONENT_TIMEOUT,
nucleosam 0:00a3c3f5a8f0 88 COMPONENT_NOT_IMPLEMENTED
nucleosam 0:00a3c3f5a8f0 89 } Status_t;
nucleosam 0:00a3c3f5a8f0 90
nucleosam 0:00a3c3f5a8f0 91 #endif /* __COMPONENT_H */
nucleosam 0:00a3c3f5a8f0 92
nucleosam 0:00a3c3f5a8f0 93 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/