Proceedings - Rochester Institute of Technology



Project Number: 07302

MOdular & Scalable Motor Controller Subsystem

|MATT OESTERLING/ EE |DEV SHENOY/ CE |

|Ashish Karini/EE |Latesia Desnots/EE |Rich Cooper/CE |

|Rahul Gupta/EE |Steve Tallau/ CE |

Abstract

The scope of this document is to provide an overview of the design and development of a robotic vehicular motor control system. This modular, scalable, open architecture microcontroller based platform will be implemented in future senior design projects within the Systems and Control Technology track at RIT. PC104 bus architecture integrates motor modules and data acquisition devices with the microcontroller and allows the capability of extending the system with additional devices.

introduction

Many past RIT senior design projects have used robotic systems to carry-out necessary functions, tests and data acquisition as needed for design requirements. In many cases, application specific motor control systems were designed by these groups which often consumed resources, time, and attention that could otherwise be used toward the original project objective.

Having a flexible motor controller as well as a modular, scalable robotic platform will eliminate this problem. Senior design projects as well as academic research projects will be able to extend the capabilities of this motor controller for their specific needs without having to redesign an entirely new motor controller.

Within the Controls and Technology track, teams are currently working on motor modules, platforms, and data acquisition projects that will all be integrated with the motor controller system. The resulting robotic vehicle will be used as a prototype to demo/showcase at RIT events and may be considered for US First robotic competitions.

Nomenclature

ISA – Industry Standard Architecture

COM – Communication

CPLD – Complex Programmable Logic Device

CAN – Controlled Area Network

SPI – Serial Peripheral Interface

PWM – Pulse Width Modulation

µP – Microprocessor, Microcontroller

MHz –- Mega Hertz

PCB – Printed Circuit Board

MISO – Master In Slave Out

MOSI – Master Out Slave In

I2C – Inter-Integrated Circuit bus standard Protocol

DB9 – Serial Connector

UPS – Universal Power Supply

Development Process

Design Specifications

The Design specifications were developed from customer requirements provided by Dr. Hensel of the Mechanical Engineering department at RIT. A PC104 form factor board using an AMD µP was required, which has a stackable bus architecture that operates under ISA specifications. Interfacing with motor modules and data acquisitions boards is done over the stackable PC104 bus. A motor control daughter board is used for interfacing with motors and sends/receives motor commands as well as sensor information provided by the motor modules. As an auxiliary device, a PWM output is also onboard. The system should use less than 25% of its computing power and operate on a 12 Volt rechargeable battery for up to 1 hour.

Design Concepts and Feasibility

Many design concepts were developed and evaluated. Of these, communication protocol, motor control daughterboard architecture, and software architecture are discussed here.

Different protocols for communicating with the motor modules, including SPI, I2C, and CAN were explored and it was decidedly found among all the P7200 teams that the CAN protocol would be the most efficient method of communication.

The motor control daughterboard could be architected in numerous ways. The use of FPGA’s versus CPLD’s was discussed and CPLD’s were found to be a better/cheaper alternative. As well as how to implement CPLD logic to decode ISA addresses and route the motor commands correctly. More detailed analysis can be found in the concept development document.

Software architecture concepts were weighed to find the advantages and disadvantages of different operating systems to be employed on the AMD processor. Linux was found to be the most suitable.

Preliminary Design Process

Motor Controller Organization

The motor controller subsystem can be seen as being composed of three subcomponents; PC104 system, motor controller interface and PC104 power system. Table 1 briefly summarizes each subcomponent.

|PC104 system |Motor controller |PC104 power system |

| |interface | |

|[pic] |[pic] |[pic] |

|Run the main motor |Contain the necessary |Contain the power |

|controller software |components required to |circuitry to provide|

|system. The PC104 |communicate with the |the PC104 with the |

|system operates using a|motors using the CAN |required power to |

|stripped down Linux |protocol. |operate. |

|operating system. | | |

Table 1: Motor Controller System Subcomponents

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

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

• Software system:

o Interface to an external client system.

o Interface to the PC104 system (using the ISA bus).

• CPLD system:

o Interface to the PC104 system (using the ISA bus)

o Interface to the CAN controller system (using SPI and various command lines).

• CAN control & encoding system:

o Interface to the CPLD system.

o Interface to the CAN bus.

The interfaces of the power system are given below:

• From the battery:

o 12V

• To the PC104 system (using a 10 pin ATX connector):

o -5V, 5V, -12V

• To the CPLD

o 1.8V

• To the CAN controller and the transceiver:

o 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.

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 discrete percentage between 0 and 100%. 100% would represent the largest safest input that is pre-determined by the particular motor module team. The complete instruction set can be found in the appendix under table A1.

