Application Note. Introduction. AN2255/D Rev. 0, 2/2002. MSCAN Low-Power Applications

Similar documents
Application Note. Introduction. AN2461/D Rev. 0, 2/2003. Low Power Management using HCS12 and SBC devices

MSCAN Block Guide V03.01

CAN Node using HCS12

Remote Keyless Entry In a Body Controller Unit Application

3. The MC6802 MICROPROCESSOR

IN2515. STAND-ALONE CAN CONTROLLER (Functional equivalent МCР2515 Microchip) TECHNICAL DATA FEATURES

M68HC08 Microcontroller The MC68HC908GP32. General Description. MCU Block Diagram CPU08 1

Interfacing MC33903/4/5 With MC9S08DZ60

Freescale Semiconductor, I

Arduino Uno R3 INTRODUCTION

CAN Protocol Implementation

AppNote-US2400-EVB Low Power 2.4GHz Transceiver

Module Introduction. PURPOSE: The intent of this module is to explain MCU processing of reset and interrupt exception events.

AVR XMEGA Product Line Introduction AVR XMEGA TM. Product Introduction.

FLASH: FASTER WAIT MODE WAKEUP RECOVERY TIME FOR FLASH AR457 ATD: CONVERSION OF THE (V RH V RL )/2 INTERNAL REF VOLTAGE RETURNS $7F, $80 OR $81

Module 2. Embedded Processors and Memory. Version 2 EE IIT, Kharagpur 1

DCB1M - Transceiver for Powerline Communication

Chapter 1 Freescale s Scalable Controller Area Network (S12MSCANV2)

MOS INTEGRATED CIRCUIT

Frequently Asked Questions

DS2405. Addressable Switch PIN ASSIGNMENT

Microcontroller. BV523 32bit Microcontroller. Product specification. Jun 2011 V0.a. ByVac Page 1 of 8

Section 10. Power-Saving Features

Hello and welcome to this Renesas Interactive module that covers the Independent watchdog timer found on RX MCUs.

Fredrick M. Cady. Assembly and С Programming forthefreescalehcs12 Microcontroller. шт.

EVB9S08DZ60. Demonstration Board for Freescale MC9S08DZ60. User s Manual

ET-PIC 24 WEB-V1. o Central Processing Unit (CPU) o System. o nanowatt Power Managed Modes. o Analog Features

SCB-C08 USB to RS232/422/485 Converter

AN4749 Application note

F²MC-16FX FAMILY ALL SERIES STANDBY MODES & POWER MANAGEMENT 16-BIT MICROCONTROLLER APPLICATION NOTE. Fujitsu Microelectronics Europe Application Note

MOTOROLA. System Basis Chip with Low Speed Fault Tolerant CAN. Advance Information MC Freescale Semiconductor, I. Semiconductor Technical Data

High-Performance 32-bit

Basics of UART Communication

Hello, and welcome to this presentation of the STM32 Real- Time Clock. It covers the main features of this peripheral, which is used to provide a

High-Speed CAN Transceiver with Partial Networking

NuSpeech Family N5132 High Sound Quality Voice Synthesizer Technical Reference Manual

Infineon C167CR microcontroller, 256 kb external. RAM and 256 kb external (Flash) EEPROM. - Small single-board computer (SBC) with an

HT1611/HT1611C Timer with Dialer Interface

Hello, and welcome to this presentation of the STM32L4 power controller. The STM32L4 s power management functions and all power modes will also be

8. Power Management and Sleep Modes

ERRATA SHEET INTEGRATED CIRCUITS. Date: July 7, 2008 Document Release: Version 1.8 Device Affected: LPC2148

RF4431 wireless transceiver module

Low-Power Techniques for the S12X Family Steve McAslan MCD Applications, EKB

Hello, and welcome to this presentation of the STM32 general-purpose IO interface. It covers the general-purpose input and output interface and how

