So I have a Pololu Qik 2s9v1 dual motor controller, and I’m using it to control two motors via serial from my Raspberry Pi. When the RPi boots, it outputs a few garbage bits over the TX line to the Qik, which trips the CRC-enabled, fixed baud rate Qik into Error mode (red LED turns on). After the RPi finishes booting, I start my program, which first sends a “Read Error Byte” (0x82) command to clear the error. The error successfully clears, the red LED turns off, and I can read the returned error byte. I then send two commands to start both motors 0 and 1 (0x88 0x7F and 0x8C 0x7F). Only motor 1 starts, and motor 0 does nothing! Then, a few seconds later, I send the same exact motor commands using the same exact code, and both motors start. This is repeatable every time I start the system from a powered off state.
I know all of the commands are being sent properly. I’m using CRC for all of my commands, and getting no errors on the Qik when sending them. So it has something to do with the Qik not turning on Motor 0 right after an error has been set/cleared. It does not matter how much time has elapsed between when the error was cleared and when the motor command is sent, could be seconds, could be 20 minutes, and still the same behavior. I also tried reversing the order of the motor commands, so right after reading the error byte, I command motor 1 first: 0x8C 0x7F, and then 0x88 0x7F. Still, motor 1 turns and motor 0 does not.
This is wacky behavior and is driving me nuts. I have a temporary workaround, where I send a very short pulse to “clear” out this weird behavior. I send 0x88 0x01, 0x8C 0x01, 0x88 0x00, 0x8C 0x00. This sends a move command to both motors, and then immediately commands them to stop… so the motors don’t move but still receive a move command. Once I’ve done this, I can successfully control both motors as normal. I tried this method using only 0x88 0x00 and 0x8C 0x00, but it doesn’t work. The weird behavior can only be “cleared” if you use a non-zero speed.
I suspect it may have something to do with the configuration parameter for stopping motors on error? I do not want to turn off this feature though, as my system can physically break if the motors don’t correctly receive a stop command.
Anybody have any idea what the heck is going on? Any help would be greatly appreciated. Thanks!!