ST / X_NUCLEO_IHM01A1

Dependencies:   X_NUCLEO_COMMON ST_INTERFACES

Dependents:   Stepper_Matlab_Control SunTracker_BLE Stepper_Matlab_Control MemsMotorControl ... more

Fork of X_NUCLEO_IHM01A1 by ST Expansion SW Team

Motor Control Library

Introduction

Library to handle the X-NUCLEO-IHM01A1 Motor Control Expansion Board based on the the L6474 component.

Daisy-Chain Configuration

This board can be stacked up to three times so that the L6474 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/Davidroid/daisychaintable.png

Platform compatibility

  • NUCLEO boards have been tested with the default configuration provided by the HelloWorld_IHM01A1 example.
  • LPCXpresso11U68 board has been tested with the following patch:
    • to connect with a wire from the LPCX’s D4 pin to the IHM01A1’s D9 pin;
    • to initialize the pwm PinName variable with D4 rather than D9.
  • FRDM-K64F board has been tested with the following patch:
    • to connect with a wire from the FRDM’s D4 pin to the IHM01A1’s D8 pin;
    • to initialize the standby_reset PinName variable with D4 rather than D8.

Example Applications

Revision:
20:a8e81b65f0af
Parent:
18:2d6ab2b93685
Child:
21:83138e702683
diff -r 5f0b00a1e38d -r a8e81b65f0af Components/l6474/l6474_class.h
--- a/Components/l6474/l6474_class.h	Wed Jan 13 14:59:19 2016 +0000
+++ b/Components/l6474/l6474_class.h	Fri Jan 15 16:42:39 2016 +0000
@@ -1,7 +1,7 @@
 /**
  ******************************************************************************
  * @file    l6474_class.h
- * @author  Davide Aliprandi, STMicrolectronics
+ * @author  Davide Aliprandi, STMicroelectronics
  * @version V1.0.0
  * @date    October 14th, 2015
  * @brief   This file contains the class of an L6474 Motor Control component.
@@ -827,20 +827,6 @@
     }
 
     /**
-     * @brief  Setting the frequency of PWM.
-     *         The frequency controls directly the speed of the device.
-     * @param  newFreq the frequency of PWM.
-     * @retval None.
-     */
-    void L6474_PwmSetFreq(uint16_t newFreq)
-    {
-        double period = 1.0f / newFreq;
-        pwm.period(period);
-        pwm.write(0.5f);
-        ticker.attach(this, &L6474::L6474_StepClockHandler, period);
-    }
-
-    /**
      * @brief  Initialising the PWM.
      * @param  None.
      * @retval None.
@@ -848,6 +834,25 @@
     void L6474_PwmInit(void) {}
 
     /**
+     * @brief  Setting the frequency of PWM.
+     *         The frequency controls directly the speed of the device.
+     * @param  frequency the frequency of PWM.
+     * @retval None.
+     */
+    void L6474_PwmSetFreq(uint16_t frequency)
+    {
+        /* Computing the period of PWM. */
+        double period = 1.0f / frequency;
+        
+        /* Setting the period and the duty-cycle of PWM. */
+        pwm.period(period);
+        pwm.write(0.5f);
+
+        /* Setting a callback with the same period of PWM's, to update the state machine. */
+        ticker.attach(this, &L6474::L6474_StepClockHandler, period);
+    }
+
+    /**
      * @brief  Stopping the PWM.
      * @param  None.
      * @retval None.