The software state machine is depicted in Fig. 1 below.

[pic]

Figure 1: Mircoprocessor Software State Diagram

The system 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 in Fig. 2.

[pic]

Figure 2: GET and TRIGGER Command Process

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.

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.

[pic]

Figure 3: Class Structure Diagram

As seen by Fig. 3, 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.

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

CPLD System

The CPLD system consists of an interface to the ISA bus via which it can send data to the PC104 system / software system. The CPLD system also consists of an interface to the CAN controller chipset via a SPI connection and other dedicated control lines. Figure 4 shows a full system diagram along with the internal logic architecture implemented in the CPLD.

A Xilinx XC2C256 CPLD is used to buffer packets that need to be sent or received from the ISA bus. It also provides the system with send and receive packets for the CAN controller and a digital signal to the PWM chipset.

The CPLD system needs to handle the following aspects of the ISA bus:

• Address Decode

o Determining if the ISA card is addressed

o High Impedance state if not addressed

• Read data bytes from the ISA bus to CPLD

• Send data bytes from the CPLD to the ISA bus

The following physical connections on the ISA bus are used by the CPLD:

• Data Bus

o 8 bits

o Bidirectional

• Address Bus

o 15 bits

o CPLD Input from Bus

• Control Signals

o Write Enable (IOW*)

o Read Enable (IOR*)

o Address Enable (AEN)

o Address Latch Enable (ALE)

o System Clock (CLK)

o Reset

[pic]

Figure 4: System Logic Block Diagram

The microprocessor on the PC104 system will always be the master device using the PC104 stackable bus devices as slaves, in this design the I/O slave device is the Xilinx CPLD. AEN must be low for all data transfers. This tells the ISA card that the address is valid. To latch the address onto the bus ALE must be asserted, the address will be latched on the falling edge of ALE. For uP reads and writes the system address must remain valid on the bus until the end of the transfer cycle. During a read operation the data must stay valid on the bus until the falling edge of the last cycle of the transfer. For write operations, valid data must remain on the bus for the remainder of the cycle.

CAN Control and Encoding System

The CAN controller chipset that the CPLD will be interfacing with is the MCP2515 CAN controller, where Fig. 4 depicts its logic block diagram. The CPLD in this case will be acting as a buffer and throughput for data that is to be sent and received from the CAN controller’s transmit and receive buffers. The CAN controller contains three separate transmit buffers independently controllable and two receive buffers which can be independently read.

The control for these are implemented in one of two ways, either addressing control registers on the CAN controller or configuring the control signal lines to provide similar functionality in an interrupt fashion. The CPLD cannot attempt to provide intelligent control of the CAN controller chip, it must behave purely as a hardware interface between the ISA bus and the CAN chip.

SPI protocol must be utilized for sending and receiving data with the CAN controller and the ISA bus interface to send and receive data between the CPLD and the software. To transmit data via SPI, the CPLD implements a SPI state machine which sends 8 bits serially via the MOSI signal line to the CAN controller. The CAN controller specification sheet defines the commands and protocols for manipulating and using the MCP2515.

The MCP2515 is a standalone CAN controller chipset. It is capable of receiving and transmitting data frames over the CAN bus. It is also capable of handling errors, acknowledging messages and retrying transfers. Instructions to the MCP2515 are sent via a SPI interface and data frames also read from the MCP2515 via the SPI interface.

[pic]

Figure 5: CAN Controller Block Diagram

CAN Bus Interface

The MCP2551 (CAN transceiver) is a transceiver that modulates the TXCAN and RXCAN signals from the CAN controller to the CANHIGH and CANLOW signals that will be transmitted over the CANBUS.

The CAN transceiver is capable of operating at 1Mbps in high speed mode and is capable of supporting up to 112 nodes.

The physical interface to the CAN bus are implemented using a DB9 connector. Female right angle DB9 connectors are placed on all the boards (both the controller interface board and the motor controller boards). Male DB9 connectors are used to implement the actual connection. Figure 5 depicts the DB9 pinout.

[pic]

Figure 6: CAN Transceiver DB9 Physical Pinout

Signal Conditioning

Galvanic isolation is required to CAN interface to ensure error-free data transmissions and to isolate the CPLD/logic system from external high voltage devices.

The ADUM1200 is a dual channel digital opto-isolator that can provide this required isolation for the CAN interface. It is also capable of supporting a maximum data transmission rate of 1Mbps with a propagation delay of 150ns.

Figure 6 below shows the pin out for the ADUM1200 digital isolator:

[pic]

Figure 7: Opto-isolator Pinout

Pulse Width Modulation

One of the requirements of the motor controller interface board is provide support for an auxiliary device. A simple servo motor may be used as the auxiliary device on the controller PCB. The SG3525 has an input precision of 8 bits.

