etpu General Function Set (Set 1) David Paterson MCD Applications Engineer

Similar documents
etpu Automotive Function Set (Set 2)

MC33696MODxxx Kit. 1 Overview. Freescale Semiconductor Quick Start Guide. Document Number: MC33696MODUG Rev. 0, 05/2007

Upgrade the Solution With No Changes 2 Upgrade the Solution With No Changes If a Codebase does not contain updates to its properties, it is possible t

PCB Layout Guidelines for the MC1321x

MTIM Driver for the MC9S08GW64

MC56F825x/MC56F824x (2M53V) Chip Errata

USB Bootloader GUI User s Guide

Pad Configuration and GPIO Driver for MPC5500 Martin Kaspar, EMEAGTM, Roznov Daniel McKenna, MSG Applications, East Kilbride

MPC5200(b) ATA MDMA, UDMA Functionality BestComm Setup Recommendations

MPC8349E-mITX-GP Board Errata

Updating the Firmware on USB SPI Boards (KITUSBSPIEVME, KITUSBSPIDGLEVME)

EchoRemote Evaluation Software for Windows

Design Recommendations to Implement Compatibility Between the MC13783VK and the MC13783VK5

SGTL5000 I 2 S DSP Mode

Electrode Graphing Tool IIC Driver Errata Microcontroller Division

IIC Driver for the MC9S08GW64

Using the PowerQUICC II Auto-Load Feature

Mechanical Differences Between the 196-pin MAP-BGA and 196-pin PBGA Packages

MCF5445x Configuration and Boot Options Michael Norman Microcontroller Division

Using the Multi-Axis g-select Evaluation Boards

Using the Asynchronous DMA features of the Kinetis L Series

Managing Failure Detections and Using Required Components to Meet ISO7637 pulse 1 on MC33903/4/5 Common Mode Choke Implementation

Power Cycling Algorithm using the MMA73x0L 3-Axis Linear Accelerometer

Optically-Isolated Multilink BDM Interface for the S08/S12 Microcontrollers by Michael A. Steffen

56F8300 BLDC Motor Control Application

ColdFire Convert 1.0 Users Manual by: Ernest Holloway

MC33897 Single-Wire CAN Transceiver Reliability and Quality Documents

Using the CAU and mmcau in ColdFire, ColdFire+ and Kinetis

Migrating from the MPC852T to the MPC875

Using the Knock Window etpu Function

Using IIC to Read ADC Values on MC9S08QG8

16-bit MCU: S12XHY256 Automotive Cluster Demo by: Jose M. Cisneros Steven McLaughlin Applications Engineer Microcontroller Solutions Group, Scotland

MPC7410 RISC Microprocessor Hardware Specifications Addendum for the MPC7410TxxnnnLE Series

MPR121 Jitter and False Touch Detection

Interfacing MPC5xx Microcontrollers to the MFR4310 FlexRay Controller David Paterson MCD Applications, East Kilbride

HC912D60A / HC912Dx128A 0.5µ Microcontrollers Mask sets 2K38K, 1L02H/2L02H/3L02H & K91D, 0L05H/1L05H/2L05H

Using the Project Board LCD Display at 3.3 volts

Interfacing HCS12 Microcontrollers to the MFR4200 FlexRay Controller

Component Development Environment Installation Guide

PDB Driver for the MC9S08GW64

56F805. BLDC Motor Control Application with Quadrature Encoder using Processor Expert TM Targeting Document. 56F bit Digital Signal Controllers

SCI Driver for the MC9S08GW64

Using DMA to Emulate ADC Flexible Scan Mode on Kinetis K Series

Differences Between the DSP56301, DSP56311, and DSP56321

MCF54451, MCF54452, MCF54453, MCF54454,

Functional Differences Between the DSP56307 and DSP56L307

MPC8260 IDMA Timing Diagrams

Utilizing Extra FC Credits for PCI Express Inbound Posted Memory Write Transactions in PowerQUICC III Devices

Clock Mode Selection for MSC8122 Mask Set K98M

Mask Set Errata for Mask 5L35K

Using the ColdFire+ Family Enhanced EEPROM Functionality Melissa Hunter Derrick Klotz

Symphony SoundBite: Quick Start with Symphony Studio. Installation and Configuration

DSP56F827 Digital Signal Controller

MPR083 Proximity Evaluation Kit User s Guide

Using the Kinetis Family Enhanced EEPROM Functionality

