Design Overview

P07302

Motor Controller Subsystem

DesignOverview

Quick Index:

Project planpg. 6

Motor Instructions pg. 9

Software Architecture pg. 13

ISA Interfacepg. 19

CAN Controller Interfacepg. 21

Power Regulationpg. 35

Overall Schematicpg. 40

Test Panpg. 48

Timing Analysispg. 50

Index

Project Overview

Customer Needs

Motor Controller Organization

Motor Controller Interfaces

Software system

External Interface Protocol

Motor Control Instruction Set

Software System Architecture

Class Structure

Sequence Diagrams

CAN 2.0 Encoding

ISA Interface

CPLD system

Xilinx XC2C256 CoolRunner (CPLD)

ISA Bus Interface

CAN Controller Interface

MCP2515 (CAN chipset)

CAN Bus Interface

ADUM1200 (opto-isolator)

SG3525A-D (PWM chipset)

Power System

Power Source

PC104 Power Supply

Motor Controller Interface Power Supply

Motor Controller Interface Layout

CPLD pin out:

ISA bus pin out:

CAN controller pin out:

CAN transceiver pin out:

Opto-isolator 1 pin out:

Opto-isolator 1 pin out:

DB9 pin out:

JTAG pin out:

Test Plan Overview

ISA bus test suite

CPLD control test suite

CAN chipset test suite

Instruction encoding test suite

Instruction decoding test suite

Subsystem integration test suite

Overall system integration test suite

Timing considerations

Bill of Materials

Misc: XC2C256 Spec Sheet Excerpt

Misc: MCP2515 Spec Sheet Excerpt

Project Overview

The Motor Controller System is a project within the Systems & Controls Technology Track. Its objective is to develop a modular, scalable, open architecture microcontroller based platform for vehicle and robotic motor control.

The motor controller subsystem currently being designed by us interfaces with the following modules from related projects at a high level as shown in the figure below:

Customer Needs

  1. PC104 Platform Architecture
  2. PC104 form factor Processor PCB shall be defined and supplied to this project team.


The Motor Controller PCB to be designed shall be a family member along with Data Acquisition Subsystem, future Vehicle Function controls and future Communications Subsystems.

  1. Motor Controller Subsystem circuitry shall be on PC104 form factor circuit board(s).
  2. Every effort should be made to place all circuits on one form factor board unless there is a circuit space issue or there is a logical reason to separate (i.e. future upgrades).
  1. Vehicle Drive Motor Controls
  2. The module will drive, control and sense two motors. The design needs are available P07200 Track PDPs. Some critical parameters power, RPM, torque for these motors.
  1. Low Power Motor Controls
  2. The module will drive and control one Low Power Motor. This will drive a small accessory device. Contact customer for specific application(s).
  1. Vehicle Drive Motor Sensor Controls
  2. Each vehicle drive motor will be equipped with a shaft position/rotation sensor capable of measuring shaft rotation position (within 2o accuracy) and direction (CW, CCW).
  3. Each vehicle drive motor will be equipped with a current sensor to determine power being applied.
  4. Each vehicle drive motor will be equipped with thermo-sensor to monitor motor temperature during all motor conditions (i.e. from normal to over temperature conditions).
  1. Client Interface
  2. Via a given software application running on or interfaced through PC104 Processor PCB (supplied), motor controls shall communicate in a timely manner with no loss of data. There shall be approximately 20 motor control commands. The Vehicle Drive Motor Controls will interpret these commands and drive the motor electronics.
  1. Temperature Signal Conditioning
  2. To have this Controller Board universal to several vehicle motors, the following sensors are recommended. This requirement may change in type and/or change in the number of temperature sensors as specific motors are selected by teams in P07200 Track and customer requirements for potentially future motors.
  1. Board Performance
  2. Given the PC104 processor performance, the Motor Controller PC 104 PCB shall not require more than 25% of the total processing capability.
  1. Power Requirements
  2. 12V rechargeable with 1 hr run time.
  1. Other actuator functions

