Page 1 of 1

Brushless DC Motor - onVelocityUpdateHandler() not firing

Posted: Wed Oct 31, 2018 9:27 am
by asd
Dear Phidgets Community,

I'm using the Brushless DC Motor Phidget (DCC1100) with a DCM4111_0 Motor.
My problem is that onVelocityUpdateHandler() never fires.
To rule out errors in my own implementation I have also built your example "BLDCMotor_Example.c" but it shows the same behaviour.
I can change velocity perfectly but the update callback is never called.

In the control panel the velocity is reported correctly therefor the hardware is okay.

Any hints?

All the best,
Matthias

Re: Brushless DC Motor - onVelocityUpdateHandler() not firing

Posted: Wed Oct 31, 2018 10:59 am
by fraser
I just ran the c example program from the website and got this on the output.

--------------------

| BLDC motor speed can be controlled by setting its Target Velocity (ie its duty cycle).
| The target velocity can be a number from -1.0 to +1.0, where sign indicates direction of rotation.
| For this example, acceleration has been fixed to 1.0Hz, but can be changed in custom code.

Input a desired velocity between -1.0 and 1.0 and press ENTER
Input Q and press ENTER to quit
.1
[Velocity Event] -> Velocity: 0.001000
[Velocity Event] -> Velocity: 0.099000
.2
[Velocity Event] -> Velocity: 0.199000
[Velocity Event] -> Velocity: 0.199000
.5
[Velocity Event] -> Velocity: 0.417000
[Velocity Event] -> Velocity: 0.499000
[Velocity Event] -> Velocity: 0.499000
[Velocity Event] -> Velocity: 0.499000



It seems like velocity events don't fire until you've set the targetvelocity at least once though. So make sure you've set it, and also make sure you've registered the event. Not sure what else could cause that, especially given it is working on the control panel.

Re: Brushless DC Motor - onVelocityUpdateHandler() not firing

Posted: Wed Oct 31, 2018 12:33 pm
by asd
Thank you for checking Fraser!
Before I eventually rebooted the SBC I got this output (and the motor turning correctly):

--------------------

| BLDC motor speed can be controlled by setting its Target Velocity (ie its duty cycle).
| The target velocity can be a number from -1.0 to +1.0, where sign indicates direction of rotation.
| For this example, acceleration has been fixed to 1.0Hz, but can be changed in custom code.

Input a desired velocity between -1.0 and 1.0 and press ENTER
Input Q and press ENTER to quit
.1
.2
.5
.8
1
.6
.4
.2
.1


Strangely there were 4 brushless motor controllers showing up on VINT port 4 in control panel. Two with and two without channel 0. This should have made me suspicious.

After a reboot of the SBC it is now working as expected with the example code and in my application. Also the control panel is only showing one brushless motor controller.
So our guess is that the issue was caused by some addressing issue but we have no clue what could have caused this.

Anyway this is marked as resolved! Thanks!