MotorDriverL298 NetMF 4.3 issues?

Hello,
I was trying to work with the MotorControllerL298/MotorControllerL298 module in NetMF4.3. Having used the module in NetMF 4.2, couple of methods I could not find was
MoveMotor and MoveMotorRamp [and the corresponding blocking/non-blocking versions].

It seems the methods may have been replaced by the motoControllerL298.SetSpeed(motor, speed, ramp-time) method. I tried a few simple examples and I could not figure out how the SetSpeed method really works. I am sorry if there are any documentation available, I could find only examples specific to NetMF 4.2.

I attached the motorController module in the socket 11 of my Spider and my example code is as follows. All I am doing is observing the behavior of the motor when I execute each commented line one after the other.


void ProgramStarted()
        {
            motorDriverL298.DebugPrintEnabled = true;
            Thread test = new Thread(motorDriverTest);
            test.Start();
        }
        private void motorDriverTest()
        {
            Debug.Print("1");
            motorDriverL298.SetSpeed(MotorDriverL298.Motor.Motor1, 1.0);
       //     motorDriverL298.SetSpeed(MotorDriverL298.Motor.Motor1, 0.99);
          //  motorDriverL298.SetSpeed(MotorDriverL298.Motor.Motor2, 0.9, 20); 
         //   motorDriverL298.SetSpeed(MotorDriverL298.Motor.Motor1, 0.5);
         //   motorDriverL298.SetSpeed(MotorDriverL298.Motor.Motor2, 0, 20);
         //   motorDriverL298.SetSpeed(MotorDriverL298.Motor.Motor1, -0.2);
         //   motorDriverL298.SetSpeed(MotorDriverL298.Motor.Motor2, -0.4, 10);
                       Debug.Print("2");

        }

Behavior:
[em]motorDriverL298.SetSpeed(MotorDriverL298.Motor.Motor1, 1.0);[/em] : Line is executed but motor does not move. I would have expected the motor to move with maximum speed.

[em]motorDriverL298.SetSpeed(MotorDriverL298.Motor.Motor1, 0.99);[/em]: As expected, motor moves in a fixed speed.

[em]motorDriverL298.SetSpeed(MotorDriverL298.Motor.Motor2, 0.9, 20); [/em] : Code blocks at this line indefinitely and motor does not move[see attachment 1]. I would have expected the motor to slowly increase to 0.9 times its maximum speed in 20 milli seconds.

[em]motorDriverL298.SetSpeed(MotorDriverL298.Motor.Motor1, 0.5);[/em] As expected, motor moves in a slower speed.

[em]motorDriverL298.SetSpeed(MotorDriverL298.Motor.Motor2, 0, 20);[/em] Nothing happens [as expected]. But Ramp delay does not block the execution.

[em] motorDriverL298.SetSpeed(MotorDriverL298.Motor.Motor1, -0.2); [/em] throws exception [attachment 2] I would have expected the motor to move in the opposite direction at a slower speed.

[em]motorDriverL298.SetSpeed(MotorDriverL298.Motor.Motor2, -0.4, 10);[/em] Blocks the code at this line indefinitely and motor does not move.I would have expected the motor to move in the opposite direction reaching 0.4 times maximum speed in 10 milliseconds.

My question:

  1. Is this expected behavior? I do not seem to able to give negative value in speed for rotation in opposite direction. The range of speed does not speed to be +1.0 to -1.0. Also when I gave a speed of 1.0,nothing happened.

2 The SetSpeed seems to be non-blocking by default. So are the blocking methods taken away?

  1. For the ramp speed increase, even when the delay is 20 msec, the code blocks and motor stays still. Could that be a bug?

I am sorry to have to ask this basic question here. It may have been easier if I could just look at the code for MotorControllerL298.SetSpeed(), but I am still a beginner in Gadgeteering and do not want to do that.

Thanks for your time.

@ deepakakkil - You are using a beta version of the firmware. You can not expect a full set of documentation and examples to be available. I believe there are some issues with the 4.3 version of the driver for this module.

I suggest you install the 4.2 firmware.

@ deepakakkil - As Mike said, there are indeed some issues with this module in 4.3. I have corrected them for the next release. That said, two things to note. Some motors do not respond unless the speed is above 40% in either direction (some may be higher or lower than that, too). You will also want to ramp the motors over a longer period of time. I’ve added an exception to clarify that. Try a few hundred milliseconds. (If you need an instantaneous change, you can use the non-ramping overload.)

Thanks Mike and John.
Hopefully the problems I faced would be rectified in the next version.
Meanwhile, I guess I will downgrade to NETMF4.2 as I need the module in the current project I am doing.

Thanks for your help!

Hmm, tried with newest SDK and the name obviously changed and the methods are not working as before, but the docs are not updated, can someone assist.

I could not even find the sourcecode for the module, anyone?

Not there, its called motorcontroller…

Seems to be here.

http://gadgeteer.codeplex.com/SourceControl/latest#Main/Modules/GHIElectronics/MotorControllerL298/Software/MotorControllerL298/MotorControllerL298_43/MotorControllerL298_43.cs

I think.

Last update from GHI is january 2014 by Aron…??? :think:

As it was called motorcontrollerl298 in this version, I think it is wrong.

It seems to be called motorcontrollerl298in the 4.2 version also. Not sure where the motorcontroller came from.

Sorry I can’t help more.

Possibly, The confusion is because the L298 module used to be called as MicroControllerL298 in NETMF 4.2 and In the 4.3 Version [Atleast in the Beta I tried], It was renamed to MicroDriverL298 for some reason.
I will also try out the new version for this module. Thanks

I am not sure if we totally understand the problem. Its not just the mismatch in the name.

The NETMF 4.3 version of MotrControllerL298/MotorDriverL298 have methods like SetSpeed () replacing the NETMF4.2 counterparts like MoveMotor() and MovemotorRamp()

The source code for the MotrControllerL298/MotorDriverL298 (for version 4.3) currently available at

http://gadgeteer.codeplex.com/SourceControl/latest#Main/Modules/GHIElectronics/MotorControllerL298/Software/MotorControllerL298/MotorControllerL298_43/MotorControllerL298_43.cs

DOES NOT have definitions of SetSpeed() and rather has MoveMotor() and MoveMotorRamp() methods. So most likely, the source code is not updated.

With the newest SDK, dragging the motor-thing onto your design you get a motordriver in your code NOT a motorcontroller which you got earlier.

Which means that at least the name has changed. The source for my program now had a search and replace and now it works.

Thanks for all contributions :wink:

@ Jeff - Developer resources not updated.

The name was indeed changed to MotorDriverL298 in the 4.3 SDKs. Many other names were changed to reflect the actual product names.

We have not pushed the latest code to Gadgeteer CodePlex. It can be found at https://bitbucket.org/ghi_elect/gadgeteer instead.

I guess it might be a part of the plan to make it easier for the community to participate?

Thanks indeed, everythings falls into place :slight_smile: