Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
GOFSL
G Ground and Power Planes O Oscillator layout F Filtering S Software Techniques L LUCKY!!!!!!!
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
Meet Michael
Freescale Field Apps Engineer 8-bit/Sensor Specialist EMC/EFT Specialist Appliance EMC Expert 12+ years Design Engineer 10+ Years in Appliance and Customer MCU applications EMC Global Swat Team Member Published Authored Several Application Notes Consulted/Troubleshot EMC designs for many Major appliance companies
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
Agenda
EMC
Review Theory Guidelines Hardware Design Methodology Customer Examples Software Best Practices References
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
EMC/EFT Overview
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
What is EMC?
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
Noisy component
Radiated Emissions
Potentially susceptible component
Conducted Emissions
Potentially susceptible component
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
Respond to EMC questions/issues from applications using Freescales MCUs Participate in EMC Standards committees
Improve existing standards Extend standards to Integrated Circuits
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
10
IEC
IEC
Powered ESD
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
11
35
30
20
15
E D C B A
10
0 21 VSS AC60 45 VSSAD AC60 44 VDDAD AC60 54 VREFH AC60 22 VDD AC60 44 VDDAD AW60 45 VSSAD AW60 54 VREFH AW60 55 VREFL AW60 55 VREFL AC60 22 VDD AW60 21 VSS AW60
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
12
Power System Switching transients (e.g. capacitor banks switching) Load changes Resonating circuits associated with switching devices such as thyristors System Faults (e.g. shorts, arcing faults to ground) Lightning strikes (direct, indirect or direct to earth)
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
13
Trise = 0.5uS Oscillation Frequency = 100kHz Generator Voltage to 4kV 1-60 Transients / Minute
The ring wave is a typical oscillatory transient induced in low-voltage cables due to the switching of electrical networks and reactive loads, faults and insulation breakdown of power supply circuits or lightning.
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
14
|
B
-
B=
o |
4R2
wL
- - ++++++++ - -
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
15
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
16
Creative
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
17
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
18
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
19
GOFSL
G Ground and Power Planes O Oscillator layout F Filtering S Software Techniques L LUCKY!!!!!!!
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
20
Theory
Electromagnetic theory is well understood The problem not everyone understands it So a quick review of Maxwells equations
wikipedia.org
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
21
Guidelines
Do not rely on design guidelines Todd Hubing, Clemson University Use common sense Visualize signal current paths Locate antennas and crosstalk paths Be aware of potential EMI sources Ask other engineers to review your designs
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
22
for EMC should be considered from the beginning of a project Design for EMC is a complex task
Use a methodical strategy Be prepared for many iterations Employ experts if necessary
Design for EMC compliance Do not limit design to maintain a cost target The design can be cost-reduced later Success
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
24
Entry Filtering
Radiated Conducted
PCB2
PCB1
No Filter Conducted immunity signal propagates to PCB1 and radiates to couple to PCB2 and interior cables.
PCB2
Conducted Filter
PCB1
Filtered Conducted immunity signal suppressed. Clean power supplied to PCB1 and no internal radiation.
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
25
Prioritize ground routes over all other routes Do not use wire jumpers and minimize layer transitions. Where layer transitions occur, use multiple vias Use planes (or wide traces) Minimize impedance between VSS pin and clock source, decoupling, bypassing and filtering components. Use a plane where possible. Route parallel to ground on same or adjacent layers Use wide traces (or planes) Lowest priority for routing Use wire jumpers and vias for connectivity
Power
Data
Decouple regulated and filtered power routed off the PCB (to sensors, displays, etc.)
TM
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
26
Purpose
Prevents unwanted communications between different components (or different power domains) that share the same power rail. This effect is called commonimpedance coupling. Provides a local source of charge to limit voltage variations on the power and ground rails VDD Improves noise margins and stability MCU
Criteria
The capacitance must be sufficient to provide the needed transient current to the load (See AN2764 for needed calculations) The impedance between the bypass and the load must be very low The loop area of the layout must be as small as possible Caps need to be located close to micro to be effective
0.1uF VSS
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
27
Visual aid make sure bypass capacitor is in-line with power supply lines
The supply lines will pass by the cap before entering the MCU With the cap close to the MCU, the loop formed by the MCU and cap is minimized Small loops pick up (and generate) less noise
Good
VDD VDD
Ineffective
VDD
0.1uF
Minimal Loop
MCU
VSS
MCU
0.1uF VSS 0.1uF
MCU
VSS
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
28
Purpose
Prevents unwanted communications between different components (or different power domains) that share the same power rail. This effect is called common-impedance coupling. Provides increased isolation over bypassing Improves noise margins and stability
Criteria
An n-element filter where at least one element is a blocking device The insertion loss of the filter meets the requirement for isolation
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
29
Implementation
Place the decoupling circuit at the entry point of the power domain to be filtered Decoupling is not always used
Decoupling is typically used as a last resort if bypassing fails to give the wanted power-supply isolation. Conductors act as decoupling inductors. Although short trace lengths are desirable, the power lead being long can sometimes help improve decoupling.
VDD VDD_ISO
Filtered DC Output
Examples:
VDD 7805 VDD_ISO
Unfiltered DC Input
VSS
VSS_ISO
VSS
VSS
Voltage regulator
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
30
See recommendations in AN2764 Place filter cap as close to MCU as possible, referenced to a solid MCU ground.
10k
VDD RESET/IRQ
100nF
VSS
MCU
MCU
High
TM
31
Relay
Relay
MCU Outputs
Outputs
Inputs
Inputs
Analog Sensors
Identify element function and power domain Group PCB elements by power domain Decouple and bypass power domains Filter inputs and outputs
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
32
Relay
EMI Filter
Power Supply
Power connections
BP
AC Power Domain
BP
Analog
BP
Relay
Relay
Relay
MCU
LPF
Sensors
LPF
Outputs
Outputs
Inputs
DF: Decoupling filter [Typically L = 100uH-100mH, C = 1uF-100uF] BP: Bypass capacitor [Typically 0.1uF connected between power/ground pins] LPF: Low-pass filter [Typically R = 1k, C = 100nF (10nF for fast signals)]
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
Inputs Inputs
EMI Filter
Power Supply
DF
TM
33
BP
AC Power Domain
BP
Analog
BP
Relay
Relay
Relay
MCU
LPF
Sensors
LPF
Outputs
Outputs
Inputs
DF: Decoupling filter [Typically L = 100uH-100mH, C = 1uF-100uF] BP: Bypass capacitor [Typically 0.1uF connected between power/ground pins] LPF: Low-pass filter [Typically R = 1k, C = 100nF (10nF for fast signals)]
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
Inputs Inputs
EMI Filter
Power Supply
DF
TM
34
Analog inputs
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
35
Advantages
Disadvantages
Sensitive to EMI, humidity and vibration. Drive circuit matching. Sensitive to EMI, humidity and vibration. Drive circuit matching. High cost. High power consumption. Large size. Sensitive to vibration. Sensitive to EMI, humidity and vibration. Poor temperature and supply voltage rejection. Poor freq control and accuracy. Temperature sensitivity generally worse than crystal and ceramic resonator. Some have high power consumption.
Crystal
Low cost Insensitive to EMI and humidity. No additional components or matching issues.
RC Oscillator
Lowest cost
Insensitive to EMI, humidity and vibration. Fast startup. Small size. No additional components or matching issues.
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
36
Configuration
Use higher frequency signal source (4MHz v. 32kHz crystal) for immunity Use high-gain oscillator option for immunity Use low power oscillator option for emissions Use internal oscillator, if possible
Layout
Highest layout priority after power distribution system and MCU decoupling Implementation must be controlled to prevent susceptibility
Group components tightly Locate next to oscillator pins Use short traces Surround with guard trace Isolate from other I/O
37
Layer transition provides decoupling for analog supplies Wide power and ground traces Parallel power and ground traces
Power Ground
C8 C7
R2
Note: C4 bypass is not in-line. In this case it provides a charge reservoir for the VREF supply.
VSSA
VDDA
C3
XFC
C2
C1
R1 R0 R0
VREFH VREFL
C4
Crystal
C5
IRQ
C1
R2
C6
RESET
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
38
Ground Planes
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
39
GND
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
40
VCC
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
41
Software Techniques
Overview
The structure and functionality of microcontroller software can have a profound impact of transient immunity performance Failure modes:
False Signal Detection The MCU detects a change in an input signal that was induced by a transient or other noise. The MCU then operates on or responds to the signal as if it were real. Code Runaway The MCU software execution flow is disrupted. The MCU begins to execute code out of sequence or from incorrect areas of memory.
The impact on software is managed through defensive software design. Software does not eliminate the transient or noise. It can only attempt to control the MCU response to the transient or noise. Long-term issues due to exposure to transients remain.
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
42
Input Pins Interrupt Pins Unused Pins Critical I/O Registers CPU Register Tests Program Flow Token Passing Frequency of Interrupts (too few/too many) Code Runaway Watchdogs CPU Clock Watchdog Reset Timeout Test CRC check on Flash Integrity Unused Program Memory locations RAM Testing Unused Interrupt Vectors
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
43
System clock
1!
1"
1!
1!
0!
1!
Read_portA_bit0 () { Char True_read =0; for (char count = 6; count!=0 ; count--) { unfiltered_read = porta If (unfiltered_read&&0x01) true_read++; /* mask off all bits except bit 0 }; If (true_read > 2) return (1) ; Else return(0); }
Polling
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
44
Interrupt Pins
In
many MCUs, external pins have interrupt capability and in most cases will interrupt the CPU on a specific rising or falling edge. To avoid a spurious noise glitch being seen as a rogue interrupt, users should always read the input signal pin to confirm that the input signal has maintained its assertive state.
For example, if the PA0 pin interrupts the CPU on a negative edge, the ISR first instruction should read the PA0 pin and if clear, then execute the interrupts subroutine. If set, then take this as a rogue interrupt. Note: In most cases the ISR will take several CPU clocks cycles after the input event has occurred providing a delay. Depending on the environment and the system design, software delays also can be implemented to act a sort of de-bounce circuit.
Port x1
System clock
CPU access
ISR
lpc
lpc
Interrupt latency Verify read Identifies bogus interrupt Back to main program
pins that have no read access, deploying a redundant digital input pin can provide this read after event mechanism.
For
some cases the interrupt function may provide the option of edge and level sensitive. In most cases the hardware will still react to a rogue edge as the edge and level sensitive feature really provides an additional interrupt if the input pin is held asserted after the ISR has completed.
TM
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
45
In
some cases not all the input or I/O pins will be used in the MCU end application. Unused Input Only pins need to be tied to either VDD or VSS. A floating high impedance input pin will oscillate and provide an easier coupling path into the MCU circuits for noise. And additionally, they will consumer more current. (If MCU in Stop mode is consuming more current than expected max, this indicates a floating input pin or pins.) Unused I/O pins should be made outputs and drive a logic state out. Software can regularly update the Data and DDR to ensure the pin remains an output. Users of MCUs should also consider the package they are using of the particular MCU as multiple packages are often served with the same silicon die. And on smaller pinout versions, some input/output pins are not bonded out. Thus, the user must force these unused input/output pads to output a static level. For non-bonded input pins, the MCU manufacturer should deploy a pull-up or pull-down device to ensure these are not left floating. This might be programmable via a special control register.
Unused Pins
NC
PA6 PA7
Input only Pull up or pull down Not used (NC) Output low Not bonded Output low
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
46
Input/Output Data Ports Data Direction registers Clock/PLL Set-up registers Peripheral Set-up registers User defined RAM locations key parameters of the application code
All
Re-write Safely
registerswhen you dig deep enough into the designare basically flip flop latches that may be flipped by a spurious noise passing through the circuit. User software should regularly refresh the above critical registers within the main loop of the software to correct a possible flip of bit. For RAM locations where the variables are dynamic, then utilizing a CRC signature of the array of these locations can be saved and regularly checked and verified. MCUs with hardware CRC engines help provide a workable solutions. For MCUs with no hardware CRC engine, executing CRC in software likely will cost too much in execution time. Avoid updating registers on peripherals that are in mid operation (e.g. a transmitting SCI) or corruption/loss of data will occur.
TM
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
47
Stuck at CPU Register Check Write 0xAA, Read 0xAA Write 0x55, Read 0x55
TM
48
Program Flow
Program flow check Program flow check
CPU Access
Appl code
Appl code
Appl code
Appl code
Appl code
Periodic interrupt
49
Token Passing
A
simple form of token passing is to deploy a variable in RAM called COUNTBYTE and for each significant function, increment this COUNTBYTE by 1. With the knowledge of how long the program takes to execute these various functions, the COUNTBYTE can be read within the ISR and compared to previous captured value. If within certain range, it deems the program flow to run as expected. If outwith this range, the program is performing not as expected and mechanisms to reset or place the MCU in a safe mode can be made. Caution: Within each software function, it is not recommended to increment the COUNTBYTE by a certain value but actually set the COUNTBYTE to a fixed value. On real time embedded systems interrupts can occur at any random time and therefore are more difficult to monitor along with the program flow as described above. Thus, only the frequency of interrupts can be monitored then checked within the same periodic ISR routine.
F{11}
COUNTBYTE=0x11; COUNTBYTE=0x12;
F{12}
COUNTBYTE=0x13;
F{13}
Check flow
. If (COUNTBYTE < (previousCOUNTBYTE+2)) Error; If (COUNTBYTE > (previousCOUNTBYTE+6)) Error; /* prrogram flow OK */ previousCOUNTBYTE = COUNTBYTE; ..
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
50
Reset on overflow
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
51
Detect POR (System Reset Reg.) Enable WDOG Write to wdog_tst_flag in RAM
reset
executing any application code, the watchdog should be tested that it is functioning correctly. MCUs have a System Reset Status Register that allows the user to determine the cause of the reset. On recognizing a Power on reset, the user can write a specific word (16- or 32-bits) to RAM location (wdog_test_flag). After this the watchdog is enabled (if not already) another timer is enabled, and then the software sits in a small loop which reads the other timers count value and stores it to another RAM location. Eventually the watchdog will time out and reset. The user code sees that the reset occurred due to a WDOG timeout (from the System Reset Status Register) so confirms if this is a test of the WDOG or a genuine WDOG reset by reading wdog_test_flag. If it is a WDOG test, it is certain that the WDOG has timed out and reset the MCU as expected, but comparison with the captured other timer count value must be ascertained if the time-out period is within the expected range. If this compares ok, then the wdog has been tested and application code now can be executed.
Some
Before
Application code
CPU access
Read Timer Counter value Detect WDOG reset (System Reset Reg) Quantify if WDOG test Compare WDOG timeout with expected Timer Counter value in RAM
Store in RAM
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
52
CPU Clock
Most peripherals are clocked by the same source as CPU Thus if CPU clock stops for a particular reason:
No interrupts will be requested No peripherals will be clocked No software will be executing
If
no CPU clock occurs in real time application then software cannot overcome this issue Thus a watchdog circuit using an alternative clock source still will timeout and reset the key peripherals without CPU clock.
Clock Monitor
User
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
53
golden_signature
the memory is functioning correctly prior to executing application code is recommended. For nonvolatile memory such as Flash or EEPROM, a CRC signature is a good approach in providing a highdiagnostic coverage. There are various different CRC signatures a common one is CCITT-CRC16. This well understood polynomial equation is easily executed in both hardware and software. A software CRC engine will take around 700-1000 CPU cycles to calculate a modified CRC on the addition of 1 byte of data. A h/w CRC engine will take 1 CPU cycle. The approach: Once the application code is completed and working reliably with no changes anticipated, then a CRC signature is made of the total used memory array. Once this signature is completed, it is stored in another unused nvm space and referred to as the golden_signature. After reset the user code will execute a new CRC calculation on the total used memory array then compare the new calculated signature with the golden_signature. If it compares ok, the memory and arguably the addressing mechanism are working correctly.
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
In IEC 61508 CRC signature of NVM, memory is taken to be a more stringent measure than Error Code Correction (parity checking) in hardware. This is because the CRC signature is generally carried prior to executing application code, thus identifying a fault before running with wrong code/data. 54
TM
there are unused memory locations in the NVM arrays, fill these locations with instructions such as SWI (software interrupt). On a runaway condition when the program counter points to unused location, it will force an interrupt which can then put the MCU and the application into a safe state. If there is no Software Interrupt then by examining the assembly code for JUMP(extended address), instruction and the NOP instruction should be examined. With careful consideration fill the unused array with jump to a safe_location.
If
For example: On the S08 CPU the JMP instruction is 0xCC, NOP is 0x9D. So if at address $9D9D, we place code that places the MCU in a safe condition then fill the array with CC,9D,9D,CC,9D,9D, CC,9D,9D, CC,9D,9D, CC,9D,9D, CC,9D,9D, etc. Thus if the Program Counter fails in any location, it will either execute a JMP instruction to $9D9D or a NOP, followed by JMP $9D9D or NOP, NOP, JMP $9D9D.
If PC jumps into anywhere in unused program space, it will execute a few NOP instructions then jump to a safe_start function.
In
most CPUs there are instruction op-codes that will do minimal effect and allow the runaway program counter to go to a known safe place. Note: Avoid filling the arrays with NOPs as this will provide further randomness to how the MCU will perform (unless the top of the unused array falls into a usable array). If the program counter jumps to somewhere in the unused array it will execute all the NOP instructions to the top then execute possibly what is in the next address location (could be I/O register or an interrupt vector contents).
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
55
Unused interrupt vectors should be programmed to point to an individual ISR that will ensure the MCU is placed into a safe known state as most interrupts will require a clearing mechanism. No interrupt vector location should be left blank.
Void interrupt ISR_spare() Void interrupt ISR_spare() { Void interrupt ISR_spare() { /*{called from unused vector */ /* called from unused vector */ Safe_mode(); unused vector */ /* called from Safe_mode(); } Safe_mode(); } }
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
56
Software Techniques
Digital
or Analog Inputs
Boundary checking
Using the input capture function of a Timer module to measure the time duration of the signal The captured value can be compared to the expected value The software can then react appropriately Example:
Input signal specification requires a pulse width of 1ms to 10ms Input capture measures an input pulse width of 50ns such as from an ESD event. Input pulse is bad data. Input capture measures an input pulse width of 5ms. Input pulse is good data.
Analog
Inputs
For
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
57
Software Techniques
Integrated
Protection Features
Typically done by writing a configuration register These configuration bits are often write once
Note: Write these bits even if the default states are not changed. This prevents accidentally disabling protection due to code runaway. Disable hardware functions that are not used
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
58
Conclusions
Achieving transient immunity in low-cost applications can be difficult and time-consuming, particularly if not addressed early and often. Employ a rigorous EMC design methodology. Obtain the needed EMC expertise. Leverage information from suppliers. Understand the limits of low cost. Save cost reduction for after EMC compliance is achieved.
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
59
References
Ronald
B. Standler, Protection of Electronic Circuits from Overvoltages, John Wiley & Sons, 1989 Ken Kundert, Power Supply Noise Reduction, The Designers Guide (www.designers-guide.com), 2004 Larry D. Smith, Decoupling Capacitor Calculations for CMOS Circuits, Electrical Performance of Electrical Packages Conference, Monterey CA, November 1994 Clayton Paul, Introduction to Electromagnetic Compatibility, Wiley & Sons, 1992 Bernard Keiser, Principles of Electromagnetic Compatibility, Artech House, 1987 Howard Johnson, Martin Graham, High-Speed Digital Design, Prentice Hall, 1993 Ralph Morrison, Grounding and Shielding, John Wiley & Sons, 2007 Freescale Semiconductor application note AN2764, Improving the Transient Immunity Performance of Microcontroller-Based Applications, www.freescale.com, 2005
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
60
the First Time A Practical Handbook on High Speed PCB and System Design Volumes I & II Lee W. Ritchey (Speeding Edge) ISBN 0-9741936-0-7 High Speed Digital System Design A handbook of Interconnect Theory and Practice Hall, Hall and McCall (Wiley Interscience 2000) ISBN 0-36090-2 High Speed Digital Design A Handbook of Black Magic Howard W. Johnson & Martin Graham (Prentice Hall) ISBN 0-13-395724-1 High Speed Signal Propagation Advanced Black Magic Howard W. Johnson & Martin Graham (Prentice Hall) ISBN 0-13-084408-X Signal Integrity Simplified Eric Bogatin (Prentice Hall) ISBN 0-13066946-6 Signal Integrity Issues and Printed Circuit Design Doug Brooks (Prentice Hall) ISBN 0-13-141884-X
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
61
Design for Real-World EMI Control Bruce R. Archambeault (Kluwer Academic Publishers Group) ISBN 1-4020-7130-2 Digital Design for Interference Specifications A Practical Handbook for EMI Suppression David L. Terrell & R. Kenneth Keenan (Newnes Publishing) ISBN 0-7506-7282-X Noise Reduction Techniques in Electronic Systems Henry Ott (2nd Edition John Wiley and Sons) ISBN 0-471-85068-3 Electromagnetic Compatibility Engineering Henry Ott (John Wiley and Sons) ISBN 0-470-18930-6 Introduction to Electromagnetic Compatibility Clayton R. Paul (John Wiley and Sons) ISBN 0-471-54927-4 EMC for Product Engineers Tim Williams (Newnes Publishing) ISBN 0-7506-2466-3 Grounding & Shielding Techniques Ralph Morrison (5th Edition John Wiley & Sons) ISBN 0-471-24518-6
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
62
GOFSL
G Ground and Power Planes O Oscillator layout F Filtering S Software Techniques L LUCKY!!!!!!!
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
63
Power and Ground Routing done first MCU VSS should be on ONE layer, no vias if possible, multiple vias if layer transitions Connect VSS, VSSAD, VREFL pins together Good Osc layout, Filter GND from VSS Bypass caps for supply right at MCU pins, make bigger if possible. (0.1uF to 1uF if possible) Reset and IRQ filtered with 0.1uF cap, 10k pull up at micro BDM line needs a 10k pull up and some series resistance if brought out to a connector Prevent over voltages on VDD (>8V) at micro; use a TVS or Zener at VDD, VSS of micro Prevent VSS differential (>0.3V) by connecting VSS pins together, good routing, limit vias, use continuous trace (See first three bullets) Decoupling on board edge if PS is off board for temp sensor, motor, etc. Keep VDD and VSS at micro as parallel as possible for mutual inductance Input filter caps located close to micro and tied back to micros VSS and VDD rails Interlace DC signals with fast switching signals (clocks, door lock, charge pumps, A2D, EEPROM) Include BDM connections for possible diagnostics during noise testing i.e., Hotsync and Programming
Software
Unused I/O Configure as outputs driving low Unbonded I/O ports Configure as outputs driving low Unused modules Write control registers to turn off
Set up system registers first: SOPT, SPMSC1, SPMSC2, SOPT2 registers (LVD, COP, low power) Set up the oscillator: 1) read and write trim value, 2) write ICGC2 register first (multiplier, divider, LOx reset), 3) write ICGC1 (clock and mode) and 4) wait for lock
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
Enable loss of clock reset (LOCRE=1) Enable loss of lock interrupt (LOLRE=0); ICG interrupt should make sure its locked before returning
64
TM
Set
up I/O
The embedded market needs long-term product support Freescale has a longstanding track record of providing long-term production support for our products Freescale offers a formal product longevity program for the market segments we serve
For the automotive and medical segments, Freescale will make a broad range of program devices available for a minimum of 15 years For all other market segments in which Freescale participates, Freescale will make a broad range of devices available for a minimum of 10 years Life cycles begin at the time of launch
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SMARTMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2010 Freescale Semiconductor, Inc.
TM
65
TM