Use of PGA on MC56F800x Interaction of PDB, PGA and ADC

56F805. Digital Power Factor Correction using Processor Expert TM Targeting Document. 56F bit Digital Signal Controllers. freescale.

MPR121 Proximity Detection

Affected Chips Description Impact and Workaround

Mask Set Errata for Mask 2M40J

MC33794 Touch Panel System Using E-Field Sensor Setup Instructions

Freescale BeeStack Documentation Overview Document Number: BSDO Rev /2008

Introduction to LIN 2.0 Connectivity Using Volcano LTP

2005: 0.5 PQ-MDS-PCIEXP

Introduction to the S12G Family EEPROM Including a Comparison between the S08DZ, S12XE, and S12P Families

Interrupts in Decoupled Parallel Mode for MPC5675K Configuration and Usage

Using GCR4 to Adjust Ethernet Timing in MSC8144 DSPs

Interfacing MPC5500 Microcontrollers to the MFR4310 FlexRay Controller Robert Moran MCD Applications, East Kilbride, Scotland

XGATE Library: ATD Average Calculating a rolling average from ATD results

Sensorless BLDC Motor Control Based on MC9S08PT60 Tower Board User Guide

1 Introduction. 2 Problem statement. Freescale Semiconductor Engineering Bulletin. Document Number: EB727 Rev. 0, 01/2010

PowerQUICC HDLC Support and Example Code

MPC5500 Multi-module Demo: Frequency Detection David Paterson MCD Applications Engineer

Using an I 2 C EEPROM During MSC8157 Initialization

Configuring the MCF5445x Family for PCI Host Operation

Gallium Arsenide PHEMT RF Power Field Effect Transistor

Functional Differences Between DSP56302 and DSP56309 (formerly DSP56302A)

MSC8144AMC-S Getting Started Guide

LFAE Bootloader Example and Interface for use with AN2546 Daniel McKenna MCD Applications, East Kilbride Scotland

MCF5216 Device Errata

XGATE Library: Using the Freescale XGATE Software Library Steve McAslan MCD Applications, East Kilbride

Simplified Device Data Structures for the High-End ColdFire Family USB Modules Melissa Hunter Applications Microcontroller Solutions Group

Programming the Keyboard Interrupt Module (KBI) on HC(S)08 MCUs

56F Phase AC Induction Motor V/Hz Control using Processor ExpertTM Targeting Document 56F bit Digital Signal Controllers

Keil uvision 4 Kinetis Support for Freescale MQX RTOS Release Notes

56F Phase Switched Reluctance Motor Control With Hall Sensors using Processor Expert Targeting Document

PowerQUICC II Parity and ECC Capability

Writing Touch Sensing Software Using TSI Module

Using RS08 Microcontrollers with Variable Interrupt Priorities Program Association of RS08 Microcontrollers

MC9S08DZ60 Migrating from the 3M05C to M74K Mask Set D. Scott Brown Applications Engineering Microcontrollers Solutions Group Austin, TX, USA

Ordering Information Industry standard SOT343R package Device weight = g (typical) Available only in tape and reel packaging Available only in

VortiQa Enterprise Quick Start Guide

ADC Driver for MC9S08GW64

Freescale Variable Key Security Protocol Receiver User s Guide Ioseph Martínez and Christian Michel Applications Engineering - RTAC Americas

Using the Serial Peripheral Interface (SPI) Module on 68HC(9)08 Microcontrollers

MPXH6250A SERIES. Freescale Semiconductor Technical Data MPXH6250A. Rev 2, 01/2007

MSC8144 Device Reset Configuration For the MSC8144ADS Board

SynkroRF Network. User s Guide

i.mx31 PDK Power Measurement with GUI

Mask Set Errata for Mask 4L35K

Transcription:

