Dr. Alexander Walsch alexander.walsch@ge.com IN 2244 Part V WS 2013/14 Technische Universität München



Similar documents
AN1229. Class B Safety Software Library for PIC MCUs and dspic DSCs OVERVIEW OF THE IEC STANDARD INTRODUCTION

Chapter 1 Lesson 3 Hardware Elements in the Embedded Systems Chapter-1L03: "Embedded Systems - ", Raj Kamal, Publs.: McGraw-Hill Education

Debugging A MotoHawk Application using the Application Monitor

8051 MICROCONTROLLER COURSE

SYSTEM ecos Embedded Configurable Operating System

Data Link Layer Overview

ARM Thumb Microcontrollers. Application Note. Software ISO 7816 I/O Line Implementation. Features. Introduction

2.0 Command and Data Handling Subsystem

Fastboot Techniques for x86 Architectures. Marcus Bortel Field Application Engineer QNX Software Systems

Operating Systems. Lecture 03. February 11, 2013

Memory Systems. Static Random Access Memory (SRAM) Cell

Hello, and welcome to this presentation of the STM32L4 reset and clock controller.

Spacecraft Computer Systems. Colonel John E. Keesee

Computer and Set of Robots

LIN (Local Interconnect Network):

ARM Cortex STM series

Chapter 13. PIC Family Microcontroller

Chapter 13 Embedded Operating Systems

AN3307 Application note

Digital Signal Controller Based Automatic Transfer Switch

Atmel Norway XMEGA Introduction

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

AN3307 Application note

Operating Systems 4 th Class

CHAPTER 7: The CPU and Memory

find model parameters, to validate models, and to develop inputs for models. c 1994 Raj Jain 7.1

Embedded Systems on ARM Cortex-M3 (4weeks/45hrs)

8-Bit Flash Microcontroller for Smart Cards. AT89SCXXXXA Summary. Features. Description. Complete datasheet available under NDA

Timer Value IRQ IACK

Keil C51 Cross Compiler

Welcome to the Introduction to Controller Area Network web seminar My name is William Stuart, and I am a Applications Engineer for the Automotive

(Refer Slide Time: 00:01:16 min)

Lesson-16: Real time clock DEVICES AND COMMUNICATION BUSES FOR DEVICES NETWORK

Do AUTOSAR and functional safety rule each other out?

UM1741 User manual. STM32F0 series safety manual. Introduction

Microcontrollers in Practice

RS-485 Protocol Manual

(Cat. No SI) Product Data

ADVANCED PROCESSOR ARCHITECTURES AND MEMORY ORGANISATION Lesson-17: Memory organisation, and types of memory

SPI I2C LIN Ethernet. u Today: Wired embedded networks. u Next lecture: CAN bus u Then: wireless embedded network

Freescale Semiconductor, Inc. Product Brief Integrated Portable System Processor DragonBall ΤΜ

Embedded Real-Time Systems (TI-IRTS) Safety and Reliability Patterns B.D. Chapter

Effective Application of Software Safety Techniques for Automotive Embedded Control Systems SAE TECHNICAL PAPER SERIES

71M6521 Energy Meter IC. Real Time Clock Compensation. The Challenge. The RTC in the 71M6521D/F. Theory of Operation APPLICATION NOTE

NAND Flash FAQ. Eureka Technology. apn5_87. NAND Flash FAQ

Real-time Operating Systems Lecture 27.1

Secure My-d TM and Mifare TM RFID reader system by using a security access module Erich Englbrecht (info@eonline.de) V0.1draft

UC CubeSat Main MCU Software Requirements Specification

Computer-System Architecture

How to Perform Real-Time Processing on the Raspberry Pi. Steven Doran SCALE 13X

Von der Hardware zur Software in FPGAs mit Embedded Prozessoren. Alexander Hahn Senior Field Application Engineer Lattice Semiconductor

Module 8. Industrial Embedded and Communication Systems. Version 2 EE IIT, Kharagpur 1

In-Vehicle Networking

Microtronics technologies Mobile:

Introduction. What is an Operating System?

AN141 SMBUS COMMUNICATION FOR SMALL FORM FACTOR DEVICE FAMILIES. 1. Introduction. 2. Overview of the SMBus Specification. 2.1.

UMBC. ISA is the oldest of all these and today s computers still have a ISA bus interface. in form of an ISA slot (connection) on the main board.

CSC 2405: Computer Systems II

ES_LPC4357/53/37/33. Errata sheet LPC4357/53/37/33. Document information

Software engineering for real-time systems

Embedded Systems. 6. Real-Time Operating Systems

Price/performance Modern Memory Hierarchy

Flash Corruption: Software Bug or Supply Voltage Fault?

Local Interconnect Network Training. Local Interconnect Network Training. Overview

White Paper. Real-time Capabilities for Linux SGI REACT Real-Time for Linux

STM32L. Ultra-low-power Cortex -M3 devices

AC/DC Power Supply Reference Design. Advanced SMPS Applications using the dspic DSC SMPS Family

SIMATIC. C7-621, C7-621 AS-i Control Systems. Volume 2 Working with C7 A B C D E. Contents. User Information. Introduction. Startup.

Safety and Security Features in AUTOSAR

PCI Express Overview. And, by the way, they need to do it in less time.

Data Cables. Schmitt TTL LABORATORY ELECTRONICS II

Memory Testing. Memory testing.1

Exceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine

COMPUTER HARDWARE. Input- Output and Communication Memory Systems

Value Paper Author: Edgar C. Ramirez. Diverse redundancy used in SIS technology to achieve higher safety integrity

Automating with STEP7 in LAD and FBD

1. Computer System Structure and Components

SOLARCARE SERIES PRODUCT AND APPLICATION GUIDE

Voice Over IP Per Call Bandwidth Consumption

Deeply Embedded Real-Time Hypervisors for the Automotive Domain Dr. Gary Morgan, ETAS/ESC

Digitale Signalverarbeitung mit FPGA (DSF) Soft Core Prozessor NIOS II Stand Mai Jens Onno Krah

Elettronica dei Sistemi Digitali Costantino Giaconia SERIAL I/O COMMON PROTOCOLS

AN4664 Application note

Overview of the Cortex-M3

The I2C Bus. NXP Semiconductors: UM10204 I2C-bus specification and user manual HAW - Arduino 1

Booting from NAND Flash Memory

FOUNDATION Fieldbus High Speed Ethernet Control System

DeviceNet Communication Manual

Computer Architecture

Creating the program. TIA Portal. SIMATIC Creating the program. Loading the block library. Deleting program block Main [OB1] Copying program blocks

POCKET SCOPE 2. The idea 2. Design criteria 3

Develop a Dallas 1-Wire Master Using the Z8F1680 Series of MCUs

CCNA 2 Chapter 5. Managing Cisco IOS Software

Safety and security related features in AUTOSAR

Timer, Interrupt, Exception in ARM

AN_6521_035 APRIL 2009

STM32 F-2 series High-performance Cortex-M3 MCUs

Data Storage - II: Efficient Usage & Errors

Understanding Safety Integrity Levels (SIL) and its Effects for Field Instruments

Switch Fabric Implementation Using Shared Memory

Transcription:

Industrial Embedded Systems - Design for Harsh Environment - Dr. Alexander Walsch alexander.walsch@ge.com IN 2244 Part V WS 2013/14 Technische Universität München

Architecture Patterns Recurring Hardware and Software building blocks Focus on Reliability see lecture slides on reliability Safety see lecture slides on safety Keep in mind: faults can be random or systematic Design decisions are based on reasoning (FTA, FMEA) and recommendations (e.g. safety architectures) A. Walsch IN2244 WS2013/14 2

Software Design Concepts Source: IEC61508-3 A. Walsch IN2244 WS2013/14 3

Base Channel Data source Processing channel Input Data Processing Output Data sink Reliability (random faults): see previous calculations Reliability (systematic faults): highly affected Safety: 1oo1 architecture, not used A. Walsch IN2244 WS2013/14 4

Protected Channel Data source Processing channel Input Data Processing Output Data sink Data/Control Validation Still 1oo1. Provides some data and control flow checks (self-monitoring) Internal watchdog, acceptance tests Use: not used in safety-related applications, reliability increase (depends on application) A. Walsch IN2244 WS2013/14 5

External Diagnostics (MooND Architectures) Processing channel Data source Input Data Processing Output Data sink Data/Control Validation HW Integrity Shutdown trigger Monitoring channel Monitor Input Actuator monitor A. Walsch IN2244 WS2013/14 6

Watchdog Circuits A watchdog timer is a supervisory component which must be triggered in regular intervals in order to avoid system reset Embedded processors usually come with internal watchdog circuits. A failure mode (drift) of the oscillator (account for in FMEA) makes a second external one with a separate clock source highly advisable for robust systems. Internal watchdogs can be disabled accidentally by software Set and reset the watchdog in different parts of the software to disallow stuck-at watchdog pulse loops A. Walsch IN2244 WS2013/14 7

Watchdog Circuits II Source: Maxim AN1926 A. Walsch IN2244 WS2013/14 8

Watchdog Circuits III Standard watchdog Windowed watchdog Source: Microchip, dspic30f A. Walsch IN2244 WS2013/14 9

