01-09-2010 08:25 PM
I'm using two DIO lines from a USB-8451 to control a stepper motor driver which takes step and direction inputs.
I'd been successful in getting the motor to move as expected using my software, and then I went home and accidentally left the device & motor/driver powered up. My (C++) program was not running, and it closes the NI DLL properly as far as I can tell (I can run the program multiple times without issues). When I arrived back at the lab the following day, I discovered to my horror that the motor was turning, all on its own! Not at a constant speed, but with motion that appeared to be somewhat periodic. Powering off and back on the motor driver did not stop this behaviour (of course it didn't move while the driver was powered *off*). Disconnecting the USB cable between computer and USB-8451 did stop the motor, but again when I reconnected the USB cable the strange motion continued. Rebooting my PC stopped this odd behaviour. However, when connecting the USB cable after the reboot I do still seem to get a few pulses out of the DIO lines, since the motor turns a bit and then stops.
I did some research in the user manuals and have discovered the following deficiency in my setup: the motor driver expects 5V TTL applied to its inputs, whereas I did not have a 5V pull-up resistor connected to the outputs from the USB-8451. I plan to try this tomorrow (I also plan to scope the outputs, hoping I may glean some info from that), but I still find myself perplexed: if the output of the USB-8451 was configured only as 3.3V push-pull, then shouldn't I have had trouble getting it to trigger the motor drive's 5V TTL inputs at *all*? Let alone when I wasn't telling it to send out any signals...
The fact that rebooting my PC stopped this weird behaviour is troubling, because if I can't reproduce the problem how can I know that it has been resolved? I do have a second USB-8451 so I can try swapping it in to compare, but again that would only prove useful if I can duplicate this issue.
Any feedback or ideas would be welcome, especially from anyone who may have had a similar experience or might have some explanation for my observations.
thanks,
Shi.
ps - one idea that occurs to me is that if the 3.3V push-pull output happened to be left high, perhaps it was floating somewhere around the threshold between 5V TTL logic low and high. Not being sufficiently familiar with this branch of the electronics world, I'm not really sure if the above theory makes any sense. Even so, that still doesn't seem to explain why unplugging and replugging the USB-8451 did not stop the behaviour - only rebooting the PC did (especially since the DIO lines are supposed to be in input mode at powerup).
01-11-2010 04:18 PM
Hi Shi,
It is not a good idea to let something read from a digital output that is not actively being controlled. Your digital lines on the USB 8451 were in an indeterminate state and most likely influenced by something in your surroundings. I don’t know why your motor would appear to have periodic behavior or move a little when you plug in the device. If you want the device to export a known signal all the time you can connect the digital lines like page 6 in your user manual (this also include the 5V pull up you mention). Also, both 3.3V and 5V lie within the acceptable voltage ranges for TTL so your motor most likely will have no trouble with a 3.3V signal. Hope this helps, let me know if you still have strange behavior after you make your connections externally.
01-11-2010
04:19 PM
- last edited on
08-19-2025
08:59 AM
by
Content Cleaner
In case you don't have it you can find it here.
01-11-2010 09:15 PM
Thanks for your reply, Matt.
It turned out there were a few problems:
1. The ground of the motor controller and USB-8451 needed to be tied together - as soon as I effectively did this when we scoped the signals by attaching the probe's ground to the signal ground, the problem (reproducible by plugging & unplugging the USB-8451 from the PC) went away.
2. The motor controller's threshold voltage is 3.5V, so that might account for some of the unusual behaviour we'd observed (e.g. motor not always changing direction as expected). I was perplexed after connecting the pull-up resistors to 5V as indicated in the user manual when I still saw 3.3V on the output lines, until eventually I took a look in the software manual and noticed that there is a configuration command to specify which output mode to use. The user manual doesn't mention anything about a software command being needed in addition to connecting the pull-up resistors for 5V operation, and I think it should be revised to mention this.
My code was configuring the digital output lines for 3.3V push-pull operation, so all I needed to do was change the call to request open collector mode.
Happy times.