6.1. Serial Settings
The behavior of the Simple Motor Controller’s serial interface is determined by a number of settings, almost all of which can be configured under the Input Settings tab of the Simple Motor Control Center:
The serial settings in the Input Settings tab of the Pololu Simple Motor Control Center.
Serial Mode: The Serial Mode determines which protocols the Simple Motor Controller will accept.
- Binary: In this mode, the controller expects command packets comprised of a series of bytes that conform to the Compact, Pololu, or Mini SSC protocol formats (see Section 6.2 for more information on these protocols). The Binary-protocol commands are more compact than their ASCII-protocol counterparts, so they can be transmitted faster, and they let you send commands addressed to a particular device number, so this mode should be used when multiple devices daisy-chained together on the same serial line. Note that some of the other serial settings (documented below) are only available in this mode.
- ASCII: In this mode, the controller expects command packets comprised of ASCII characters, which makes the commands potentially more friendly to beginners since they look like character strings rather than seemingly random sets of bytes. Also, the ASCII protocol makes it easy to send commands to the Simple Motor Controller from a terminal program. See Section 6.3 for more information on the ASCII protocol.
CRC Mode: When enabled, the Simple Motor Controller requires a cyclic redundancy check (CRC) byte at the end of every Binary Mode serial command packet, which helps ensure that the controller won’t misinterpret noisy commands or act up when presented with a stream of random serial bytes (see Section 6.5 for more information on CRCs). CRC error detection is only available when the Serial Mode is “Binary”; it is disabled when the Serial Mode is “ASCII”. There are three possible CRC modes:
- Disabled: CRC error detection is not enabled, and CRC bytes should not be added to the end of command packets.
- Commands only: The proper CRC byte must be appended to the end of every Binary Mode serial command packet. If the CRC byte is not appended or is incorrect, a Serial CRC Error is generated. Serial responses from the controller do have a CRC byte appended to the end.
- Commands and responses: The proper CRC byte must be appended to the end of every Binary Mode serial command packet. If the CRC byte is not appended or is incorrect, a Serial CRC Error is generated. Additionally, serial responses from the controller have a CRC byte appended to the end, which lets you be more confident that the response was not corrupted by noise.
Device Number: This is the device number (0–127) that is used to address this device in Pololu Protocol and Mini SSC protocol commands. This setting is useful when using the Simple Motor Controller with other devices in a daisy-chained configuration (see Section 6.6).
Baud Rate: This setting only applies to TTL serial communication via the RX and TX pins; it is not relevant for serial communication over the virtual COM port. Auto-detect baud rate is only available when the Serial Mode is “Binary”; Fixed baud rate is automatically selected when the Serial Mode is “ASCII”.
- Auto-detect baud rate: In this mode, the Simple Motor Controller automatically detects the baud rate from the first 0xAA (170) baud rate indication byte it receives on the RX line. Every time the controller is powered up or reset, and every time the “Apply settings” button is pressed in the Simple Motor Control Center, you will need to send a baud rate indication byte before the Simple Motor Controller will accept TTL serial commands. Once you send the baud rate indication byte, you can check the Status Tab of the Simple Motor Control Center to see what baud rate the controller detected. The controller can automatically detect baud rates from 1200 bps to 500 kbps.
- Fixed baud rate: In this mode, the Simple Motor Controller will only respond to TTL serial signals transmitted at the configured fixed baud rate (in units of bits per second, or bps). The fixed baud rate can be set from 1099 bps to 2 Mbps, but the Simple Motor Controller will not be able to keep up with a constant stream of commands at baud rates over 500 kbps (if you send commands to the controller faster than it can process them, the receive buffer will eventually fill up, data will be lost, and a Serial RX Overrun Error will be generated).
Delay TTL serial responses: Enabling this feature causes the Simple Motor Controller to wait for approximately 1 ms before transmitting a TTL serial response. This is useful when interfacing with devices like the Basic Stamp that use half-duplex UARTs and need time to switch from transmit mode to receive mode. When this feature is disabled, transmission of a response packet begins as soon as possible after the last byte of a command packet is received (if that command packet generates a response).
Command Timeout: This setting lets you configure the Simple Motor Controller to shut down the motor if too much time elapses between received commands, which could happen if your serial control source gets disconnected or loses power. It is located under the Advanced Tab of the Simple Motor Control Center. See Section 5.3 for more information on this parameter.