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 ST Expansion SW Team

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_23 resistor connected only: SSEL on pin A2;
  • SB_7 resistor connected only: SSEL on pin D2;
  • SB_8 resistor connected only: SSEL on pin D10;
  • SB_9 resistor connected only: SSEL on pin D5.

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 SB34 resistor;
  • to solder the SB12 resistor.

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

Files at this revision

API Documentation at this revision

Comitter:
Davidroid
Date:
Fri Apr 08 13:02:16 2016 +0000
Parent:
17:4b3dc908724f
Child:
19:b684efb6ba93
Commit message:
+ Some comments updated.

Changed in this revision

Components/Interfaces/StepperMotor_class.h Show annotated file Show diff for this revision Revisions of this file
Components/l6470/l6470_class.h Show annotated file Show diff for this revision Revisions of this file
--- a/Components/Interfaces/StepperMotor_class.h	Thu Apr 07 16:55:51 2016 +0000
+++ b/Components/Interfaces/StepperMotor_class.h	Fri Apr 08 13:02:16 2016 +0000
@@ -45,7 +45,7 @@
 
 /* Includes ------------------------------------------------------------------*/
 
-#include <Component_class.h>
+#include "Component_class.h"
 
 
 /* Classes  ------------------------------------------------------------------*/
--- a/Components/l6470/l6470_class.h	Thu Apr 07 16:55:51 2016 +0000
+++ b/Components/l6470/l6470_class.h	Fri Apr 08 13:02:16 2016 +0000
@@ -194,7 +194,7 @@
         return (unsigned int) L6470_GetStatus();
     }
 
-   /**
+    /**
      * @brief  Getting a parameter.
      * @param  parameter A parameter's register address.
      * @retval The parameter's value.
@@ -310,7 +310,7 @@
         return (direction_t) (L6470_CheckStatusRegisterFlag((eL6470_StatusRegisterFlagId_t) DIR_ID) == 1 ? StepperMotor::FWD : StepperMotor::BWD);
     }
 
-   /**
+    /**
      * @brief   Setting a parameter.
      * @param   parameter A parameter's register address.
      * @param   value The parameter's value.
@@ -655,7 +655,7 @@
         prepared_action = PREPARED_NO_ACTION;
     }
 
-   /**
+    /**
      * @brief  Preparing the command to get a parameter.
      * @param  parameter A parameter's register address.
      * @retval None.
@@ -795,7 +795,7 @@
         prepared_action = PREPARED_GET_DIRECTION;
     }
 
-   /**
+    /**
      * @brief  Preparing the command to set a parameter.
      * @param  parameter A parameter's register address.
      * @param  value The parameter's value.
@@ -1122,13 +1122,13 @@
     }
 
     /**
-      * @brief   Preparing the command to switch to step-clock mode.
-      * @param   direction The direction of rotation.
-      * @retval  None.
-      * @warning Setting the step-clock mode requires an explicit action by the user to first
-      *          disable the power bridge through the SoftHiZ() method.
-      * @note    The command will be sent by issuing "PerformAction()".
-      */
+     * @brief   Preparing the command to switch to step-clock mode.
+     * @param   direction The direction of rotation.
+     * @retval  None.
+     * @warning Setting the step-clock mode requires an explicit action by the user to first
+     *          disable the power bridge through the SoftHiZ() method.
+     * @note    The command will be sent by issuing "PerformAction()".
+     */
     virtual void PrepareStepClock(direction_t direction)
     {
         L6470_PrepareStepClock((eL6470_DirId_t) (direction == StepperMotor::FWD ? L6470_DIR_FWD_ID : L6470_DIR_REV_ID));