Freescale Semiconductor Application Note Document Number: AN2863 Rev. 0, 12/2007 etpu General Function Set (Set 1) by David Paterson MCD Applications Engineer 1 Introduction This application note complements AN2863SW to describe the enhanced time processing unit (etpu) general function set (Set 1). AN2863SW contains the binary image of the etpu code, source code, and the interface files for the function application programming interfaces (APIs). Functions available are GPIO, PWM, IC, OC, FPM, PPA, UART, QOM, SM, SPI, SPWM, and test, which are discussed in this application note. AN2863SW is available for download at http://www.freescale.com. Contents 1 Introduction................................... 1 2 Function Set Overview.......................... 2 2.1 GPIO (General-Purpose Input/Output).......... 2 2.2 PWM (Pulse Width Modulation)................ 3 2.3 IC (Input Capture).......................... 3 2.4 OC (Output Compare)....................... 3 2.5 FPM (Frequency Pulse Measurement).......... 3 2.6 PPA (Pulse Period Accumulate)............... 3 2.7 UART (Universal Asynchronous Receiver Transmitter)...................................... 3 2.8 QOM (Queued Output Match)................. 3 2.9 SM (Stepper Motor)......................... 4 2.10 SPI (Serial Peripheral Interface)............... 4 2.11 SPWM (Synchronized Pulse Width Modulation)... 4 2.12 Test..................................... 4 3 Function Set Usage............................ 4 3.1 etpu Function Source Code and Binary Image... 4 3.2 etpu Function APIs........................ 5 4 Files Included................................. 5 4.1 etpu Code............................... 6 4.2 CPU Interface Files......................... 6 4.3 Summary and Conclusions................... 7 Freescale Semiconductor, Inc., 2007. All rights reserved.

Function Set Overview 2 Function Set Overview The etpu general function set consists of the following etpu functions. Dedicated application notes and API software are available for each of these functions: Table 1. Function Set Overview Function Description Releated Application Note GPIO General Purpose Input/Output AN2850 PWM Pulse Width Modulation AN2849 IC input Capture AN2851 OC Output Compare AN2852 FPM Frequency Pulse Measurement AN2859 PPA Pulse Period Accumulate AN2858 UART Universal Asynchronous Receiver Transmitter The etpu functions are configurable and adjustable using various parameters and options. This allows the user to customize these functions to their specific application. To support the etpu functions, versions of the etpuc.h (version 1.01) and etpuc_common.h (version 1.1) from Byte Craft are used. The following paragraphs briefly describe the purpose of each etpu function. Refer to the application notes above for more details. 2.1 GPIO (General-Purpose Input/Output) AN2853 QOM Queued Output Match AN2857 SM Stepper Motor AN2869 SPI Serial Peripheral Interface AN2847 SPWM Synchronized Pulse Width Modulation AN2854 TEST The GPIO functions help the user configure an etpu channel as an input or output. As an input, the selected etpu pin can be read periodically, as a result of a CPU request or whenever a transition occurs on a pin. When an etpu channel is configured to read the pin periodically, the period is determined by either of the etpu timebases. As an output, the pin can be driven to a logic high or a logic low level as a result of a CPU request. When a channel is configured as an input, the etpu records the last 24 levels, or edge transitions, in a parameter. These functions can be used only on devices that have a System Integration Unit. N/A 2 Freescale Semiconductor

2.2 PWM (Pulse Width Modulation) Function Set Overview The PWM functions generate a PWM (pulse width modulated) waveform where the frequency and duty can be changed at any time by the CPU. The function can generate waveforms with duty cycles ranging from 0% to 100%. 2.3 IC (Input Capture) This IC function captures input transitions on an etpu channel. It captures, counts, and records the times of edges. The number of counts can be a single specified number or a continuous count. Edges counted can be rising, falling, or both. Links can be made to other channels on completion of a certain number of counts for a specified etpu channel. 2.4 OC (Output Compare) The OC functions can create a single output transition or a pulse. The initial reference time can be immediate a pointer or a value. The initial pin state can be defined. The pin action at each of the two events can be defined, and the timebase used for match and capture events can be specified separately. An interrupt is requested after the second action. 2.5 FPM (Frequency Pulse Measurement) The FPM function counts the number of pulses in a specified window, and alternately measures the frequency of a periodic stream of pulses. 2.6 PPA (Pulse Period Accumulate) The PPA functions measure the total accumulated high time, low time, or period of an input signal over a user-defined number of periods. The period may be measured between rising or falling edges. 2.7 UART (Universal Asynchronous Receiver Transmitter) The UART functions use two etpu channels to provide a 3-wire (TxD, RxD, and GND) asynchronous serial interface. They can be used to add serial capability to a device without a serial port, or to add additional serial I/O to a device that already has hardware UART(s). 2.8 QOM (Queued Output Match) The QOM function generates complex pulse trains using a sequence of output matches. An output match causes a programmable pin response if a user-defined value is matched by the value of a timebase. QOM generates multiple output matches using a table of offset times and pin states. The table size is user-programmable. Various modes of queue operation are supported. Freescale Semiconductor 3