Depending upon Customer meetings with Dr. Hensel (and potentially faculty he recommends you contacting), other vehicle motor controls may be considered.

Motor Controller Organization

Currently the motor controller subsystem can be seen as being composed of the following three subcomponents:

PC104 system / Motor controller interface / PC104 power system
Run the main motor controller software system. The PC104 system operates using a stripped down Linux operating system. / Contain the necessary components required to communicate with the motors using the CAN protocol. / Contain the power circuitry to provide the PC104 with the required power to operate.

P07302: Motor Controller Subsystem

The core functionality and features required of the motor controller interface have been listed below:

  • Communication interface with the PC104 system (through the ISA bus).
  • Communication interface with the motor control modules (using the CAN protocol).
  • Communication interface with an unspecified auxiliary device (basic 8 bit PWM generations).
  • Noise filters on all incoming and outgoing signals.

The core functionality and features required from the PC104 system have been listed below:

  • Communication interface to the client side system.
  • System to keep track of the motor controller subsystem’s state.
  • Interrupt handler to process requests for information received from the client system side.
  • Interrupt handler to process requests for information received from the motor control modules.

The functionality of the PC104 power system is listed below:

  • Regulated step down voltage from a 12V power source.
  • Regulated power supply to the PC104 system.
  • Regulated power supply to the motor controller interface components.

Motor Controller Interfaces

Listed below are the various interfaces that the motor controller subsystem is composed of:

  • Software system:
  • Interface to an external client system.
  • Interface to the PC104 system (using the ISA bus).
  • CPLD system:
  • Interface to the PC104 system (using the ISA bus)
  • Interface to the CAN controller system (using SPI and various command lines).
  • CAN control & encoding system:
  • Interface to the CPLD system.
  • Interface to the CAN bus.

The interfaces of the power system are given below:

  • From the battery:
  • 12V
  • To the PC104 system (using a 10 pin ATX connector):
  • -5V, 5V, -12V
  • To the CPLD
  • 1.8V
  • To the CAN controller and the transceiver:
  • 5V, 2.5V

Software system

The external interface to communicate to the motor controller software system is done using a specified instruction set. These instructions can be invoked by the external client system using a text file or using a wrapper that directly feeds the instructions to the motor controller software system.

Internal to the motor controller’s software system is an interface to the ISA bus, used for communicating with the CPLD.

External Interface Protocol

The following information needs to be shared between the motor controller system and any possible external systems that interface to it.

  • Linear Motion: Velocity, Acceleration, Direction, Displacement
  • Rotational Motion: Angle, Acceleration
  • Temperature from thermocouples
  • Power reading (to determine traction loss)
  • General motor specifications

The instruction set that defines the motor control interface protocol at present consists of 17 instructions. These instructions can be used to access information as well as to send information to control the motor platform.

Each instruction sent to the motor control module consists of the following data fields:

  • 8 bits representing the motor control module ID
  • 8 bit representing the instruction to be sent to the motor controller.
  • A possible 16 bit input.

The proposed 16 bit input will be a represent a discretized percentage between 0 and 100%. Here a 100% would represent the largest safest input that is pre-determined by the particular motor module team.

Motor Control Instruction Set