Multiple Channels Processing channel 1 Data source Input Data Processing Output Compare Fault detection Switch control switch Data sink Processing channel 2 Data source Input Data Processing Output A. Walsch IN2244 WS2013/14 10

Operating Systems (widely used) OS Vendor Domain certification VxWorks CERT Windriver Industry, Aviation Integrity Greehills Industry, Railway, Aviation, Healthcare Neutrino Safe QNX Industry SafeRTOS Wittenstein Industry PikeOS SYSGO Industry, Aviation, Automotive, Railway A. Walsch IN2244 WS2013/14 11

Scheduling The need for scheduling (as taken from PMU system requirements specification): Task response time: also known as execution time is the total time required for the computer to complete a task (IO, memory access, overhead, CPU execution time) a task in general is an instance of a program that consumes time Task cycle time: time between periodic task calls (start of execution) A. Walsch IN2244 WS2013/14 12

Super Loop The main loop: Super loop Functions (tasks) to be executed in sequence Functions run-to-completion Single stack But: Relies on timeliness of executed functions Variation of function response time will affect timing of all others A. Walsch IN2244 WS2013/14 13

Timer Interrupts Timer based interrupts: fosc = 2 * fcy Task (C function) executed within the timer-driven interrupt service routine (ISR) Timing accurate Single stack Two priorities: high priority foreground vs. background A. Walsch IN2244 WS2013/14 14

Context switch Context Switch Switch from one task to another (P1 to P2) Store P1 context (stack pointer if it is a multi-stack implementation, program counter, registers) if we switch stacks we need assembly language Restore P2 context Is there a natural context switch? If we work on one stack there is: function and interrupt calls save context automatically (the compiler does that for us): call instruction (taken from microchip.com) A. Walsch IN2244 WS2013/14 15

Calling Conventions Interrupts save context in their handlers stack frame dspic default: W0-W15 RCOUNT More on demand save parameter in case of dspic C30 compiler In case of the C30 compiler this also applies for functions called within an ISR We conclude: a timer-driven interrupt gives us timing accuracy and saves our context Source: microchip.com A. Walsch IN2244 WS2013/14 16

ISRs We can use an ISR to realize a light-weight scheduler: We can call different functions at different times (round-robin based on elapsed time to realize different cycle times) All tasks are C functions that run to completion We can put a background task into the while(1){...} loop in main. E.g. serial communication BUT: does not really work well if we do have different asynchronous sources of interrupt (e.g. timer and ADC) Why do we use our own scheduler at all? Cost of commercial OS Lack of certificate (if we need to certify we need to show that the OS meets the criteria of the certification) Therefore, a very simple scheduler might be a good alternative A. Walsch IN2244 WS2013/14 17

Code Example 10ms cycle 20ms cycle A. Walsch IN2244 WS2013/14 18

Simple Scheduler For multiple sources of interrupt we can realize a fixed-priority single-stack scheduler using plain C (compiler takes care of context) Every task is realized by a non-blocking (does not wait for external signal) thread of execution Once an IRQ is fired it is marked for execution (READY) and is run if no task of higher priority is currently running [external signal]/create task high address Task 1 READY PREEMPTED [highest priority]/run Task2 RUNNING [higher priority task READY ]/context switch [higher priority task RTC]/resume Task3 [task RTC]/ low address A. Walsch IN2244 WS2013/14 19

Example State-machine based task execution (no state for resource waiting) C compiler ISR handling takes over task switching Different interrupt sources (timer, ADC, etc) can trigger task creation (post event and mark task for execution) Refer to Build a super simple tasker http://www.state-machine.com/resources/articles.php A. Walsch IN2244 WS2013/14 20

Fault Models A fault model determines what possible effects of faults on the behaviour of a system model are considered Hardware fault models are established Software fault models mainly deal with corruption of data flow or control flow Special attention is on communication (inter-task or via networks) A. Walsch IN2244 WS2013/14 21

Fault Detection Fault detection is a series of activities that happen at startup, background (cyclic tests) and specific maintenance cycles CPU Memory (used one) IO Program sequence Basic method for fault detection evaluation is FMEA/FMEDA (hardware integrity and functionality) Time-critical test is cyclic background test since it checks physical resource during operation (must align to the process safety time specified in the systems requirements). A. Walsch IN2244 WS2013/14 22

Hardware Integrity Specific to safety-related systems in industrial domain (IEC61508-2) to achieve a higher DC -> influences PFD/PFH and architectural constraints What is a DC (diagnostic coverage)? Hardware failures can lead to hazardous system states (not good!) which can result in harm (very bad!) but they do not have to necessarily DC is the percentage of faults that are detected by checks; λ dd = λ d x DC/100 If we can avoid a dangerous system failure by detecting dangerous component faults (λ d ) in advance we can transfer λ d into λ s (if the application system allows for that). DC comes in four categories: no (<60%), low (60% < DC < 90%), medium (90% < DC < 99%), high (DC > 99%) A. Walsch IN2244 WS2013/14 23