Figure 7 below shows the pin out for the SGA3525A-D chipset.

[pic]

Figure 8: Pulse Width Modulator Pinout

A servo motor is a small device that has an output shaft. A coded signal can be sent to the servo to position the shaft to a particular angular position. This position is maintained for as long as the coded signal stays on the line. To change the position of the shaft the code sent to the line is changed. The angle is determined by the duration of a pulse that is applied to the control wire. This is called Pulse Width Modulation (PWM). Based on the pulse width the motor speeds up or down.

Power System

The power system comprises of power distribution to microprocessor and its logical circuitry. Supplying the required power to the circuit ensures smooth error-free functioning of the micro-controller. Two separate batteries power the modules. One large output power battery powers up the motor, while the second battery powers the logical circuitry. This battery will be a UPS style battery with output of 12V.

Engineering Model

Hardware Schematic and Board Layout

After designing the system, a hardware layout was completed. Two boards were designed, the Motor Controller Daughter Board and the Power Board. Both boards interface with the PC104 ISA stackable bus. Layout board design was completed using PCB express Layout tools. This design was outsourced to a local company for fabrication. Figure A1 in the appendix shows the board layout schematic.

Figure 9 is a photo taken during testing, and shows how the PC104 will interface with the daughterboard and Power Board.

[pic]

Figure 9: PC104 Hardware Board

Hardware Flexibility

A flexible design was necessary to meet the required specifications. Using a CPLD allows the Motor Controller Daughter board to be completely reconfigurable, which may be necessary for application specific purposes and/or upgrading to improve the current design. Onboard, there is a miscellaneous 8 pin header that can also be implemented as needed

Experimental Setup and Procedure

Testing Apparatus

This design was very software intensive and most of the testing dealt with programming the µP and the CPLD. A video board was attached to the PC104 stack in order to code and debug the internal µP programming. Xilinx Project Navigator was used to program, simulate and program the CPLD.

After the initial software was developed it was loaded onto the boards, and a series of tests were run to confirm proper operation.

Testing the hardware, involved use of a digital logic analyzer as well as LED’s to probe CPLD pins and confirm data transmissions.

Test Plan

In order to validate the Motor Controller Subsystem’s functionality the following series of tests suites were used:

1. ISA bus test suite

2. CPLD control system test suite

3. CAN chipset test suite

4. Instruction encoding test suite

5. Instruction decoding test suite

6. Subsystem integration test suite

7. Overall system integration test suite

The ISA bus test suite was designed to test the functionality of the ISA bus transmits and receives between the PC104 and the CPLD. Its primary objective is to validate the data bit and the device address the data is sent and received to and from. Initially only 8-bit data transmissions are carried out to validate the ISA bus’s control signals.

The CPLD control system test suite validates the addressing schemes used for the internal registers in the CPLD. To validate the SPI transmission implementation, one of the transmit registers in the CAN chipset is filled with a specified data field. The CAN chipset’s control lines are then toggled to read the data that was transmitted to the CAN chipset’s transmit register. This can be used to validate the SPI transmission and receive system. It can also be used to test the control line system for the CAN chipset.

The CAN chipset test suite tests the operation of the CAN chipset, the CAN transceiver and the CAN bus.

The proposed method for testing these components as a whole is to have another CAN chipset, CAN transceiver and CAN bus interface. Since the current CPLD development kit consists of two CPLD’s the VHDL code to access the CAN chipset via SPI can be used to verify the data that is being transmitted from one CAN chipset to another. Since the data is transmitted serially and is 60 bits in length the proposed methods of validating the data are to either check the CRC fields or to print out the expected data back to the PC104 as an ASCII string.

The purpose of the Instruction decoding test suite is to verify that an instruction from the software application gets encoded and transmitted properly via the ISA bus to the CPLD and then to the CAN subsystem.

In this test suite all 17 instructions are tested, however only the boundary condition input values for these instructions are tested as inputs. The CAN chipset test suite is then used to verify and further validate this instruction encoding test suite. The second CPLD can be used to either buffer and output particular parts of the data or to transmit the data back to the PC104 so that the encoded instruction can be viewed as an ASCII string.

In order to test the decoding capabilities of the motor control subsystem, the second set of CAN components along with the second CPLD is used. The second CPLD will be loaded with 60 bit values representing encoded instructions. These instructions will be then be transmitted from the second CAN system to the first CAN system. The decoding capability of the CAN chipset and the CPLD system is then observed. The decoded result is then obtained through the PC104 and displayed as an ASCII string.

After the above the instruction decoding test suite was carried out the majority of the motor controller subsystem was tested as a whole. Hence it concludes the subsystem integration test suite.

