Hello. I’ve been working on this problem for a couple weeks now and I just don’t understand what’s going on.
I’m trying to control the Low-Voltage Dual Serial Motor Controller with a picaxe 40X1 chip. I believe I understand the protocol for controlling it, because I’m able to control it using a Basic Stamp 2 microcontroller.
I have verified that I am outputting the same commands with my picaxe that I output with my Basic Stamp 2. But when I send a command with my picaxe, the motor controller does nothing.
But…If I send one command to the motor controller using the Basic Stamp 2 first, the motor controller responds to all my picaxe commands afterwards. Does anyone have any idea what’s going on? Thanks.
It sounds like your Picaxe might be outputting some initial signal on its serial line that is confusing the motor controller’s automatic baud detection, which would prevent it from being able to detect your commands. Do you have access to an oscilloscope so you can see what’s going on when your controller starts up? If you use your picaxe to reset the motor controller after the picaxe’s serial module is initialized, does the problem go away?
I have tried resetting the motor controller before sending a command to it with my picaxe, and that did not fix the problem. I do have a logic analyzer and I will try to see if the picaxe outputs anything on startup. (Although I would have thought that resetting the motor controller before sending a command would have taken care of that.)
I have looked at the command outputs of both microcontrollers with my logic analyzer. As far as I can tell, they send the same series of 1’s and 0’s. Do you know if the motor controller takes the first message and assumes that the rest of the messages will be the same baud rate? I suppose I can figure that out by sending two different commands at different baud rates sequentially. I’m thinking that maybe the picaxe messages are good enough to be recognized when the baud rate is known, but not good enough for the motor controller to determine what baud rate they are sending at. But like I said, I’m not sure how the motor controllers work in terms of determining the baud rate.
Did you make sure your picaxe’s UART was initialized and enabled before you reset the controller? It’s possible that the act of enabling the UART is responsible for generating noise that is confusing the motor controller. What happens if you reset the motor controller after you send the first serial command?
The first 0x80 byte you send teaches the motor controller the baud rate, and it will use that baud rate until it is reset. If a byte other than 0x80 is sent first or if there is noise on the line, the controller will potentially measure the wrong baud rate and will then be unresponsive to your commands.
Looks like you were right. I sent a “dummy command” to the motor controller first. Then, I reset it. After that, it responded to the rest of the commands sent by the my picaxe microcontroller. Thanks for your help!
Great! I’m glad to hear you got it working.