Library to handle the X_NUCLEO_IHM02A1 Motor Control Expansion Board based on the L6470 component.
Dependencies: X_NUCLEO_COMMON ST_INTERFACES
Dependents: HelloWorld_IHM02A1 ConcorsoFinal HelloWorld_IHM02A1_mbedOS HelloWorld_IHM02A1-Serialinterpreter ... more
Fork of X_NUCLEO_IHM02A1 by
Motor Control Library
Introduction
Library to handle the X-NUCLEO-IHM02A1 Motor Control Expansion Board based on the the L6470 component.
Daisy-Chain Configuration
The two L6470 components mounted on this board are connected in daisy-chain configuration. This board can be stacked up to four times so that the eight L6470 components will be connected two-by-two in daisy-chain configuration.
Concerning the SSEL pin of the SPI communication, each expansion board must be in one of the following configuration:
SB_23resistor connected only: SSEL on pinA2;SB_7resistor connected only: SSEL on pinD2;SB_8resistor connected only: SSEL on pinD10;SB_9resistor connected only: SSEL on pinD5.
Arduino Connector Compatibility Warning
X-NUCLEO-IHM02A1 is Arduino compatible with one exception: instead of using D13 pin to drive the SPI clock, it uses D3 pin, hence the default configuration for this library is with the SPI clock on D3 pin.
To be fully Arduino compatible the following patch is required:
- to remove the
SB34resistor; - to solder the
SB12resistor.
Alternatively, you can route the Nucleo board’s D13 pin directly to the expansion board’s D3 pin with a wire.
In case you patch your expansion board or route the pin, the SPI clock will be driven on D13 pin rather than on D3 pin, and you have also to initialize the sclk PinName variable with D13 rather than D3.
This patch is known to be required, for example, on the following boards: NUCLEO-F103RB, NUCLEO-F302RB, NUCLEO-F411RE, and NUCLEO-F429ZI.
If you use D13 pin for the SPI clock, please be aware that on STM32 Nucleo boards you may not drive the LED, otherwise you will get a conflict: the LED on STM32 Nucleo boards is connected to the D13 pin.
Example Applications
Diff: Components/Common/microstepping_motor.h
- Revision:
- 11:1aca63b2f034
- Parent:
- 1:b78dab6d2c58
- Child:
- 14:e614697ebf34
--- a/Components/Common/microstepping_motor.h Mon Jan 04 16:10:54 2016 +0000
+++ b/Components/Common/microstepping_motor.h Thu Jan 14 10:00:31 2016 +0000
@@ -274,37 +274,6 @@
} sL6470_StatusRegister_t;
/**
- * @brief Motor Parameter Data
- */
-typedef struct
-{
- float motorvoltage; //!< motor supply voltage in V
- float fullstepsperrevolution; //!< min number of steps per revolution for the motor
- float phasecurrent; //!< max motor phase voltage in A
- float phasevoltage; //!< max motor phase voltage in V
- float speed; //!< motor initial speed [step/s]
- float acc; //!< motor acceleration [step/s^2] (comment for infinite acceleration mode)
- float dec; //!< motor deceleration [step/s^2] (comment for infinite deceleration mode)
- float maxspeed; //!< motor maximum speed [step/s]
- float minspeed; //!< motor minimum speed [step/s]
- float fsspd; //!< motor full-step speed threshold [step/s]
- float kvalhold; //!< holding kval [V]
- float kvalrun; //!< constant speed kval [V]
- float kvalacc; //!< acceleration starting kval [V]
- float kvaldec; //!< deceleration starting kval [V]
- float intspeed; //!< intersect speed for bemf compensation curve slope changing [step/s]
- float stslp; //!< start slope [s/step]
- float fnslpacc; //!< acceleration final slope [s/step]
- float fnslpdec; //!< deceleration final slope [s/step]
- uint8_t kterm; //!< thermal compensation factor (range [0, 15])
- float ocdth; //!< ocd threshold [ma] (range [375 ma, 6000 ma])
- float stallth; //!< stall threshold [ma] (range [31.25 ma, 4000 ma])
- uint8_t step_sel; //!< step mode selection
- uint8_t alarmen; //!< alarm conditions enable
- uint16_t config; //!< ic configuration
-} MICROSTEPPING_MOTOR_InitTypeDef;
-
-/**
* @brief Stepper Motor Registers
*/
typedef struct
@@ -350,11 +319,11 @@
* specified exactly in the given way. *
* *
* Example: *
- * DrvStatusTypeDef (*Init)(void *handle, INTERFACE_InitTypeDef *init); *
+ * DrvStatusTypeDef (*Init)(void *handle, void *init); *
* DrvStatusTypeDef (*ReadID)(void *handle, uint8_t *id); *
*------------------------------------------------------------------------*/
/* Generic */
- DrvStatusTypeDef (*Init)(void *handle, MICROSTEPPING_MOTOR_InitTypeDef *init);
+ DrvStatusTypeDef (*Init)(void *handle, void *init);
DrvStatusTypeDef (*ReadID)(void *handle, uint8_t *id);
/* ACTION ----------------------------------------------------------------*
@@ -466,7 +435,6 @@
typedef struct __StepperMotorDriver_HandleTypeDef
{
uint8_t DaisyChainPosition;
- void (*Config)(MICROSTEPPING_MOTOR_InitTypeDef*);
MICROSTEPPING_MOTOR_DrvVTableTypeDef *Command;
} StepperMotorDriverHandle_t;
@@ -476,7 +444,6 @@
typedef struct __StepperMotorBoard_HandleTypeDef
{
uint8_t StackedPosition;
- void (*Config)(MICROSTEPPING_MOTOR_InitTypeDef*);
MICROSTEPPING_MOTOR_EB_DrvVTableTypeDef *Command;
StepperMotorDriverHandle_t *StepperMotorDriverHandle[2];
uint8_t (*Select)(uint8_t);

X-NUCLEO-IHM02A1 Two Axis Stepper Motor Driver