Function Set Usage 2.9 SM (Stepper Motor) The SM functions can drive a stepper motor (SM) based on user-defined acceleration tables. Each time a desired position is set, the etpu generates signals to drive the motor to the position. Even if the desired position is changed before the movement is completed; the motor continues to function in an optimal way move to the new desired position. The function is capable of driving 2-phase and 3-phase motors in full-step or half-step modes. 2.10 SPI (Serial Peripheral Interface) The SPI functions use three etpu channels to form a bidirectional, synchronous serial port that can be used to communicate with a wide variety of devices. They can be used to add serial capabilities to a device without a serial port, or to add further serial port(s) to a device that already has a hardware-synchronous port. One etpu channel is configured to function as the clock and the other two are configured to function as serial transmitter (TxD, or data out) and serial receiver (RxD, or data in). These functions allow a master only configuration. 2.11 SPWM (Synchronized Pulse Width Modulation) The synchronized pulse-width modulation function generates a pulse-width modulated (PWM) waveform where the CPU can change the period or high time at any time. When synchronized to a function on a second channel, SPWM low-to-high transitions have a configurable relationship to transitions on the second channel. The function can generate a complete range of duty cycles from 0% to 100%. 2.12 Test This function is used to generate etpu channel signals that can be used to help test other etpu functions. The test function is used to test the etpu functions and is not intended for customer use. 3 Function Set Usage The etpu general function set release consists of the items described below. 3.1 etpu Function Source Code and Binary Image The etpu function source code and the compiled binary image are included in the following package, which is available on the Freescale website (http://www.freescale.com/etpu): AN2863SW etpu general function set source code and compiled binary image It is not necessary for you to compile the etpu function source code. Only advanced etpu users should modify the etpu functions and then recompile, using the Byte Craft Limited etpu_c compiler. The CPU application must load the compiled etpu code into etpu CODE RAM. The etpu code binary image is included, together with other initialization items, in the etpu_set1.h file. 4 Freescale Semiconductor

Files Included The etpu module initialization can be managed by the fs_etpu_init(...) function, which is one of the standard etpu utilities etpu_util.c and etpu_util.h. The etpu utilities are available on the Freescale web ( General C Functions for the etpu, http://www.freescale.com/etpu, AN2863SW). 3.2 etpu Function APIs The etpu function APIs enable the use of etpu functions in applications. The etpu function API source code is included in the following packages, which are available on the Freescale website (http://www.freescale.com/etpu): Table 2. etpu Function API Source Code Package AN2850SW AN2849SW AN2851SW AN2852SW AN2859SW AN2858SW AN2853SW AN2857SW AN2869SW AN2847SW AN2854SW SET1_TEST_API API Source Description GPIO etpu function API PWM etpu function API IC etpu function API OC etpu function API FPM etpu function API PPA etpu function API UART etpu function API QOM etpu function API SM etpu function API SPI etpu function API SPWM etpu function API Test etpu function API The etpu function APIs include CPU methods that demonstrate how to initialize, control, and monitor the etpu function. The CPU application does not need to access etpu channel registers and/or function parameters directly. Rather, the CPU application can use the etpu function APIs instead. 4 Files Included Here is a list of files included in the AN2863SW download. Table 3. Files Included in AN2863SW File Name etpu_set1\etpu_set1.h etpu_set1\makefile etpu_set1\etpuc_set1.cod File Description Image of etpu code for host CPU (generated by etpu compiler) A makefile used to build the code Debug information for set1 functions Freescale Semiconductor 5

Files Included 4.1 etpu Code Table 4. etpu Code Code Name etpu_set1\etpu_set1.c etpu_set1\etpuc.h etpu_set1\etpuc_common.h etpu_set1\etpuc_util.h etpu_set1\etpuc_gpio.c etpu_set1\etpuc_ic.c etpu_set1\etpuc_fpm.c etpu_set1\etpuc_oc.c etpu_set1\etpuc_ppa.c etpu_set1\etpuc_pwm.c etpu_set1\etpuc_qom.c etpu_set1\etpuc_sm.c etpu_set1\etpuc_spi.c etpu_set1\etpuc_test.c etpu_set1\etpuc_uart.c etpu_set1\etpuc_spwm.c Description Top level file for set1 functions Standard include file for etpu code Standard include file for etpu code Macros from Byte Craft used by some of the functions C source for the etpu GPIO function C source for the etpu IC function C source for the etpu FPM function C source for the OC function C source for the etpu PPA function C source for the etpu PWM function C source for the etpu QOM function C source for the etpu SM function C source for the etpu SPI function C source for the etpu test function C source for the etpu UART function C source for the etpu SPWM function 4.2 CPU Interface Files These files provide an interface between etpu code and CPU code. All references to the general set functions should be made with information in these files. This allows only symbolic information to be referenced, which allows the etpu code to be optimized without effecting the CPU code. Table 5. CPU Interface Files Code Name etpu_set1\cpu\etpu_gpio_auto.h etpu_set1\cpu\etpu_ic_auto.h etpu_set1\cpu\etpu_fpm_auto.h etpu_set1\cpu\etpu_oc_auto.h etpu_set1\cpu\etpu_ppa_auto.h etpu_set1\cpu\etpu_pwm_auto.h etpu_set1\cpu\etpu_qom_auto.h etpu_set1\cpu\etpu_sm_auto.h Description GPIO function interface information IC function interface information FPM function interface information OC function interface information PPA function interface information PWM function interface information QOM function interface information SM function interface information 6 Freescale Semiconductor

Files Included Table 5. CPU Interface Files (continued) Code Name etpu_set1\cpu\etpu_spi_auto.h etpu_set1\cpu\etpu_test_auto.h etpu_set1\cpu\etpu_uart_auto.h etpu_set1\cpu\etpu_spwm_auto.h Description SPI function interface information Test function interface information UART function interface information SPWM function interface information 4.3 Summary and Conclusions This application note provides a description of the etpu general function set (set 1) that complements AN2863SW. AN2863SW contains the binary image of the etpu code and source code. Freescale Semiconductor 7

How to Reach Us: Home Page: www.freescale.com Web Support: http://www.freescale.com/support USA/Europe or Locations Not Listed: Freescale Semiconductor, Inc. Technical Information Center, EL516 2100 East Elliot Road Tempe, Arizona 85284 +1-800-521-6274 or +1-480-768-2130 www.freescale.com/support Europe, Middle East, and Africa: Freescale Halbleiter Deutschland GmbH Technical Information Center Schatzbogen 7 81829 Muenchen, Germany +44 1296 380 456 (English) +46 8 52200080 (English) +49 89 92103 559 (German) +33 1 69 35 48 48 (French) www.freescale.com/support Japan: Freescale Semiconductor Japan Ltd. Headquarters ARCO Tower 15F 1-8-1, Shimo-Meguro, Meguro-ku, Tokyo 153-0064 Japan 0120 191014 or +81 3 5437 9125 support.japan@freescale.com Asia/Pacific: Freescale Semiconductor Hong Kong Ltd. Technical Information Center 2 Dai King Street Tai Po Industrial Estate Tai Po, N.T., Hong Kong +800 2666 8080 support.asia@freescale.com For Literature Requests Only: Freescale Semiconductor Literature Distribution Center P.O. Box 5405 Denver, Colorado 80217 1-800-441-2447 or 303-675-2140 Fax: 303-675-2150 LDCForFreescaleSemiconductor@hibbertgroup.com Information in this document is provided solely to enable system and software implementers to use Freescale Semiconductor products. There are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits or integrated circuits based on the information in this document. Freescale Semiconductor reserves the right to make changes without further notice to any products herein. Freescale Semiconductor makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does Freescale Semiconductor assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental damages. Typical parameters that may be provided in Freescale Semiconductor data sheets and/or specifications can and do vary in different applications and actual performance may vary over time. All operating parameters, including Typicals, must be validated for each customer application by customer s technical experts. Freescale Semiconductor does not convey any license under its patent rights nor the rights of others. Freescale Semiconductor products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the Freescale Semiconductor product could create a situation where personal injury or death may occur. Should Buyer purchase or use Freescale Semiconductor products for any such unintended or unauthorized application, Buyer shall indemnify and hold Freescale Semiconductor and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that Freescale Semiconductor was negligent regarding the design or manufacture of the part. RoHS-compliant and/or Pb-free versions of Freescale products have the functionality and electrical characteristics as their non-rohs-compliant and/or non-pb-free counterparts. For further information, see http://www.freescale.com or contact your Freescale sales representative. For information on Freescale s Environmental Products program, go to http://www.freescale.com/epp. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. Freescale Semiconductor, Inc. 2007. All rights reserved. Document Number: AN2863 Rev. 0 12/2007