MotoHawk Training CAN Controller Area Network.

Slides:



Advertisements
Similar presentations
Contents Overview Data Information Frame Format Protocol
Advertisements

Transmitting & Receiving Contents  Hardware for Transmitting & Receiving:By Ryan Caulfield  Software for Transmitting & Receiving: By Todd John  Non-Computer.
University of Calgary – CPSC 441.  We need to break down big networks to sub-LANs  Limited amount of supportable traffic: on single LAN, all stations.
TCP-IP Primer David Cozens. Targets Have a basic understanding of Ethernet network technology Be aware of how this technology is applied on the 5000 series.
CPSC 441 TUTORIAL TA: FANG WANG HUBS, SWITCHES AND BRIDGES Parts of the slides contents are courtesy of the following people: Jim Kurose, Keith Ross:
CECS 474 Computer Network Interoperability Notes for Douglas E. Comer, Computer Networks and Internets (5 th Edition) Tracy Bradley Maples, Ph.D. Computer.
MotoHawk Training Model-Based Design of Embedded Systems.
An Engineering Approach to Computer Networking
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.1 Computer Networks and Internets with Internet Applications, 4e By Douglas.
The OSI Model A layman’s view of the internet. OSI Structure Application Presentation Session Transport Network Data Link Physical Each layer has a specific.
CS335 Networking & Network Administration Tuesday, May 11, 2010.
The OSI Model A layman’s view of the internet. OSI Structure Application Presentation Session Transport Network Data Link Physical Each layer has a specific.
Dave Mills CANbus: A brief introduction Incorporating: The Fujitsu status Dave Mills Queen Mary, University of London.
TCP: Software for Reliable Communication. Spring 2002Computer Networks Applications Internet: a Collection of Disparate Networks Different goals: Speed,
1 25\10\2010 Unit-V Connecting LANs Unit – 5 Connecting DevicesConnecting Devices Backbone NetworksBackbone Networks Virtual LANsVirtual LANs.
Local Asynchronous Communications. Bit-wise data transmission Data transmission requires: Encoding bits as energy Transmitting energy through medium Decoding.
Lecture 27: LM3S9B96 Microcontroller – Inter- Integrated Circuit (I 2 C) Interface.
Chapter 4 Queuing, Datagrams, and Addressing
This is the way an organisation distributes the data across its network. It uses different types of networks to communicate the information across it.
SERIAL BUS COMMUNICATION PROTOCOLS
The University of New Hampshire InterOperability Laboratory Serial ATA (SATA) Protocol Chapter 10 – Transport Layer.
Presented by Emil Melamed
CECS 5460 – Assignment 3 Stacey VanderHeiden Güney.
Presentation Title Subtitle Author Copyright © 2002 OPNET Technologies, Inc. TM Introduction to IP and Routing.
Computer Networking From LANs to WANs: Hardware, Software, and Security Chapter 12 Electronic Mail.
© 2008, Renesas Technology America, Inc. All Rights Reserved The RCAN-ET peripheral and the CAN API SH2 & SH2A MCUs V 1.2 Mar 2010.
Momentum 2009 Spyder® for Plant Control John Hutchey – Lou Jones.
In-Vehicle Networking for Heavy Duty Systems Review of CAN / SAE J1939/ ISO BAE 5030 Fall 2001 Instructor: Marvin Stone BAE 5030 Fall 2001 Instructor:
Chapter 7 Low-Level Protocols
Server Sockets: A server socket listens on a given port Many different clients may be connecting to that port Ideally, you would like a separate file descriptor.
PPT Slides by Dr. Craig Tyran & Kraig Pencil Computer Networking – Part 1 MIS 320 Kraig Pencil Summer 2014.
ES 101. Module 2 IP Addressing & Routing. Last Lecture Wide area networking Definition of “packets”
DEVICES AND COMMUNICATION BUSES FOR DEVICES NETWORK
Chapter 22 Q and A Victor Norman CS 332 Spring 2014.
TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_b Protocol Layering Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof.
Autonomous Helicopter James LydenEE 496Harris Okazaki.
© 2009, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction  Purpose This training course provides an overview of Message Frames.
1 © 2003, Cisco Systems, Inc. All rights reserved. CCNA 3 v3.0 Module 4 Switching Concepts.
1 Network Administration Module 3 ARP/RARP. 2 Address Resolution The problem Physical networks use physical addresses, not IP addresses Need the physical.
Chapter 7 ARP and RARP.
Chapter 9 Hardware Addressing and Frame Type Identification 1.Delivering and sending packets 2.Hardware addressing: specifying a destination 3. Broadcasting.
Chapter2 Networking Fundamentals
Lecture 3 Applications of TDM ( T & E Lines ) & Statistical TDM.
NETWORKING FUNDAMENTALS. Network+ Guide to Networks, 4e2.
McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Chapter 16 Connecting LANs, Backbone Networks, and Virtual LANs.
WEEK 11 – TOPOLOGIES, TCP/IP, SHARING & SECURITY IT1001- Personal Computer Hardware System & Operations.
Protocol Layering Chapter 11.
Extending LANs using Repeaters, Bridges, and Switches.
Optimization Problems in Wireless Coding Networks Alex Sprintson Computer Engineering Group Department of Electrical and Computer Engineering.
Role Of Network IDS in Network Perimeter Defense.
An Introduction to CAN CAN Basics 2 Renesas Interactive
1 Device Controller I/O units typically consist of A mechanical component: the device itself An electronic component: the device controller or adapter.
1 Network Communications A Brief Introduction. 2 Network Communications.
Networked Embedded Systems Pengyu Zhang EE107 Spring 2016 Lecture 8 Serial Buses.
Controller Area Network
Chapter 27 Network Management Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Sem 2 v2 Chapter 12: Routing. Routers can be configured to use one or more IP routing protocols. Two of these IP routing protocols are RIP and IGRP. After.
Powerpoint Templates Data Communication Muhammad Waseem Iqbal Lecture # 07 Spring-2016.
Deterministic Communication with SpaceWire
Chapter 9 ICMP.
Chapter 11: Inter-Integrated Circuit (I2C) Interface
Understand the OSI Model Part 2
Protocols and Layering
Chapter 7 ARP and RARP Prof. Choong Seon HONG.
CS4470 Computer Networking Protocols
An Engineering Approach to Computer Networking
Transport Layer 9/22/2019.
Network programming Lecture 1 Prepared by: Dr. Osama Mokhtar.
Objectives: 1.Identify different internet protocol (IP) 2.Configure sample of IP address 3.Appreciate and relate protocol in our life.
Presentation transcript:

