AN2432 Freescale Semiconductor / Motorola, AN2432 Datasheet

no-image

AN2432

Manufacturer Part Number
AN2432
Description
LIN Sample Application for the MC68HC908EY16 Evaluation Board
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Application Note
AN2432/D
Rev. 0, 12/2002
LIN Sample Application for
the MC68HC908EY16
Evaluation Board
by Peter Topping,
Introduction
Applications Engineering,
Motorola, East Kilbride
The MC68HC908EY16 LIN evaluation board was designed to facilitate the
development of LIN (Local Interconnect Network, reference [1]) slave nodes
and includes features to ease system development and debug. These features
include access to most of the pins on the MC68HC908EY16 MCU, an RS232
’08 monitor interface and a connector to allow the use of a P&E Cyclone or
Multilink interface. Any of these interfaces can be used in conjunction with
Metrowerks Codewarrior to constitute a low cost development system allowing
the development of MC68HC908EY16 applications including FLASH
programming and software debugging. While any kind of application is
possible, the board is primarily intended for LIN applications and includes an
MC33399 LIN interface chip (reference [4]). The CD accompanying the board
includes LIN software drivers which handle the LIN protocol using the EY16’s
SCI pins. This allows very easy development of LIN slave nodes.
This application note presents a simple LIN monitor using the
MC68HC908EY16 LIN evaluation board. AN2343 (reference [8]) includes a
more sophisticated LIN monitor that displays data using an LCD module
external to the PCB. The monitor described here does not require any
hardware in addition to the evaluation board. The display capability, using only
the 5 onboard LEDs, is consequently more limited.
The LIN bus is a low-cost single-wire serial bus ideally suited for use in many
industrial and automotive applications. A typical application is in a car door.
While a higher bandwidth CAN (Controller Area Network) bus is often used to
transfer data to and from the door, within the door a LIN bus with its limited data
rate of 20,000 baud is adequate to distribute the information to and from the
keypad, mirror, window and lock modules. Each LIN node requires only 3 wires;
there is one LIN data line, the other two connections being the positive and
negative supplies.
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
© Motorola, Inc., 2002

Related parts for AN2432

AN2432 Summary of contents

Page 1

... Freescale Semiconductor, Inc. Application Note AN2432/D Rev. 0, 12/2002 LIN Sample Application for the MC68HC908EY16 Evaluation Board by Peter Topping, Applications Engineering, Motorola, East Kilbride Introduction The MC68HC908EY16 LIN evaluation board was designed to facilitate the development of LIN (Local Interconnect Network, reference [1]) slave nodes and includes features to ease system development and debug ...

Page 2

... Freescale Semiconductor, Inc. AN2432/D The software for this LIN monitor is listed in appendix simplified by the use of software drivers (reference [2]) that deal with the serial LIN protocol. These drivers use the MC68HC908EY16’s SCI module to interface with the LIN physical interface (MC33399) and allow the application code to use simple Application Program Interface (API) function calls to read status information and data from the LIN messages ...

Page 3

... This, and a procedure for creating a completely new Codewarrior project, are described in detail in appendix I. Creation of a new project allows development of a different application, with its own LIN characteristics (message IDs etc.), without interfering with the supplied demonstration application. Go to: www.freescale.com AN2432/D 3 ...

Page 4

... Freescale Semiconductor, Inc. AN2432/D Use of the evaluation board with Cyclone, Multilink and MMDS/MMEVS A second method of using the monitor mode development environment is to connect via the 16-pin P4 connector. This is configured for a Cyclone or Multilink interface. Operation is very similar to that described above, the advantage being that the users PCB does not need to incorporate an RS232 interface ...

Page 5

... Codewarrior project, are described in detail in appendix I. Creation of a new project allows development of a different application, with its own LIN characteristics (message IDs etc.), without interfering with the supplied demonstration application. (12 volts) and ground connections. This 12 BAT Go to: www.freescale.com AN2432/D LIN evaluation board hardware 5 ...

Page 6

... Freescale Semiconductor, Inc. AN2432/D The board also incorporates a 9.8304MHZ canned oscillator module which is required to run monitor mode using the RS232 PC interface. This module is fitted using a socket so that it does not need to be fitted not required. Cyclone and Multilink interfaces incorporate their own clock source and thus do not require the oscillator module ...

Page 7

... Freescale Semiconductor, Inc. Figure 1. MC68HC908EY16 evaluation board circuit diagram MOTOROLA LIN Sample Application for the MC68HC908EY16 Evaluation Board For More Information On This Product, Go to: www.freescale.com AN2432/D LIN evaluation board hardware 7 ...

Page 8

... Freescale Semiconductor, Inc. AN2432/D Software The LIN LED monitor uses the Motorola/Metrowerks LIN drivers to handle the LIN I/O protocol. Access to the drivers is via the API described in the LIN08 Driver User’s Manual (reference [2]). This manual is included on the CD accompanying the evaluation board. An example of the use of this API is the function call “ ...

Page 9

... Check message 30 MOTOROLA LIN Sample Application for the MC68HC908EY16 Evaluation Board For More Information On This Product TBIF set ? bit set ? Y Tick LED on Tick LED off N Active ? Y Activity LED off (figure 3) (figure 4) Figure 2. Main Software Flow Chart Go to: www.freescale.com AN2432/D Software 9 ...

Page 10

... Freescale Semiconductor, Inc. AN2432/D The LIN driver functions “LIN_IdleClock()” and “LIN_DriverStatus()” are then used to determine whether or not there is any activity on the LIN bus. “LIN_IdleClock()” checks whether or not there is any bus activity. If not, it increments a counter whose value is compared with LIN_IDLETIMEOUT. ...

Page 11