DS1306. Serial Alarm Real Time Clock (RTC)

Hardware Reference. PNP/5280 Board Revision 1.0

TP6836. USB 2.4G RF Dongle. Data Sheet

Freescale s Next Generation 8-bit LCD Solutions

eip-24/100 Embedded TCP/IP 10/100-BaseT Network Module Features Description Applications

Section 28. WDT and SLEEP Mode

FM24CL04 4Kb FRAM Serial Memory

ALPW-BLEM103 Datasheet 1.0 Bluetooth Low Energy HCI

AM18X5. 1. Introduction. 2. System Power Control Applications. Application Note. AM18X5 Family System Power Management

EASY219 / IEC CANopen Master / Slave

M68EM05X4 EMULATOR MODULE USER'S MANUAL

PC3 PC4 PC5 PC6 PC7 VSS VPP1 PB0 PB1 PB2 PB3 PB4 PB5

MC68331 DEVICE INFORMATION (Issue 6-17 August, 1995) Rev. A and B Silicon E95B, E93N and F43E Mask Set

ERRATA SHEET INTEGRATED CIRCUITS. Date: July 9, 2007 Document Release: Version 1.6 Device Affected: LPC2148

Hello, and welcome to this presentation of the STM32 Reset and Clock Controller.

FM24C Kb FRAM Serial Memory Features

Microcontroller basics

FM24C16C-GTR. 16Kb Serial 5V F-RAM Memory. Features. Description. Pin Configuration NC NC NC VSS VDD WP SCL SDA. Ordering Information.

Application Note. EMC Design Guide. F 2 MC-8L Family. History 04 th Jul 02 NFL V1.0 new version

Hello, and welcome to this presentation of the STM32L4 s full-speed on-the-go (OTG) USB device interface. It covers the features of this IP, which is

The Power of Ethernet

Section 10. Watchdog Timer and Power Saving Modes

WT6510. USB Keyboard Controller (Mask ROM Type)

Application Hints - Standalone high speed CAN transceivers Mantis TJA1044 / TJA1057, Mantis-GT TJA1044GT / TJA1057GT and Dual- Mantis-GT TJA1046

Chapter 7 Central Processor Unit (S08CPUV2)

ERRATA SHEET INTEGRATED CIRCUITS. Date: 2008 June 2 Document Release: Version 1.6 Device Affected: LPC2468. NXP Semiconductors

CAN (Controller Area Network) Physical Layer

Low Power System Techniques

Am186ER/Am188ER AMD continues 16-bit innovation

Analog Devices Welcomes Hittite Microwave Corporation NO CONTENT ON THE ATTACHED DOCUMENT HAS CHANGED

keyestudio Keyestudio MEGA 2560 R3 Board

Engineer-to-Engineer Note

CGM: CRYSTAL OPERATION

Microprocessors & Interfacing

MPX-2515 User s Guide

AUTOMOTIVE WAKEUP METHODS. Natalie Wienckowski September 2017 IEEE802.3 Interim

Approximately half the power consumption of earlier Renesas Technology products and multiple functions in a 14-pin package

Interrupts (I) Lecturer: Sri Notes by Annie Guo. Week8 1

RF4432 wireless transceiver module

Analog Devices Welcomes Hittite Microwave Corporation NO CONTENT ON THE ATTACHED DOCUMENT HAS CHANGED

Hello, and welcome to this presentation of the STM32 Low Power Universal Asynchronous Receiver/Transmitter interface. It covers the main features of

DS1305EN. Serial Alarm Real-Time Clock

TP6825. USB Full Speed Game Pad Controller. Data Sheet. Tenx reserves the right to change or discontinue this product without notice.

Frequently Asked Questions

Analog, Mixed-Signal and Power Management

ILI2312. ILI2312 Single Chip Capacitive Touch Sensor Controller. Specification ILI TECHNOLOGY CORP. Version: V1.03.

APPLICATION NOTE. How to Securely Switch Atmel s LIN Transceiver ATA6662/ATA6662C to Sleep Mode ATA6662/ATA6662C. Concerning Atmel ATA6662

Industrial Controller Area Network (CAN) Applications

8051 Microcontroller

Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their

Introduction. PURPOSE: This course explains several important features of the i.mx21 microprocessor.

AN1298. Variations in the Motorola MC68HC(7)05Cx Family By Joanne Field CSIC Applications. Introduction

Raystar Microelectronics Technology Inc.

USB-4303 Specifications

S12VR Hardware Design. Guidelines. 1 Introduction. 2 Hardware Design. Guidelines. 2.1 Voltage regulator. Freescale Semiconductor

SBAT90USB162 Atmel. SBAT90USB162 Development Board User s Manual

Transcription:

Application Note Rev. 0, 2/2002 MSCAN Low-Power Applications by S. Robb 8/16-bit MCU Division Freescale, East Kilbride Introduction The Freescale Scalable Controller Area Network (MSCAN) is the specific implementation of the Freescale Scalable CAN concept. The MSCAN module is integrated onto several families of Freescale microcontrollers, including the MC68HC08, MC68HC12 and MC9S12 families. The MSCAN module fully implements the CAN 2.0 A/B protocol as defined in the Bosch specification of September 1991. For readers to fully understand the MSCAN behaviour, it is recommended that the Bosch specification and the MSCAN user guide are consulted. The MSCAN specification varies slightly for different microcontrollers, so the user guide or technical data appropriate to the microcontroller of interest should be consulted. The MSCAN module on the microcontroller is connected to the CAN bus by means of a physical interface. The CAN bus itself is usually a differential twisted pair of wires, although single wire implementations also exist. For ease of use, several CAN interface integrated circuits are available. The CAN interfaces can be divided into two basic types: high speed and fault tolerant. High speed CAN interfaces can operate over the full range of CAN bus speeds, from 10kbps (10,000 bits per second) to 1Mbps (1000,000 bits per second). In contrast, fault tolerant CAN interfaces are limited to 125kbps. Fault tolerant CAN interfaces continuously monitor the CAN bus lines for faults, such as a broken wire or a wire shorted to battery voltage, ground, or both wires shorted together. If a fault is detected, the fault tolerant CAN interface will automatically take action to minimise the system current consumption and if possible, to allow communication to continue on a single wire. In case of a fault recovery, the fault tolerant CAN interface will automatically switch back to normal operation. An example of a fault tolerant CAN interface is the MC33388. A high speed CAN interface offers no fault tolerant features. Motorola, Inc., 2001

nc. A higher level of integration is available with system basis chips. System basis chips integrate many circuits commonly found in embedded CAN applications, offering a saving in circuit board area and cost. A system basis chip such as the MC33889 integrates many functions including a fault tolerant CAN interface, dual voltage regulator, supply voltage monitor, programmable watchdog and wake-up features. The system basis chip is controlled by a SPI interface to the microcontroller. The MC33989 is similar but with a high speed CAN interface. The microcontroller, MSCAN module, CAN interface and system basis chips all have low power modes. The lowest power consumption mode is usually called 'sleep' mode. The purpose of low power modes is to reduce power consumption to a minimum during periods of inactivity. Minimising power consumption is important for battery powered applications. For example, an automotive application is battery powered whilst the engine is switched off and there must be sufficient charge left in the battery to start the engine after a period of at least two weeks. During periods of inactivity, an electronic control unit (ECU) will be predominantly in a low power sleep mode. The ECU may be required to wake-up periodically to check for new activity or in response to an external stimulus either on an input pin or on the CAN bus. The purpose of this paper is to describe the co-ordinated actions necessary to put a CAN application into a low power sleep mode such that it will wake-up in response to a specified stimulus. The description in this paper is based on the MC9S12D family of microcontrollers, however it also applies to the MC68HC08 and MC68HC12 microcontrollers that have an MSCAN module, albeit with slightly different register and register bit names. 2 MSCAN Low-Power Applications

nc. Low Power Modes Low Power Modes Microcontroller A microcontroller has three basic power consumption modes: normal, wait and stop. In normal mode the microcontroller is fully operational. This mode has the highest power consumption. Certain unused peripheral modules may be held in an initialisation mode, preventing unnecessary power consumption. In wait mode, clocks to the CPU are stopped, substantially reducing power consumption. Clocks to peripheral modules may also be stopped under software control, further reducing power consumption. Wait mode is entered by executing the WAI instruction. Wait mode is exited when an unmasked interrupt is detected, either from an external signal or from one of the peripheral modules that is still running, or by a reset. In stop mode, all internal clocks are stopped. The external crystal oscillator is alsostopped(unlessthepstpbitintheclkselregisterisset).power consumption is reduced to an absolute minimum. Stop mode is entered by executing the STOP instruction with the S bit in the condition codes register (CCR) clear. Stop mode is exited when an unmasked interrupt due to an external signal is detected, or by a reset. A message on the CAN bus is capable of generating a wake-up interrupt, if configured correctly. On exit from stop mode the crystal oscillator is restarted. If the PSTP bit in the CLKSEL register is set when the STOP instruction is executed the oscillator is not stopped. This results in greater power consumption but with the advantage that the crystal start up delay is eliminated and also reduces the mechanical stress and ageing of the crystal in case of frequent STOP conditions. One other factor that has a significant effect on power consumption is the microcontroller bus frequency. The microcontroller typically uses an external crystal oscillator with a frequency in the range of 1MHz to 8MHz. An internal phase locked loop (PLL) then generates the internal bus frequency of up to 25MHz. An effective way to reduce power consumption is to disable the PLL which will reduce the internal bus frequency to half the crystal oscillator frequency. This technique is commonly used in conjunction with wait mode. Peripheral modules that are clocked from the same source as the internal bus clock will have their timing affected. The MSCAN module can be clocked directly from the crystal oscillator and will not be affected if this option is selected. MSCAN Low-Power Applications 3

nc. MSCAN The MSCAN module has two low power modes: Sleep mode and Power-down mode. In Sleep mode power consumption is reduced by stopping all MSCAN clocks except those required for the CPU to access registers. In Power Down mode, all MSCAN clocks are stopped; this is the lowest power consumption mode. If the MSCAN is disabled (CANE = 0) all MSCAN clocks except those required for the CPU to access registers are stopped to reduce power consumption. Table 1. CPU versus MSCAN Operating Modes summarises the combinations of MSCAN and CPU modes. Table 1. CPU versus MSCAN Operating Modes CPU Mode RUN WAIT STOP Note: X means don t care. MSCAN Mode Normal Sleep Power Down CANE = 1 CSWAI = X SLPRQ = 0 SLPAK = 0 CANE = 1 CSWAI = 0 SLPRQ = 0 SLPAK = 0 CANE = 1 CSWAI = X SLPRQ = 1 SLPAK = 1 CANE = 1 CSWAI = 0 SLPRQ = 1 SLPAK = 1 AscanbeseenfromTable 1. CPU versus MSCAN Operating Modes, the MSCAN can be in normal mode or Sleep mode whilst the CPU is running. The MSCAN registers are configured whilst the CPU is running to select the required mode when the CPU enters Wait mode. Power Down mode is always entered when the microcontroller enters Stop mode. An MSCAN Wake-up interrupt can only occur if: The MSCAN is in Sleep mode or Power Down mode with SLPRQ = 1 and SLPAK = 1, Wake-up functionality is enabled (WUPE = 1), The Wake-up interrupt is enabled (WUPIE = 1), Interrupts are not masked (I = 0 in CCR) and CANE = 1 CSWAI = 1 CANE = X CSWAI = X SLPRQ = X SLPAK = X A dominant level is detected at the RX input (required duration dependant on WUPM bit). 4 MSCAN Low-Power Applications

