Library to handle the X-NUCLEO-IHM06A1 Motor Control Expansion Board based on the STSPIN220 component.

Dependencies:   ST_INTERFACES

Dependents:   HelloWorld_IHM06A1

Fork of X-NUCLEO-IHM06A1 by ST Expansion SW Team

Motor Control Library

Library to handle the X-NUCLEO-IHM06A1 Motor Control Expansion Board based on the STSPIN220 component.

It features the:

  • Read and write of the device parameters; GPIO, PWM and IRQ configuration; microstepping, direction position, speed, acceleration, deceleration and torque controls
  • Automatic full-step switch management; high impedance or hold stop mode selection; enable and standby management
  • Fault interrupts handling (over current, short-circuit and over temperature)
  • Command locking until the device completes movement

The API allows to easily:

  • perform various positioning, moves and stops
  • get/set or monitor the motor positions
  • set the home position and mark another position
  • get/set the minimum and maximum speed
  • get the current speed
  • get/set the acceleration and deceleration
  • get/set the stop mode (hold, hiz or standby)
  • get/set the torque
  • get/set the torque boost
  • get/set the step mode (up to 1/256)

Platform compatibility

Compatible platforms have been tested with the configurations provided by the HelloWorld_IHM06A1 example.

Revision:
1:0c33082063bc
Parent:
0:0ccd34c56c66
--- a/Components/stspin220/stspin220_class.cpp	Thu May 26 15:44:53 2016 +0000
+++ b/Components/stspin220/stspin220_class.cpp	Wed Jul 27 11:56:39 2016 +0000
@@ -3,7 +3,7 @@
   * @file    stspin220_class.cpp
   * @author  IPC Rennes
   * @version V1.0.0
-  * @date    May 26th, 2016
+  * @date    July 27th, 2016
   * @brief   STSPIN220 product related routines
   * @note    (C) COPYRIGHT 2016 STMicroelectronics
   ******************************************************************************
@@ -1000,6 +1000,14 @@
       newSpeed <<= devicePrm.stepModeLatched;
     }
   }
+  else if (devicePrm.stepMode != devicePrm.stepModeLatched)
+  {
+    //torqueBoostEnable has just been disabled
+    Stspin220_Board_UnsetFullStep();
+    devicePrm.stepMode = devicePrm.stepModeLatched;
+    devicePrm.accu <<= devicePrm.stepModeLatched;
+    newSpeed <<= devicePrm.stepModeLatched;
+  }
   
   if (newSpeed < STSPIN220_MIN_STCK_FREQ)
   {