Returns / Instructions / Input / Expected Operation
Void / KILL / This instruction is used as a convenience procedure. If this instruction is sent to the motor control module, the motor control module has to cease all motor activity as quickly and safely as possible.
Void / SET_ACCELERATION / 0000-FFFF
(0 – 100%) / This instruction is used to set the percentage rate at which the speed changes from one value to an absolutely larger value.
Void / SET_DECELERATION / 0000-FFFF
(0 – 100%) / This instruction is used to set the percentage rate at which the speed changes from one value to an absolutely smaller value.
Void / RAMP_FWD / 0000-FFFF
(0 – 100%) / This instruction is used to set and maintain forward speed.
If the specified speed is less then the speed mentioned by the instruction then the current speed is increased to the new specified speed at the set acceleration.
If the specified speed is greater then the speed mentioned by the instruction then the current speed is reduced to the new specified speed at the set deceleration.
Once the motor reaches the particular speed it levels out and maintains that speed.
Void / RAMP_BCK / 0000-FFFF
(0 – 100%) / This instruction is used to set and maintain reverse speed.
If the specified speed is less then the speed mentioned by the instruction then the current speed is increased to the new specified speed at the set acceleration.
If the specified speed is greater then the speed mentioned by the instruction then the current speed is reduced to the new specified speed at the set deceleration.
Once the motor reaches the particular speed it levels out and maintains that speed.
SPD / GET_SPD / This instruction request the motor control module to raise an interrupt that provides the net displacement (in meters) that has occurred after 100 PWM base cycles.
E_DISP / SET_DISP_TRIGGER / 0000-FFFF
(?0.01? – 100cm) / This instruction instructs the motor control module to raise an interrupt request once a certain amount of displacement has been measured.
Once the required displacement has elapsed, the motor control module needs send a KILL signal to itself before raising the interrupt request with an exception.
The displacement is measured in meters using a calibrated encoder found on the motor.
If the displacement value provided is below the minimum displacement that can be measured by the motor control module then the minimal displacement it can measure is used as a displacement value instead.
DISP / GET_DISP / This instruction requests the motor control module for the current displacement that has been measured.
Once the microcontroller has completed decoding the request it needs to raise an interrupt request with the displacement.
Void / CLR_DISP / This instruction requests the motor to reset its internal displacement value to 0m.
Once the microcontroller has completed decoding the instruction it needs to carry out the requested procedure.
Void / SET_ANGLE / 0000-FFFF
(0 - 100%) / IF THIS INSTRUCTION IS SUPPORTED:
This instruction requests the motor control module to steer the wheel the specified number of degrees in percentile value. 0% represents the maximum counter-clockwise rotation while 100% represents the maximum clockwise rotation.
Once the microcontroller has completed decoding the instruction it needs
ANGL / GET_ANGLE / IF THIS INSTRUCTION IS SUPPORTED:
This instruction requests the motor control module for the current angle that the motor is aligned to.
Once the microcontroller has completed decoding the request it needs to raise an interrupt request with the angle.
TMP / GET_TMP / This instruction requests the motor control module for the temperature that the motor is operating at.
Once the microcontroller has completed decoding the request it needs to raise an interrupt request with the temperature.
E_TMP / SET_TMP_TRIGGER / 0000-FFFF
(0 – 100%) / This instruction instructs the motor control module to raise an interrupt request once the temperature measured at the motor reaches a particular threshold.
Once the required temperature is measured, the motor control module needs send a KILL signal to itself before raising the interrupt request with an exception.
PWR / GET_PWR / This instruction requests the motor control module for the power that the motor is currently operating at.
Once the microcontroller has completed decoding the request it needs to raise an interrupt request with the power.
E_PWR / SET_PWR_TRIGGER / 0000-FFFF
(0 – 100%) / This instruction instructs the motor control module to raise an interrupt request once the power measured at the motor reaches a particular threshold.
Once the required power is measured, the motor control module needs send a KILL signal to itself before raising the interrupt request with an exception.
INFO / GET_SYS_INFO / This instruction instructs the motor control module to raise an interrupt request with a packet containing various formatted information about the motor control module.

SPD: The format expected for the value returned is described below:

0 - 8 bits / 9 - 15 bits
0 / Motor control module ID / GET_SPD (function ID)
16 / 16 bit SPD value, in centimeters per second.

E_DISP: The format expected for the value returned is described below:

0 - 8 bits / 9 - 15 bits
0 / Motor control module ID / SET_DISP_TRIGGER (function ID)
16 / 16 bit E_DISP value, in centimeters.

