Serial Controlled Motor Driver Hookup Guide
UART Commands
General:
The command parser is built to accept short strings of ascii data, compacted to reduce data transfer size while being easy to handle by standard UART hardware. The general form is a letter indicating which operation to perform followed by a series of numbers and letters, and finally a carriage return and line feed. As a string, an example command would be “M0F50\r\n”.
Return codes:
Overflow ("ovf"): The input buffer is filled (no command should be that long). Send delimiter to clear buffer
Invalid Syntax ("inv"): The first character in the command is not one of the defined prefixes.
Formatting Error ("fmt"): There was something generally wrong with the command, like it had the wrong number of characters or an out of range value was detected.
No Motor ("nom"): The motor's number is past the most downstream peripheral detected.
Commands:
Help:
"H"
or "?"
Prints command reference to serial.
Example:
"H\r\n"
– Drive controller motor B forward at 34%.
Drive motor:
"Mndl"
n = motor number, single or double digits
d = direction, R or F
l = level, 0 to 100
Example:
"M1F34\r\n"
– Drive controller motor B forward at 34%.
"M2R80\r\n"
– Drive peripheral motor A reverse at 80%.
Invert motor polarity:
"MnI"
n = motor number, single or double digits
Example:
"M1I\r\n"
– Invert the polarity of motor 1.
Clear motor inversion:
"MnC"
n = motor number, single or double digits
Example:
"M1C\r\n"
– Set polarity of motor 1 to default.
Enable and disable Drivers
"E"
and "D"
The drivers boot in the disabled state so that other settings can be configured before beginning to drive the motors. Use these commands to enable and disable them.
Example:
"E\r\n"
– Enable all outputs
"D\r\n"
– Disable all outputs
Bridge and un-bridge outputs
"Brr"
and "Nrr"
rr = Motor driver number, 0 is controller, 1-16 is peripheral
This causes a motor driver to start or stop synchronous PWM on both 'A' and 'B' ports. Notice that the input is by board number, not motor number.
Example:
"B0\r\n"
– Bridge controller's outputs
"B2\r\n"
– Bridge the 2nd physical peripheral's outputs (motors 4&5)
"N0\r\n"
– Un-bridge controller's outputs
"N2\r\n"
– Un-bridge the 2nd physical peripheral's outputs (motors 4&5)
Change the Baud Rate
"Un"
n = baud rate selection
This command changes the bitrate of the UART. The serial terminal will need to be reconfigured after this command. The command reports new rate at old baud before changing to the new one.
Rates supported:
1 – 2400
2 – 4800
3 – 9600
4 – 14400
5 – 19200
6 – 38400
7 – 57600
8 – 115200
Examples:
"U3\r\n"
– Set baud rate to 9600
"U8\r\n"
– Set baud rate to 115200
Write Register
"Wrrhh"
rr = two digit hex address
hh = two digit hex data
Example:
"W20FF\r\n"
– Write 0xFF to register 0x20 (MA_DRIVE).
Read Register
"Rrr"
rr = two digit hex address
Example:
"R01\r\n"
– Read address 0x01 (ID), bus will display "A9", ID word of 0xA9