1

Dependencies:   X-NUCLEO-IHM05A1

Example code to use L6208 stepper motor driver with nucleo evaluation shield

Explanation: Run a test to determine the maximum speed of the motor at given current and acceleration Run the motor in position mode with microstepping and slow decay

Files at this revision

API Documentation at this revision

Comitter:
nucleosam
Date:
Fri Apr 29 15:58:05 2016 +0000
Parent:
2:c5f455885df7
Child:
4:5e5f1535e3b5
Commit message:
Addition for compatibiltiy with NUCLEO-F302R8

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Apr 29 14:59:26 2016 +0000
+++ b/main.cpp	Fri Apr 29 15:58:05 2016 +0000
@@ -48,8 +48,13 @@
 /* Definitions ---------------------------------------------------------------*/
 #ifdef TARGET_NUCLEO_F334R8
 #define VREFA_PWM_PIN D11
+#define VREFB_PWM_PIN D9
+#elif TARGET_NUCLEO_F302R8
+#define VREFA_PWM_PIN D11
+#define VREFB_PWM_PIN D15 /* HW mandatory patch: bridge manually D9 with D15 */
 #else
 #define VREFA_PWM_PIN D3
+#define VREFB_PWM_PIN D9
 #endif
 
 /* Variables -----------------------------------------------------------------*/
@@ -125,7 +130,7 @@
     
 //----- Initialization 
   /* Initializing Motor Control Component. */
-  motor = new L6208(D2, D8, D7, D4, D5, D6, VREFA_PWM_PIN, D9);
+  motor = new L6208(D2, D8, D7, D4, D5, D6, VREFA_PWM_PIN, VREFB_PWM_PIN);
   if (motor->Init(&initDeviceParameters) != COMPONENT_OK) exit(EXIT_FAILURE);
 
   /* Attaching and enabling an interrupt handler. */