DISP: The format expected for the value returned is described below:

0 - 8 bits / 9 - 15 bits
0 / Motor control module ID / GET_DISP
(function ID)
16 / 16 bit DISP value, in centimeters.

ANGL: The format expected for the value returned is described below:

0 - 8 bits / 9 - 15 bits
0 / Motor control module ID / GET_ANGLE
(function ID)
16 / 16 bit ANGL value that is a signed integer.

TMP: The format expected for the value returned is described below:

0 - 8 bits / 9 - 15 bits
0 / Motor control module ID / GET_TMP
(function ID)
16 / 16 bit TMP value, in ?F?.

E_TMP: The format expected for the value returned is described below:

0 - 8 bits / 9 - 15 bits
0 / Motor control module ID / SET_TMP_TRIGGER
(function ID)
16 / 16 bit E_TMP value, in ?F?.

PWR: The format expected for the value returned is described below:

0 - 8 bits / 9 - 15 bits
0 / Motor control module ID / GET_PWR
(function ID)
16 / 16 bit PWR value, in W.

E_PWR: The format expected for the value returned is described below:

0 - 8 bits / 9 - 15 bits
0 / Motor control module ID / SET_PWR_TRIGGER
(function ID)
16 / 16 bit E_PWR value, in W.

INFO: The format expected for the value returned is described below:

0 - 8 bits / 9 - 15 bits
0 / Motor control module ID / GET_INFO
(function ID)
16 / 16 bit DISP value, in centimeters.
32 / 16 bit SPD valuein centimeters per second.
48 / 16 bit ANGL value that is a signed integer.
64 / 16 bit TMP value, in ?F?.
80 / 16 bit PWR value, in W.
96 / ???Other motor specific information???
112
128

Software System Architecture

The software system represented in terms of a state machine fashion would look as follows:

As seen above, this system basically loops infinitely until it gets an external instruction. Upon getting an external instruction the relevant instructions subsystem is invoked and the instruction is encapsulated in a CAN 2.0 packet and sent over the ISA bus to the CPLD.

The GET and TRIGGER commands are handled by a separate process. This process is shown below:

This process will then update the Decoder with the correct flag information and will update the class that contains all the low level commands with the correct information specified by a GET command.

Class Structure

The class structure of this program consists of a decoder class that loops infinitely until it receives an external instruction, a user defined class that has all the high level instructions, and then a class that contains all of the low-level instructions that the Decoder method calls. This is shown below:

As can be seen by this diagram, the Decoder class has flags that it will check each time it calls the UserDefinedClass(). This allows the process that receives information from the motor to stop the Decoder from sending more instructions.

As for the other process, the class diagram for the receiver program is shown below:

Figure 1: Receiver Class Diagram

Basically, this class is a main program that sits there until data is sent. It then updates the components of the system as stated above.

Sequence Diagrams

This section shows how the system responds to certain events. These events are a new high-level instruction is available and the system receives an interrupt. How the system responds to a new external instruction is shown below:

NOTE:External instruction here are referred to as high level instructions as these can be sequences of instructions specified in the instruction set.

As seen above, this shows that the new high-level instruction gets sent to the Decoder (which checks to make sure the instruction is allowed to be executed; this is because interrupts can be thrown), which then sends it to the UserDefinedClass() (which contains all of the definitions for functions they want their robot to have). The UserDefinedClass() now calls a series of low-level instructions. These low-level instructions then send the appropriate information to the motors and then return back to the UserDefinedClass(); where the rest of the low-level instructions are sent until completion. Once this happens, the UserDefinedClass() returns to the Decoder, which then waits until a new high-level instruction is available. So as seen in Figure 5, this is an example of a high-level instruction being sent that was comprised of two low-level instructions; and once it was completed, it returned back to the Decoder.

To illustrate what the system would when it gets an interrupt from the motor, such as a KILL signal or other such data updates, the following is needed: