Modified Motor Driver Firmware to include Flash + Thermal

Dependencies:   FastPWM3 mbed-dev-STM-lean

Files at this revision

API Documentation at this revision

Comitter:
benkatz
Date:
Wed Aug 30 18:05:37 2017 +0000
Parent:
31:61eb6ae28215
Child:
33:3ab3cce8b44d
Commit message:
Firmware version 1.0.1. ; Added firmware version number to debug stream;

Changed in this revision

FOC/foc.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/FOC/foc.cpp	Wed Aug 30 15:28:40 2017 +0000
+++ b/FOC/foc.cpp	Wed Aug 30 18:05:37 2017 +0000
@@ -130,9 +130,9 @@
             TIM1->CCR1 = (PWM_ARR)*(1.0f-controller->dtc_w);
         }
         else{
-            TIM1->CCR3 = (PWM_ARR>>1)*(1.0f-controller->dtc_u);
-            TIM1->CCR1 = (PWM_ARR>>1)*(1.0f-controller->dtc_v);
-            TIM1->CCR2 =  (PWM_ARR>>1)*(1.0f-controller->dtc_w);
+            TIM1->CCR3 = (PWM_ARR)*(1.0f-controller->dtc_u);
+            TIM1->CCR1 = (PWM_ARR)*(1.0f-controller->dtc_v);
+            TIM1->CCR2 =  (PWM_ARR)*(1.0f-controller->dtc_w);
         }
 
        controller->theta_elec = theta;                                          //For some reason putting this at the front breaks thins
--- a/main.cpp	Wed Aug 30 15:28:40 2017 +0000
+++ b/main.cpp	Wed Aug 30 18:05:37 2017 +0000
@@ -10,6 +10,7 @@
 #define SETUP_MODE 4
 #define ENCODER_MODE 5
 
+#define VERSION_NUM "1.0.1"
 
 
 float __float_reg[64];                                                          // Floats stored in flash
@@ -272,8 +273,8 @@
                 controller.timeout += 1;
                 
                 if(count == 1){
-                     //count = 0;
-                     wait(.001);
+                     count = 0;
+                     //wait(.001);
                     //printf(" Started commutating\n\r");
                      }
                      }
@@ -425,6 +426,7 @@
     pc.printf("\n\r\n\r HobbyKing Cheetah\n\r\n\r");
     wait(.01);
     printf("\n\r Debug Info:\n\r");
+    printf(" Firmware Version: %s\n\r", VERSION_NUM);
     printf(" ADC1 Offset: %d    ADC2 Offset: %d\n\r", controller.adc1_offset, controller.adc2_offset);
     printf(" Position Sensor Electrical Offset:   %.4f\n\r", E_OFFSET);
     printf(" CAN ID:  %d\n\r", CAN_ID);