nc. Low Power Modes The MSCAN will not receive or acknowledge the first CAN message which generates the Wake-up interrupt. Furthermore, if the microcontroller was in Stop mode when the CAN message was received, no CAN messages will be received or acknowledged until the microcontroller oscillator has restarted and the MSCAN has synchronised to the CAN bus (synchronisation requires that 11 consecutive recessive bits are detected). In a network in which all nodes are in a low power mode, the first message to be transmitted will serve to wake-up all nodes that are appropriately configured, but the message may only be received and acknowledged by the node that recovers to normal operation the quickest. Thus a second message may need to be transmitted if confirmation that all nodes are operational is required. CAN Interface The CAN interface or system basis chip will also have a low power mode, usually called Sleep or Standby mode. The operational mode of a CAN interface is determined by the voltage on one or two pins. These pins are usually connected to I/O pins of the microcontroller so that the microcontroller can control the operational mode of the CAN interface, as shown in Figure 1. Typical CAN Application Circuit. The operational mode of a system basis chip is determined by the value of an internal register; the microcontroller controls the operational mode by sending appropriate commands via the SPI interface. The microcontroller thus controls the operational mode of the CAN interface or system basis chip, placing the CAN interface in a low-power sleep mode prior toaperiodofcaninactivityandreturningthecaninterfacetonormal operation when CAN communication is required. The trigger to wake-up may be the receipt of a CAN message, and the CAN interface or system basis chip is able to detect the CAN message whilst in sleep mode. Dominant bits on the CAN bus will cause the CAN interface or system basis chip to drive a low level (dominant value) on its RX output, so enabling the appropriately configured microcontroller to wake-up. System basis chips and some CAN interfaces also haveaseparateoutputpinthatcanbeusedtowake-upthemicrocontrollervia an interrupt input pin. The system basis chip can use this output to wake-up the microcontroller on a periodic basis if desired. MSCAN Low-Power Applications 5

nc. 5V 12V BATTERY SWITCH MCU eg. MC9S12DP256 VSS I/O PORT MSCAN TXCAN RXCAN 100nF 100nF VDD VDD VBAT INH EN STB NERR TX RX MC33388 100nF WAKE RTH CANH CANL GND RTL 10uF 47k Figure 1. Typical CAN Application Circuit R R 10k CAN BUS R / number of nodes > 100Ω 500Ω <R<16kΩ 6 MSCAN Low-Power Applications

nc. Entering Low Power Mode Entering Low Power Mode NOTE: In the following description, 'clear' means bit = 0, and 'set' means bit = 1. In order to ensure reliable wake-up operation and to prevent generation of CAN errors, an appropriate procedure must be followed when entering low power mode. NOTE: 1. First it is necessary to put the MSCAN into sleep mode and configure the wake-up options while the CPU is still running. To enter sleep mode, the SLPRQ bit in the CANCTL0 register is set by the CPU. Any pending message transmissions should either be transmitted in their entirety or should be aborted before the SLPRQ bit is set by the CPU. Sleep mode is not entered immediately! If the CAN bus is quiet, sleep mode will be entered within 1 or 2 bit times. If there is message being transmitted or received, sleep mode will be entered when the message transmission has completed. When the MSCAN has entered sleep mode, the SLPAK bit in the CANCTL1 register is set by the MSCAN. The MCU must wait for the SLPAK to become set before proceeding to the next step. If another message follows, the MSCAN will immediately wake-up! Thus, it is suggested that the CAN network operational modes are handled by network management software. For example, a specific message can be broadcast telling every node to go into sleep mode at thesametime. 2. The CAN physical interface or system basis chip must now be commanded to enter its low power mode. The physical interface must not be put in a low power mode before the MSCAN is in sleep mode. If the periodic wake-up feature of the system basis chip is to be enabled, this must be done before the sleep command is sent. 3. MCU wake-up functionality must now be enabled. If the MSCAN will be used to wake-up the MCU, refer to 3a. If the MCU will be awakened with an interrupt pin connected to the CAN interface or system basis chip, refer to 3b. 3a. Using the MSCAN to wake-up the MCU. The WUPE bit in the CANCTL0 register must be set, to enable wake-up on bus activity. The WUPIE bit in the CANRIER register must be set and there must be an interrupt routine to handle the wake-up interrupt. The I-mask bit in the CCR must be cleared. The WUPM bit in the CANCTL1 register may be set to filter out any short spikes from the CAN interface RX pin. MSCAN Low-Power Applications 7