Hardware Integrity Examples Source: IEC61508-2, general faults to be detected or analyzed A. Walsch IN2244 WS2013/14 24

Hardware Integrity Examples Invariable memory and variable memory Source: IEC61508-2 A. Walsch IN2244 WS2013/14 25

Hardware Integrity Examples IO Program sequence Source: IEC61508-2 A. Walsch IN2244 WS2013/14 26

Memory Parameter memory (non volatile) EEPROM byte wise read and write holds e.g. configuration parameters, run-time parameters (hour meter, status) Program memory (non volatile) Flash (NOR) word wise read, write requires a block erase - holds executable (XIP execute in place) Data memory (volatile) RAM (SRAM) word wise read and write addressable - holds data and stack A. Walsch IN2244 WS2013/14 27

Fault Detection - Memory Model- Memory matrix organization (1-bit n-bit) in reality one data word stored at a specific address address decoder, read and write amplifiers, control signals, data in and out low diagnostic coverage: stuck-at for data and/or address (constantly 0 or 1 ) medium diagnostic coverage: DC fault model for data and address (stuck-at, high-z, X-talk) A. Walsch IN2244 WS2013/14 28

Fault Detection - Non-variable Memory (program memory) - Modified checksum test, based on XOR and circular shift operations Defined checksum is compared to the checksum calculated during operation Odd-numbered bit errors within a column are detected Low diagnostic coverage test A. Walsch IN2244 WS2013/14 29

Fault Detection - Non-variable Memory (program memory) II - Signature of one word test (CRC), based on Modulo-2 arithmetic Memory content is interpreted as a bit stream Division by a defined polynomial yields zero, P(X) = 11001 in this example All one bit and multi-bit failures within one word and 99.6% of all possible bit failures are detected Medium diagnostic coverage test A. Walsch IN2244 WS2013/14 30

Fault Detection - Non-variable memory (EEPROM) - EEPROM content is copied to SRAM and verified during system initialization -> working copy All changes are made to working copy Working copy is written to EEPROM before power-down or at defined slow cycles (wear-out effect!) EEPROM test is reduced to a RAM test we work from RAM data A. Walsch IN2244 WS2013/14 31

Fault Detection - Variable memory (SRAM) - Checkerboard test low diagnostic coverage Cells are checked for correct content in pairs Initialization, upward test, downward test, inverse initialization, upward test, downward test -> 10 * n complexity (number of load store operations) Pairs are address inverse A. Walsch IN2244 WS2013/14 32

Fault Detection - Variable memory (SRAM) II - Walking pattern - medium diagnostic coverage Initialization (A), the first cell is inverted and all remaining cells are checked for correct content (B), the first cell is inverted again (C), the test is conducted again with inverse background (D) -> 2*n*n + 6*n complexity (number of load store operations) A. Walsch IN2244 WS2013/14 33

Fault Detection - Variable memory (Stack) - Stack data integrity is checked by correct program flow (the stack stores our task context) Stack limits are checked by signature or addresses (some controllers provide hardware support) Underlying hardware (SRAM) is checked by SRAM tests A. Walsch IN2244 WS2013/14 34

Fault Detection - Example - RAM tests are destructive therefore we need to safe the original data in advance A. Walsch IN2244 WS2013/14 35 bit flip

Communication - Error Detection - We usually use standard protocols to transmit data. Correctness is guaranteed by by error detection mechanisms (e.g. parity, CRC) Sometimes error detection capability not sufficient Hamming distance of n: n-1 bit errors can be detected. Residual error: If we do know the Hamming distance and do know the bit error rate (bit flips are statistically independent) we can calculate a residual error. CRC: an additional peace of data is added to the existing bit stream. The additional peace of data allows error detection Address 8 bit payload Data 128 bit transmitted data CRC 16 bit Source: A. Walsch IN2244 WS2013/14 Börcsök, HIMA 36

Communication - CAN - CAN: Controller Area Network, ISO 11898 (PHY, DLL) Protocol controller available as peripheral of embedded processors, line driver external (creates differential signals, adds protection circuits) Serial protocol, up to 1 Mbit/s Bit-wise arbitration Error detection Source: Softing A. Walsch IN2244 WS2013/14 37

Black Channel Source: MESCO Engineering, Forum Funktionale Sicherheit 2013 A. Walsch IN2244 WS2013/14 38

Proven in use Software (FAQs www.iec.ch) A. Walsch IN2244 WS2013/14 39