
7. I²C interface
To control the Motoron, you will need to use its I²C interface.
I²C is a specification for a bus that can be used to connect multiple devices. The bus uses two signal
lines:
SDA
is the data line and is used to transmit and receive data, while
SCL
is the clock line is
used to coordinate the flow of data. There are two types of devices that can connect to an I²C bus: a
controller
is a device that initiates transfers of data, generates clock signals, and terminates transfers,
while a
target
is a device that is addressed by a controller. The Motoron acts only as a target.
The Motoron’s SDA and SCL lines are each pulled up to the logic voltage of the Motoron (IOREF) with
on-board 10 kΩ resistors.
I²C voltage levels
The voltages on SDA and SCL must not exceed the Motoron’s logic voltage by more than 0.3 V.
Therefore, if the Motoron is running at 3.3 V, these pins are
not
5 V tolerant. For the signals on these
lines to be read properly by the Motoron, the low level must be less than 30% of the Motoron’s logic
voltage, and the high level must be more than 70% of the Motoron’s logic voltage.
I²C clock speed
The Motoron’s I²C interface supports clock speeds up to 400 kHz. It uses clock stretching to slow down
the transfer of data when bytes are written faster than it can handle, or if a read transfer is started
before data is available.
If your I²C controller does not support clock stretching properly, you can avoid clock stretching by
limiting your write transfers to be at most 31 bytes long and delaying for 1 millisecond after each write
transfer to give the Motoron time to process it.
I²C address
By default, the Motoron uses the 7-bit I²C address
16
. This address is stored in the Motoron’s non-
volatile EEPROM memory, and you can change it by sending a “Set EEPROM device number”
command. If the JMP1 pin is shorted to GND at startup, the Motoron will ignore the address in
EEPROM and use
15
as its I²C address instead. The Motoron determines what I²C address to use
when it starts up, so any changes to the JMP1 pin or the EEPROM will not take effect until the next
reset.
The Motoron also responds to the I²C general call address (0) in addition to its normal address by
default. This allows you to send the same command to multiple Motoron targets simultaneously. The
general call address is write-only; reading bytes from it is not supported. (However, if you send a
command to the general call address that results in a response, you can read the response from an
individual Motoron using its regular address.) You can use the “Set protocol options” command to
Pololu Motoron Motor Controller User’s Guide
© 2001–2022 Pololu Corporation
7. I²C interface
Page 30 of 67