Dual Brushless Motor ESC, 10-62V, up to 50A per motor. Motors ganged or independent, multiple control input methods, cycle-by-cycle current limit, speed mode and torque mode control. Motors tiny to kW. Speed limit and other parameters easily set in firmware. As used in 'The Brushless Brutalist' locomotive - www.jons-workshop.com. See also Model Engineer magazine June-October 2019.

Dependencies:   mbed BufferedSerial Servo PCT2075 FastPWM

Update 17th August 2020 Radio control inputs completed

Files at this revision

API Documentation at this revision

Comitter:
JonFreeman
Date:
Sat Nov 30 18:40:30 2019 +0000
Parent:
14:acaa1add097b
Child:
16:d1e4b9ad3b8b
Commit message:
Software now reads 2 RC inputs, copies to servo outs. About to update mbed library

Changed in this revision

BufferedSerial.lib Show annotated file Show diff for this revision Revisions of this file
F401RE.h 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/BufferedSerial.lib	Sat Nov 30 16:34:58 2019 +0000
+++ b/BufferedSerial.lib	Sat Nov 30 18:40:30 2019 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/sam_grove/code/BufferedSerial/#a0d37088b405
+http://mbed.org/users/sam_grove/code/BufferedSerial/#7e5e866edd3d
--- a/F401RE.h	Sat Nov 30 16:34:58 2019 +0000
+++ b/F401RE.h	Sat Nov 30 18:40:30 2019 +0000
@@ -7,7 +7,7 @@
 
 //  CORRECTION  Comms problem with Touch Screen was insufficient pull-up on STM3_ESC opto. Change R12 from 1k to 470R
 
-//                  Experiment disabling RC inputs to see if clearing serial conflict is possible
+//  Update November 2019 - Radio Control Inputs good.
 
 
 //  Port A -> MotorA, Port B -> MotorB
--- a/main.cpp	Sat Nov 30 16:34:58 2019 +0000
+++ b/main.cpp	Sat Nov 30 18:40:30 2019 +0000
@@ -52,10 +52,10 @@
 */
 
 #if defined (TARGET_NUCLEO_F401RE)  //  CPU in 64 pin LQFP
-#include    "F401RE.h"  //  See here for warnings about Servo InterruptIn not working
+#include    "F401RE.h"
 #endif
 #if defined (TARGET_NUCLEO_F411RE)  //  CPU in 64 pin LQFP
-#include    "F411RE.h"  //  See here for warnings about Servo InterruptIn not working
+#include    "F411RE.h"
 #endif
 #if defined (TARGET_NUCLEO_F446ZE)  //  CPU in 144 pin LQFP
 #include    "F446ZE.h"              //  A thought for future version
@@ -566,9 +566,6 @@
         }                       //  32Hz original setting for loop repeat rate
         loop_flag = false;              //  Clear flag set by ticker interrupt handler. WHEN LAST CHECKED this was about every 32ms
 
-        RC_chan_1.validate_rx();   //  Tests for pulse width and repetition rates being believable signal from radio control
-        RC_chan_2.validate_rx();    //  bool return values not noted here, these 2 lines are pointless.
-
         switch  (mode.rd(COMM_SRC))  {   //  Look to selected source of driving command, act on commands from wherever
             case    0:  //  Invalid
                 break;
@@ -612,6 +609,28 @@
             motors_restore.attach_us    (&restorer, 25);
         }
 #endif
+#define SERVO_OUT_TEST
+#ifdef  SERVO_OUT_TEST
+//    static double  servo_angle = 0.0;  //  For testing servo outs
+        //  servo out test here     December 2018
+
+        //  Tests for pulse width and repetition rates being believable signal from radio control
+        if  (RC_chan_1.validate_rx())   
+            Servo1 = RC_chan_1.normalised();
+        if  (RC_chan_2.validate_rx())   
+            Servo2 = RC_chan_2.normalised();
+//            RC_chan_2.validate_rx();
+
+
+/*
+        servo_angle += 0.01;
+        if  (servo_angle > TWOPI)
+            servo_angle -= TWOPI;
+        Servo1 = ((sin(servo_angle)+1.0) / 2.0);
+        Servo2 = ((cos(servo_angle)+1.0) / 2.0);
+*/
+        //  Yep!    Both servo outs work lovely December 2018
+#endif
 
         if  (flag_8Hz)  {   //  do slower stuff
             flag_8Hz    = false;
@@ -637,17 +656,6 @@
                                     pc.printf   ("Temp %.2f\r\n", tmprt);
                                 }*/
             }
-//#define SERVO_OUT_TEST
-#ifdef  SERVO_OUT_TEST
-    static double  servo_angle = 0.0;  //  For testing servo outs
-            //  servo out test here     December 2018
-            servo_angle += 0.01;
-            if  (servo_angle > TWOPI)
-                servo_angle -= TWOPI;
-            Servo1 = ((sin(servo_angle)+1.0) / 2.0);
-            Servo2 = ((cos(servo_angle)+1.0) / 2.0);
-            //  Yep!    Both servo outs work lovely December 2018
-#endif
         }   //  End of if(flag_8Hz)
     }       //  End of main programme loop
 }