MotoHawk Training CAN Controller Area Network

OUTLINE CAN Introduction CAN Physical Network CAN Message Format MotoHawk Block Walk Through MotoHawk “Post Office” MotoHawk Advanced CAN Blocks CAN Protocol Overview

INTRODUCTION CAN = Controller Area Network Communication specification implemented for automotive applications in the 1980s Often, the term “CAN” is misused CAN is a hardware definition for interoperability between modules CAN specification does not state the data content of a given message Protocols built on top of CAN state the data content (ex. J1939, GMLAN) MotoHawk doesn’t define a protocol, but allows access to the CAN hardware to implement a protocol By itself, CAN is not difficult (I mean it)

OUTLINE CAN Introduction CAN Physical Network CAN Message Format MotoHawk Block Walk Through MotoHawk “Post Office” MotoHawk Advanced CAN Blocks CAN Protocol Overview

PHYSICAL NETWORK Two wire robust serial communication Up to 1Mbps data rate which is limited by wire length 100 m @ 250Kbps 30 m @ 1Mbps Termination resistance required Maximum bandwidth 2000 messages per second @250Kbps 4000 messages per second @500Kbps 8000 messages per second @1Mbps Designed bandwidth should not exceed 70% of the maximum bandwidth CAN + CAN - Wire Length 120 Ω