nc. 3b. Using an Interrupt pin to wake-up the MCU The appropriate pin from the CAN interface or system basis chip (e.g. NERR or INT) must be connected to a port pin with interrupt functionality e.g. PORTP. The port pin must be configured as an input, the interrupt enable bit for the port pin must be set, and the port pin must be configured to generate an interrupt on a falling edge. There must be an interrupt routine to handle the port interrupt. The I-mask bit in the CCR must be cleared. 4. If SLPAK is still set, the MCU can now be put in a low power mode, either Wait or Stop. If the MCU enters Stop mode, the MSCAN enters 'power-down' mode. If the MCU enters Wait mode, the MSCAN enters 'power-down' mode if the CSWAI bit in the CANCTL0 register was previously set, or remains in sleep mode if the CSWAI bit is clear. The S bit in the Condition Codes Register (CCR) must be clear for the STOP instruction to be executed. 8 MSCAN Low-Power Applications

nc. Entering Low Power Mode START 1 Put MSCAN into Sleep mode: set SLPRQ SLPAK set? No Other processing Yes 2 Put CAN interface into sleep mode 3 Enable MCU Wake-up. Set WUPE, WUPIE and optionally WUPM to enable the MSCAN to wake-up the MCU. I-bit must be cleared. SLPAK still set? Yes No 4 Put MCU into low power mode: execute WAI or STOP STOP until interrupt occurs Figure 2. Enter Low Power Mode Flowchart MSCAN Low-Power Applications 9

nc. MSCAN Wake-up When a message is transmitted on the CAN bus by another node, the sleeping MCU will be awakened by the interrupt selected in step 3. If the MCU is awakened by the MSCAN then the MSCAN will have automatically exited from its sleep mode. If the MCU is awakened by another source, such as an interrupt pin, the MSCAN will remain in its sleep mode until the CPU clears the SLPRQ bit in the CANCTL0 register and the MSCAN clears the SLPAK bit in the CANCTL1 register in response. In both cases the MCU must bring the CAN interface or system basis chip out of its low power mode in order to receive or transmit CAN messages. When the code in the appropriate interrupt service routine has executed, code execution continues from the last instruction before the interrupt occurred. If the MCU was in Stop or Wait mode, code execution continues with the next instruction after the WAI or STOP instruction. The first message transmission serves to wake-up the sleeping MCU, but is not received. This message will be automatically retransmitted until it is acknowledged by one node on the network. Note that some nodes may take longer to wake-up than others. In particular, MCUs that are in STOP mode will have to restart the oscillator before messages can be received (if the PSTP bit in the CLKSEL register is set, the oscillator continues to run in STOP mode which reduces the start-up time - this is called pseudo-stop mode). MSCAN Wake-up Interrupt Clear WUPIF, WUPIE Clear SLPRQ Enable CAN Interface Return from Interrupt. Figure 3. MSCAN Wake-up Interrupt Flowchart 10 MSCAN Low-Power Applications

MSCAN Wake-up nc. This Page Has Been Intentionally Left Blank MSCAN Low-Power Applications 11

nc.