Once the internal components of the motor controller subsystem were tested as a whole, the overall system was tested with the motor systems that are on the different vehicle platforms to test for CAN packet compliance, CAN packet identifier recognition and finally to test the instruction processing ability of the individual motor systems. All 17 instructions were tested and boundary values were used for instructions that require additional input.

Design Analysis

Timing Analysis and Synchronization

Synchronizing the entire system depends on the timing at the ISA bus, SPI, and CAN interfaces. The system bottleneck will be with the SPI communication since it is a serial protocol operating at 1 MHz, as depicted previously in Fig. 4. The following describes the timing analysis at each interface.

ISA 8 bit data transfers operate on an 8.3 MHz clock. The timing diagram for an 8 bit data transfer with 4 wait states is shown in the appendix under Fig. A2. (W1-W4 depict the wait states). It is calculated that the worst case delay for an ISA data transmission is 55 ns.

The SPI interface protocol will be operating under normal SPI specifications, Fig. 10 is the timing diagram for a MOSI transmission to the CAN chip. Figure 11 is a diagram for a MISO transmission to the CPLD.

[pic]

Figure 10: SPI MOSI Transmission Timing

[pic]

Figure 11: SPI MISO Transmission Timing

CAN operates at 1 Mb/s and transmissions are sent in 8 byte packets. These packets will be sent to the CAN from the CPLD via SPI. Each byte of data transferred to the CAN is bundled with an 8 bit address and 8 bit instruction which sums to a 24 bit serial SPI transfer.

Processor Usage

The PC104 processing usage was an estimated 10-15% which is well under the requirement of 25%. Most of the processing consumption is due to a polling scheme for means of feedback as opposed to interrupt handling.

Conclusions and Recomendations

As of writing this document a fully function prototype has not been fabricated. Testing has been accomplished using development kits for all three subcomponents.

Currently, the PC104 µP can successfully run the software and can interface with the ISA bus. The CPLD can also interface with both the ISA bus and SPI output enabling for data transfers to and from the PC104 and SPI. CAN protocol development and implementation is still in progress. Communications with motor modules have been successful in previous attempts bypassing CAN communications.

In conclusion this design can be viewed as low-level drivers for interfacing necessary devices. Future projects will be able to build on this design given its flexibility. Interrupt handling, battery life indication, user-friendly interface, user control and device upgrades are all possible upgrades.

Interrupt handling requires experience with general interrupt programming. Developers will have to delve heavily into kernel programming in order to achieve this. Battery life indication can be easily implemented onto the CPLD with simple logic and a few output pins. As far as interfacing, it will be possible for users to write graphical user interfaces that can be used at a very high level. Also, controlling a vehicle via joy-stick or remotely are possibilities.

Acknowledgments

▪ Dr. Hensel, Customer, ME Department

▪ Prof. Slack, Team Advisor, EE Department

▪ Dr. Lukoviac, CE Department

▪ Dr. Philips, EE Department

▪ Dr. Hopkins, EE Department

▪ All of the 07200 teams

Thank you all for your help and support with the completion of this project!

References

Brown, S., & Vranesic, Z. (2005). Fundamentals of Digital Logic with VHDL Design (2nd Edition ed.). New York: McGraw Hill.

Controller Area Network. (2007, February 15). Retrieved 2006, from Wikipedia:

Digilent Inc. (2006). XC2C Development Platform. Retrieved 2006-2007, from :

Microchip Technology Inc. (2005, March 1). Stand Alone CAN Controller with SPI Interface. Retrieved 2006-2007, from :

Serial Peripheral Interface Bus. (2007, February 20). Retrieved 2006, from Wikipedia:

. (2002). ISA Bus Technical Summary. Retrieved 2006-2007, from Techfest web site:

Versalogic Corp. (n.d.). Lynx Single Board Computer. Retrieved 2006-2007, from :

Xilinx inc. (2002, December 13). Xilinx. Retrieved 2006, from Coolrunner Serial Peripheral Interface Master: 348.pdf

Xilinx inc. (2007, February 15). Xilinx. Retrieved 2006-2007, from XC2C256 Data Sheet:

APPendix

[pic]

Figure A1: Motor Controller Daughter Board Schematic

__ __ __ __ __ __ __

CLK ___| |___| |___| |__| |___| |___| |___| |__

W1 W2 W3 W4

AEN __________________________________________________

__

ALE _______| |_______________________________________

______________________________________

SA0-SA15 ----------

_____________ _____

IOR* or IOW* |______________________________|

_____

SD0-SD7 -------------------------------------------

(READ)

___________________________________

SD0-SD7 -------------

(WRITE)

Figure A2: ISA Bus 8 bit Data Transfer Timing Diagram

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download