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
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:
Platform compatibility
Compatible platforms have been tested with the default configuration provided by the HelloWorld_IHM03A1 example.
Diff: Components/powerstep01/powerstep01_class.cpp
- Revision:
- 1:8ce2a5d6fbf8
- Parent:
- 0:00a3c3f5a8f0
- Child:
- 2:06f3a5360a45
--- a/Components/powerstep01/powerstep01_class.cpp Tue Apr 05 15:18:56 2016 +0000
+++ b/Components/powerstep01/powerstep01_class.cpp Thu Apr 07 16:11:47 2016 +0000
@@ -41,11 +41,8 @@
/* Definitions ---------------------------------------------------------------*/
-/* Error while initialising the SPI. */
-#define POWERSTEP01_ERROR_0 (0x8000)
-
/* Error of bad SPI transaction. */
-#define POWERSTEP01_ERROR_1 (0x8001)
+#define POWERSTEP01_ERROR_1 (POWERSTEP01_ERROR_BASE|0x0001)
/* Variables ----------------------------------------------------------------*/
@@ -453,7 +450,7 @@
* @brief Returns the FW version of the library
* @retval POWERSTEP01_FW_VERSION
**********************************************************/
-uint8_t POWERSTEP01::Powerstep01_GetFwVersion(void)
+uint32_t POWERSTEP01::Powerstep01_GetFwVersion(void)
{
return (POWERSTEP01_FW_VERSION);
}
@@ -512,7 +509,7 @@
* as specified in enum motorStepMode_t
* @retval None
**********************************************************/
-void POWERSTEP01::Powerstep01_SelectStepMode(motorStepMode_t stepMode)
+bool POWERSTEP01::Powerstep01_SelectStepMode(motorStepMode_t stepMode)
{
uint8_t stepModeRegister;
powerstep01_StepSel_t powerstep01StepMode;
@@ -541,9 +538,10 @@
powerstep01StepMode = POWERSTEP01_STEP_SEL_1_64;
break;
case STEP_MODE_1_128:
+ powerstep01StepMode = POWERSTEP01_STEP_SEL_1_128;
+ break;
default:
- powerstep01StepMode = POWERSTEP01_STEP_SEL_1_128;
- break;
+ return false;
}
/* Set the powerstep01 in HiZ state */
@@ -558,6 +556,7 @@
/* Reset abs pos register */
Powerstep01_CmdResetPos();
+ return true;
}
/**********************************************************

X-NUCLEO-IHM03A1 High Power Stepper Motor Driver