MotorController / PWM issue (tangent of Pete's Win8 Robot thread)

This is a tangent of the issue we are talking about in Pete’s Win8 Robot thread here: http://www.tinyclr.com/forum/topic?id=8680

The issue:

Since the 8/24 RC code (and possibly the drop before that), I’m having the issue that if I use MoveMotor, MoveMotorRamp or MoveMotorNB and send it any POSITIVE value, the controller becomes mostly unresponsive to other commands. I find that in certain cases, if I send a POSITIVE after the NEGATIVE, the motor will either stop or reverse itself. If I send a ZERO after the NEGATIVE value, assuming the previous NEGATIVE value wasn’t -100, the channel maxes itself out and then becomes completely unresponsive.

Also, I haven’t had this run into it on MoveMotor, but on MoveMotorRamp and MoveMotorRampNB, if I send it a -100 or any other NEGATIVE number followed by a zero, I get an unhandled exception in GTM.GHIElectronics.MotorControllerL298.DLL.

I haven’t grabbed the source for the DLL to step into it yet, will try to do that at some point today.

The hardware:
I haven’t tried this on a Hydra or Spider yet, but this is definitely broken on my Cerberus.

Mainboard - Cerberus


DeviceInfo:
  HAL build info: 4.2.0.0, Copyright Oberon microsystems, Inc.
  OEM Product codes (vendor, model, SKU): 255, 0, 65535
  Serial Numbers (module, system):
    FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
    FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
  Solution Build Info: 4.2.3.0, Copyright (C) GHI Electronics, LLC
  AppDomains:
    default, id=1
  Assemblies:
    mscorlib,4.2.0.0
    Microsoft.SPOT.Native,4.2.0.0
    Microsoft.SPOT.Hardware,4.2.0.0
    Microsoft.SPOT.Graphics,4.2.0.0
    Microsoft.SPOT.TinyCore,4.2.0.0
    Microsoft.SPOT.Hardware.SerialPort,4.2.0.0
    Microsoft.SPOT.IO,4.2.0.0
    System.IO,4.2.0.0
    Microsoft.SPOT.Hardware.OneWire,4.2.0.0
    Microsoft.SPOT.Hardware.Usb,4.2.0.0
    Microsoft.SPOT.Hardware.PWM,4.2.0.1
    Microsoft.SPOT.Net,4.2.0.0
    System,4.2.0.0
    Gadgeteer,2.42.0.0
    Microsoft.SPOT.Net.Security,4.2.0.0
    GTM.GHIElectronics.Extender,4.1.5.0
    GHIElectronics.Gadgeteer.FEZCerberus,1.0.6.0
    GTM.GHIElectronics.IRReceiver,1.0.0.0
    System.Http,4.2.0.0
    GHI.OSHW.Hardware,4.2.3.0
    ServoTest,1.0.0.0
    System.Net.Security,4.2.0.0
    GTM.GHIElectronics.MotorControllerL298,1.0.3.0
    Microsoft.SPOT.Touch,4.2.0.0

Modules:
GHI IRreceiver (socket 2)
GHI motorControllerL298 (socket 4)
GHI UsbClientDP (socket 8)

Code:

Deployment assemblies:


Create TS.

 Loading start at 805b870, end 808448c

   Assembly: mscorlib (4.2.0.0)     Assembly: Microsoft.SPOT.Native (4.2.0.0)     Assembly: Microsoft.SPOT.Hardware (4.2.0.0)  
   Assembly: Microsoft.SPOT.Graphics (4.2.0.0)     Assembly: Microsoft.SPOT.TinyCore (4.2.0.0)  
   Assembly: Microsoft.SPOT.Hardware.SerialPort (4.2.0.0)     Assembly: Microsoft.SPOT.IO (4.2.0.0)  
   Assembly: System.IO (4.2.0.0)     Assembly: Microsoft.SPOT.Hardware.OneWire (4.2.0.0)  
   Assembly: Microsoft.SPOT.Hardware.Usb (4.2.0.0)     Assembly: Microsoft.SPOT.Hardware.PWM (4.2.0.1)  
   Assembly: Microsoft.SPOT.Net (4.2.0.0)     Assembly: System (4.2.0.0)  Loading Deployment Assemblies.

Attaching deployed file.
   Assembly: Gadgeteer (2.42.0.0)  Attaching deployed file.
   Assembly: Microsoft.SPOT.Net.Security (4.2.0.0)  Attaching deployed file.
   Assembly: GTM.GHIElectronics.Extender (4.1.5.0)  Attaching deployed file.
   Assembly: GHIElectronics.Gadgeteer.FEZCerberus (1.0.6.0)  Attaching deployed file.
   Assembly: GTM.GHIElectronics.IRReceiver (1.0.0.0)  Attaching deployed file.
   Assembly: System.Http (4.2.0.0)  Attaching deployed file.
   Assembly: GHI.OSHW.Hardware (4.2.3.0)  Attaching deployed file.
   Assembly: GTM.GHIElectronics.UsbClientDP (1.0.0.0)  Attaching deployed file.
   Assembly: ServoTest (1.0.0.0)  Attaching deployed file.
   Assembly: System.Net.Security (4.2.0.0)  Attaching deployed file.
   Assembly: GTM.GHIElectronics.MotorControllerL298 (1.0.3.0)  Attaching deployed file.
   Assembly: Microsoft.SPOT.Touch (4.2.0.0)  Resolving.

Motor code:


void irreceiver_IREvent(object sender, IR_Receiver.IREventArgs e)
        {
            switch (e.Button)
            {
                case 32: //forward -- CH_UP
                    Debug.Print("forward");
                    motorControllerL298.MoveMotor(MotorControllerL298.Motor.Motor1, -75);
                    motorControllerL298.MoveMotor(MotorControllerL298.Motor.Motor2, -75);
                    break;
                case 33: //backward -- CH_DN
                    Debug.Print("backward");                   
                    motorControllerL298.MoveMotor(MotorControllerL298.Motor.Motor1, 75);
                    motorControllerL298.MoveMotor(MotorControllerL298.Motor.Motor2, 75); 
                    break;
                case 13: //stop -- MUTE
                    Debug.Print("Stop");
                    motorControllerL298.MoveMotor(MotorControllerL298.Motor.Motor1, 0);
                    motorControllerL298.MoveMotor(MotorControllerL298.Motor.Motor2, 0);
                    break;
                case 17: //left -- VOL_LFT
                    position = Left;
                    break;
                case 16: //right -- VOL_RIGHT
                    position = Right;
                    break;
                case 11: //center -- AV/TV
                    position = Center;
                    break;
                default:
                    break;
            }
        }

Steve, as promised, I finally got round to seeing what I could use to fix this problem. It’s no solution but works on by h/w of a Cerbuino Bee and the L298 controller. THe work around is to issue a single command to each motor setting it to 100 before issuing any other command, lik so:


        private void allOn()
        {
            Motor.MoveMotor(MotorControllerL298.Motor.Motor1, 100);
            Motor.MoveMotor(MotorControllerL298.Motor.Motor2, 100);
        }

Now my motors respond to their commands just fine.

1 Like