Comm Interfaces

CAN Bus

CAN Bus is the primary interface for communicating with Tinymovr. The physical and data link interface adheres to the CAN 2.0 standard. Tinymovr exposes to CAN all communication endpoints defined in firmware.

Data rate

By default, the CAN baud rate is set to 1Mbit/s. This is customizable both through CAN as well as through UART. See can_config. Possible values are 125kbit/s, 250kbit/s, 500kbit/s and 1Mbit/s.

Addressing

The 11-bit identifier of the CAN frame is used for device and endpoint identification. The 6 least significant bits of the identifier are reserved for endpoints, and the 5 most significant bits for device identification. This suggests that the total number of addressable endpoints in a single device are 64, and the total number of addressable devices are 32.

API

For a detailed description, please see API Reference.

UART

As an alternative to CAN Bus, Tinymovr offers UART-based (serial) communication. The protocol is much simpler than can and mainly designed for troubleshooting or testing in the absence of CAN hardware.

Warning

The UART port on Tinymovr is NOT 5V tolerant. Applying 5V voltage will immediately damage the onboard PAC5527 controller. Please use only 3.3V for UART communication.

Protocol Description

The UART port is TTL at 115200 baud. A regular FTDI-style USB to UART adapter should be sufficient.

UART communication is based on a simple human-readable protocole dubbed the “dot protocol”, because the dot is the command starting character. The protocol is response-only, meaning that Tinymovr will only respond to commands initiated by the client, it will never initiate a transmission on it’s own.

The command template is as follows:

.Cxxxx

The command begins with a dot. The next single character identifies the command. The characters following the second one are optional values to pass to write commands. Read commands only include the dot and command character. The command is finalized with a newline character (n, not shown above).

For instance, to get the current position estimate:

command: .p
response: 1000

To set the velocity estimate in encoder ticks:

command: .V10000
(no response)

The values passed or returned are always integers scaled by the appropriate factor (see command reference below).

Note that command characters are case-sensitive, i.e. capitals and small represent different commands. As a convention, capital letters are setters and small are getters, where applicable.

Command Reference

.Z

Transition to idle state.

Example

.Z
0

.Q

Transition to calibration state.

Example

.Q
0

.A

Transition to close loop control state.

Example

.A
0

.e

Get the error code.

Example

.e
0

.p

Get position estimate (ticks).

Example

.p
1000

.v

Get velocity estimate (ticks/s).

Example

.v
-200

.i

Get current (Iq) estimate (mA).

Example

.i
2000

.P

Get/set position setpoint (ticks).

Example

.P
1000
.P1000

.V

Get/set velocity setpoint (ticks/s).

Example

.V
-10000
.V-10000

.I

Get/set current (Iq) setpoint (mA).

Example

.I
1000
.I1000

.W

Get/set current (Iq) limit (mA).

Example

.W
10000
.W15000

.Y

Get/set position gain.

Example

.Y
25
.Y25

.F

Get/set velocity gain (x0.000001).

Example

.F
20
.F20

.G

Get/set velocity integrator gain (x0.001).

Note that high values (e.g. above 10) may cause instability.

Example

.G
2
.G2

.h

Get motor phase resistance (mOhm).

Example

.h
200

.l

Get motor phase inductance (μH).

Example

.l
2000

.R

Reset the MCU.

Example

.R

.S

Save board configuration.

Example

.S

.X

Erase board configuration and reset.

Example

.X