PHYSICAL NETWORK Bus arbitration is handled with a simple strategy All modules on the bus attempt to transmit a message at the same time The message with the lowest address wins This strategy is handled at the hardware level Dominant Bits (0) vs. Recessive Bits (1) Multiple modules on the same bus cannot transmit the same address at the same time Module 0 continues to transmit while Module 1 waits for next opportunity to transmit Module 0 Module 1 T0 T1 T2 T3

OUTLINE CAN Introduction CAN Physical Network CAN Message Format MotoHawk Block Walk Through MotoHawk “Post Office” MotoHawk Advanced CAN Blocks CAN Protocol Overview

MESSAGE FORMAT A CAN 2.0B Message can contain up to 131 bits As application developers, 3 fields are important: 4 bits determine the length of the data (aka payload) (Range : 0-8) Up to 64 bits of data depending on data length ID Format Extended IDs are 29 bits Standard IDs are 11 bits Extended and Standard IDs can exist on the same bus at the same time Standard IDs have less message overhead (higher percentage of data per message)

OUTLINE CAN Physical Network CAN Message Format MotoHawk Block Walk Through MotoHawk “Post Office” MotoHawk Advanced CAN Blocks CAN Protocol Overview

CAN DEFINITION BLOCK First, the CAN hardware needs to be initialized Baud rate and transmit queue size configured If the baud rate and/or MotoTune protocol settings are not configured properly, then MotoTune can’t talk to the module via CAN (and therefore programming cannot be performed via CAN) Boot key sets CAN baud rate to 250kbps

Send CAN Raw Block

CAN Exercise #1 CAN Bus Test Construct a calibratable CAN message transmitter Use CANKing to monitor bus traffic System Diagram

CAN Exercise #1 Transmit a message using the Send CAN Raw Block on address 0x1F4. CAN 1 ID Type : Standard (0) Data Length : 8 Transmission Rate : 50 ms Use calibrations for visibility from MotoTune Change the Tx ID and note that the CAN bus traffic changes Change the Data and Data length and note that the traffic changes Use CANKing to debug any failed communication or monitor the bus traffic

OUTLINE CAN Introduction CAN Physical Network CAN Message Format MotoHawk Block Walk Through MotoHawk “Post Office” MotoHawk Advanced CAN Blocks CAN Protocol Overview

POST OFFICE CAN is the hardware layer, so how are transmitted messages sorted and filtered in MotoHawk? A Post Office is the simplest analogy Mailboxes Letters Addresses Zip Codes

POST OFFICE Many messages are transmitted on a bus at a given time, but a module may only be interested in a small subset Similar to a post office where the messages are letters and the software dispatcher is the postman A “mail box” in MotoHawk is called a “slot”

POST OFFICE A “slot” has an address known as a CAN ID similar to the address on a mailbox The MotoHawk post office needs to deliver messages to these slots How does it happen?

POST OFFICE Filtering is done with 2 masks ID Mask : Filters a message by the address or the ID Payload Mask : Filters a message by the data content A mask is similar to assigning a “Don’t Care” or a “Do Care” to a particular number in the mask

Filtering Filtering is done with 2 masks ID Mask : Filters a message by the address or the ID Payload Mask : Filters a message by the data content A ‘1’ in the mask means that the data and the value must match exactly For example, if ID mask = 0x7F0 (111 1111 0000) and ID = 0x7E4 (111 1110 0100) If incoming ID = 0x7E0, (111 1110 0000) message goes to mailbox If incoming ID = 0x7F4, (111 1111 0100) x message is rejected by mailbox If incoming ID = 0x7E1, (111 1110 0001)

READ CAN RAW BLOCK