... For More Information On This Product, N Has this happened N 250 times ? error counter less than 250 ? Y Message 20 LED on Read message bit of byte message high ? Y Data LED on Figure 3. Message 20 Flow Chart Go to: www.freescale.com AN2432/D Software Increment error counter Message 20 LED off Data LED off 11 ...

Page 12

... Freescale Semiconductor, Inc. AN2432/D LIN message with ID 30 received since last read ? Y Reset error counter References 1. LIN Protocol Specification, Version 1.2, 17 November 2000. 2. LIN08 Driver User’s Manual rev 1.1, 13 March 2001. 3. MC68HC908EY16A Advance Information. 4. MC33399 data sheet. 5. AN2203, LIN demo, 2000. 6. AN2205, Car door keypad using LIN, November 2001. ...

Page 13

... Header file includes and globals * ******************************************************************************/ #include "HC08EY16.h" #include <linapi.h> unsigned char Data_buf[8]; unsigned char count = 0; unsigned char no_20 = 0; MOTOROLA LIN Sample Application for the MC68HC908EY16 Evaluation Board For More Information On This Product, Go to: www.freescale.com AN2432/D Software listing 13 ...

Page 14

... Freescale Semiconductor, Inc. AN2432/D unsigned char no_30 = 0; /****************************************************************************** * * Function name: Main * ******************************************************************************/ void main (void) { CONFIG1 = 0x01; CONFIG2 = 0x29; PTB = 0x20; DDRA = 0x7C; DDRB = 0xE7; DDRC = 0x83; DDRD = 0x03; while (ICGCR != 0x13) { ICGCR = 0x12; } TBCR = 0x00; TBCR = 0x02; asm CLI; LIN_Init(); while ( (TBCR & 0x80) { TBCR |= 0x08 ...

Page 15

... ID20 LEDs off /* yes, ID20 LED on /* and get data /* check MS bit, last byte */ /* bit high, LED on /* bit low, LED off /* new ID30 message ? /* no, already over 250 ? /* no, increment /* yes, new 30 received Go to: www.freescale.com AN2432/D Software listing */ */ */ */ */ */ */ */ */ */ ...

Page 16

... Freescale Semiconductor, Inc. AN2432/D if (no_30 > 250) { PTA |= 0x10; } else { PTA &= ~(0x10); LIN_GetMsg (0x30, Data_buf /****************************************************************************** * Function: LIN_Command * * Description: User call-back. Called by the driver after transmission or * reception of the Master Request Command Frame (ID: 0x3C). * ******************************************************************************/ void LIN_Command() { while( LIN Sample Application for the MC68HC908EY16 Evaluation Board ...

Page 17

... In particular slave.id should be modified to specify the appropriate IDs and slave.cfg should be modified to enter the appropriate values for the baud rate and the bus timeout. The slave.cfg Go to: www.freescale.com AN2432/D Appendix I – Codewarrior LIN project cloning 17 ...

Page 18

... Freescale Semiconductor, Inc. AN2432/D 12. Many files within the project, for instance the output files slave.abs and 13. Close Codewarrior. When relaunched, the newly created project will be Appendix IIa – Include file (register definitions for the MC68HC908EY16) /***************************************************** HC08EY16.H Register definitions for the 908EY16 P ...

Page 19

... LIN Sample Application for the MC68HC908EY16 Evaluation Board For More Information On This Product, /* for HC08 */ /* ESCI receive ISR */ /* ESCI error ISR */ /* Timer Module B Overflow ISR - */ /* Timer Module B Channel 0 ISR */ /* SWI ISR */ /* HiCross compiler startup routine declaration */ /* vectors segment declaration */ Go to: www.freescale.com AN2432/D Appendix IIb – vector.c 19 ...

Page 20

... Freescale Semiconductor, Inc. AN2432/D /***************************************************************************/ /* HC08EY16 /* /* These vectors are appropriate for the following MC68HC908EY16 /* mask sets:- 0L38H, 1L38H, 0L31N,and 1L31N /* These mask sets had a fault in their interrupt vector table and /* hence in the interrupt priorities For the vector address in the corrected mask set (2L31N) see /* the MC68HC908EY16 technical data sheet ...

Page 21

... This number shall not be greater than 0xFFFF. */ #define LIN_IDLETIMEOUT 500u #endif /* defined (HC08) */ #endif /* !define (LINCFG_H) */ MOTOROLA LIN Sample Application for the MC68HC908EY16 Evaluation Board For More Information On This Product, 0x04u Go to: www.freescale.com AN2432/D Appendix IIc – slave.cfg (LIN configuration file) 21 ...

Page 22

... Freescale Semiconductor, Inc. AN2432/D Appendix IId – slave.id (LIN message ID file) #ifndef LINMSGID_H #define LINMSGID_H /****************************************************************************** * * Copyright (C) 2001 Motorola, Inc Functions: Message Identifier configuration for LIN08 Slave sample * with Motorola API * * * Notes: * ******************************************************************************/ #define LIN_MSG_20 LIN_RECEIVE #define LIN_MSG_21 LIN_RECEIVE #define LIN_MSG_30 LIN_RECEIVE /* this string is not necessary - just as an example */ ...

Page 23

... Freescale Semiconductor, Inc. This page is intentionally left blank MOTOROLA LIN Sample Application for the MC68HC908EY16 Evaluation Board For More Information On This Product, Appendix IId – slave.id (LIN message ID file) Go to: www.freescale.com AN2432/D 23 ...

Page 24

... Motorola and the Stylized M Logo are registered in the U.S. Patent and Trademark Office. digital dna is a trademark of Motorola, Inc. All other product or service names are the property of their respective owners. Motorola, Inc Equal Opportunity/Affirmative Action Employer. © Motorola, Inc. 2002 AN2432/D Go to: www.freescale.com ...

Related keywords