Connections, Sending commands, Sample code – Pololu Simple User Manual

Page 87: Section 6.7

Advertising
background image

Daisy chaining serial devices that have a TXIN input.

For additional connection diagrams and more information about the TXIN pin, see

Section 4.2

.

Connections

Connect the TX line of your controlling device to the RX lines of all of the slave devices. Sent commands will then
be received by all slaves.

When receiving serial responses from multiple slaves, each device should only transmit when requested, so if each
device is addressed separately, multiple devices will not transmit simultaneously. However, the TX outputs are driven
high when not sending data, so they cannot simply be wired together. Instead, you can use an AND gate, as shown in
the diagram, to combine the signals, or you can use the TXIN pin as described above if the device has one. Note that
in many cases receiving responses is not necessary, and the TX lines can be left unconnected.

Whenever connecting devices, remember to wire the grounds together, and ensure that each device
is properly powered. Unpowered devices with a TTL serial port can turn on or partially on, drawing
power from the serial line, which means that extra care must be taken when turning power off and on
to reset the devices.

Sending commands

The Pololu Protocol or Mini SSC protocol should be used when multiple Pololu devices are receiving the same serial
data. This allows the devices to be individually addressed, and it allows responses to be sent without collisions.

If the devices are configured to detect the baud rate, then when you issue your first Pololu Protocol command, the
devices can automatically detect the baud from the initial 0xAA byte.

Some older Pololu devices use 0x80 as an initial command byte. If you want to chain these together with devices
expecting 0xAA, you should first transmit the byte 0x80 so that these devices can automatically detect the baud rate,
and only then should you send the byte 0xAA so that the Simple Motor Controller can detect the baud rate. Once all
devices have detected the baud rate, Pololu devices that expect a leading command byte of 0x80 will ignore command
packets that start with 0xAA, and Pololu devices that use the Pololu Protocol, such as the Simple Motor Controller,
will ignore command packets that start with 0x80.

6.7. Sample Code

This section contains example code for controlling the Simple Motor Controller over TTL serial or over the USB
virtual serial port. These examples use the Compact Protocol without CRC error detection, so they require the Simple
Motor Controller to be in Binary serial mode with the CRC Mode set to Disabled. For information about the serial
commands used by this sample code, refer to

Section 6.2.1

.

Pololu Simple Motor Controller User's Guide

© 2001–2014 Pololu Corporation

6. Using the Serial Interface

Page 87 of 101

Advertising