POST OFFICE The “Slot Name” is the name of the mailbox at the post office The slot has default settings for the ID, ID Mask, Payload Value, and Payload Mask This is the design time mailbox configuration

POST OFFICE The properties of the mailboxes can be changed at run time The filters determined at design time can be strengthened (more restrictive), but cannot be weakened In MotoHawk, the CAN Receive Slot Properties Block allows the user to change the filters at run time

POST OFFICE What happens if the postal worker rings your doorbell to deliver a message? This is an asynchronous reception of a message The advantage is that processing time can be saved by not periodically polling this message How does MotoHawk handle this situation? Asynchronous reception processed with CAN Receive Slot Trigger Block Slot name in this block must match the slot name specified in Read CAN Raw block or Read CAN Message block

OUTLINE CAN Introduction CAN Physical Network CAN Message Format MotoHawk Basic Transmit Block Exercise MotoHawk “Post Office” MotoHawk Advanced CAN Blocks CAN Protocol Overview

MOTOHAWK ADVANCED CAN The Read and Send CAN blocks are nice, but sometimes more advanced data parsing is necessary. Common questions: I have 12 bit scaled data that spans across multiple bytes. How do I convert it into engineering units? I have more data that can fit into 64 bits. How do I create multi-page messages? I’m using a protocol that has a variable ID. How do I dynamically create the ID easily? These are valid questions and there is an answer…

MOTOHAWK ADVANCED CAN MotoHawk has 2 blocks – Read CAN Message and Send CAN Message (below) These are very powerful blocks that allow users to set up multi-page documents and parse and scale both variables and IDs

MOTOHAWK ADVANCED CAN >> edit motohawk_can_example.m Type this command in your MATLAB command prompt. I will do the same.

LITTLE ENDIAN vs BIG ENDIAN Terminology originates from “Gulliver’s Travels” “Endianness” refers to the order in which bytes are stored in memory This table shows the 4 byte storage for 1025 (0x41) Address Big Endian Representation Little Endian Representation 00 0000 0000 0000 0001 01 0000 0100 02 03 By default, the MotoHawk CAN scripts use Big Endian byte ordering…which can lead to confusion

LITTLE ENDIAN vs BIG ENDIAN Given this CAN definition byte ordering for a 4 byte variable: Big Endian MSB Little Endian LSB 63...….56 55...….48 47...….40 MSB 39...….32 LSB Now, go let’s back to the script definition…

OUTLINE CAN Introduction CAN Physical Network CAN Message Format MotoHawk Basic Transmit Block Exercise MotoHawk “Post Office” MotoHawk Advanced CAN Blocks CAN Protocol Overview

PID ECU 2 ECU 1 CLASS EXERCISE Create a distributed control system to control the ETC over CAN Pedal Duty Cycle PID Analog signal from potentiometer CAN message send TPS % City ID 0x81 ECU 2 CAN message receive TPS % TPS % Analog signal from ECT CAN message send City ID 0x0B Duty Cycle Duty Cycle ECU 1 CAN message receive PWM output

CLASS EXERCISE Duty Cycle message definition CAN 1 ID Type : Standard (0) ID : 0x1F4 Data Length : 2 Bytes Transmission Rate : 10 ms Data Field Duty Cycle (SIGNED) Scale : 200/65,535 Offset : 0 Start bit: 48 Size: 2 bytes TPS Percent message definition ID : 0x2F4 Data Length : 1 Byte Transmission Rate : 15 ms TPS Percent (UNSIGNED) Scale : 100/255 Start bit: 56 Size: 1 byte

PROTOCOL OVERVIEW CAN gets complicated when protocols are considered J1939, SmartCraft, CCP, GMLAN, etc. are all examples of protocols that adhere to strict rules These protocols can be implemented using Simulink and/or Stateflow Some message formats (J1939) have already been implemented for other projects

MotoTron Control Solutions Production Controls in a Flash   MotoTron Control Solutions Production Controls in a Flash