![](https://csdnimg.cn/release/download_crawler_static/86233155/bg1.jpg)
MotorWare Software Architecture
February 2013
![](https://csdnimg.cn/release/download_crawler_static/86233155/bg2.jpg)
Contents
1 Acronyms .............................................................................................................. 4
1 Introduction ........................................................................................................... 5
2 Software Architecture ............................................................................................ 5
2.1 Software Stack.................................................................................................................................. 6
2.2 Objects ............................................................................................................................................. 7
2.3 Handles ............................................................................................................................................ 7
2.4 APIs .................................................................................................................................................. 8
2.5 Software Re-Use .............................................................................................................................. 9
2.6 Directory Structure ............................................................................................................................ 9
2.6.1 Drivers ............................................................................................................................................ 12
2.6.2 Modules .......................................................................................................................................... 13
2.6.3 Solutions ......................................................................................................................................... 13
3 Documentation .................................................................................................... 14
3.1 Coding Standard ............................................................................................................................. 14
4 Control Path Architecture .................................................................................... 15
4.1 System Timing Configuration .......................................................................................................... 15
4.1.1 Hardware Timing Configuration ...................................................................................................... 17
4.1.2 Software Execution Timing Configuration ....................................................................................... 18
4.2 Software Threads ........................................................................................................................... 19
4.2.1 Single Thread ................................................................................................................................. 20
4.2.2 Two Threads ................................................................................................................................... 22
4.2.3 Multiple Threads ............................................................................................................................. 27
5 Data Path Architecture ........................................................................................ 28
5.1 System Timing Configuration .......................................................................................................... 28
5.1.1 Global Data Structures ................................................................................................................... 28
5.2 Software Threads ........................................................................................................................... 29
5.2.1 Single Thread ................................................................................................................................. 29
5.2.2 Two Threads ................................................................................................................................... 29
5.2.3 Multiple Threads ............................................................................................................................. 30
6 Memory Architecture ........................................................................................... 30
6.1 Object Memory Allocation ............................................................................................................... 30
6.2 Initialization ..................................................................................................................................... 30
6.3 ROM Partitioning ............................................................................................................................ 30
7 Flow Diagrams .................................................................................................... 31
7.1 Controller Flow Diagram ................................................................................................................. 31
7.2 Estimator Diagram .......................................................................................................................... 32
8 Error Handling ..................................................................................................... 34
8.1 Controller Errors ............................................................................................................................. 34
![](https://csdnimg.cn/release/download_crawler_static/86233155/bg3.jpg)
8.2 Estimator Errors .............................................................................................................................. 34
9 Summary ............................................................................................................ 35
10 References ......................................................................................................... 35
![](https://csdnimg.cn/release/download_crawler_static/86233155/bg4.jpg)
1 Acronyms
API – Application Programming Interface
ACIM – Alternating Current Induction Motor
ADC – Analog-to-Digital Converter
ePWM – Enhanced Pulse Width Modular
FIFO – First In, First Out
GUI – Graphical User Interface
HAL – Hardware Abstraction Layer
IDE – Integrated Development Environment
ISR – Interrupt Service Routine
MCU – Micro-Controller Unit
PIE – Peripheral Interrupt Expansion
PWM – Pulse Width Modulation
PMSM – Permanent Magnet Synchronous Motor
RAM – Random Access Memory
ROM – Read Only Memory
RTOS – Real Time Operating System
SOC – Start Of Conversion
![](https://csdnimg.cn/release/download_crawler_static/86233155/bg5.jpg)
1 Introduction
The purpose of a software architecture is to provide a consistent development, testing,
and maintenance platform for a development team working on a common collection of
software. By having a consistent architecture, it becomes easier to use and maintain
the software as the number of files in the collection grows and as software developers
come and go from the team. A well-defined software architecture should port across
processor architectures easily and should be understood by software developers with
different levels of programming skill. A software architecture can have the best features
in the world when it comes to programming concepts (e.g. inheritance, abstraction,
etc.), but if it is difficult to use by most of the team, what good is it really. The
architecture becomes more of efficiency inhibitor rather than an efficiency enabler for
the overall software development and maintenance process.
Today’s software development teams have to adapt quickly to new processors and new
applications. Software re-use is a must in today’s world of software development. As a
result, software that is designed for a particular processor architecture should be
avoided in most cases. It is expensive - both from a development and a maintenance
perspective. As a result, the software architecture must support and promote re-use.
And once again, if a software architecture is difficult to use, it certainty won’t be re–
used.
This document describes the software architecture for the MotorWare package. The
software found in this package contains the following features
• Well-defined Software Stack – driver, controller, estimator
• Modular software methodology – object oriented programming model
• Improved code execution - Queues for priority based code execution, inlined
functions
• Software portability across processors
• Software re-use
• Embedded software documentation - Doxygen
• Coding standard
• Single source files
2 Software Architecture
This section describes the software architecture for the MotorWare package in terms of
its software stack, its modular design (e.g. objects), the use of software handles, API
definitions, software-reuse and the MotorWare package directory structure.
评论0