embedded networks

21
Embedded Networks Gökhan URUL

Upload: gokhan-urul

Post on 13-Apr-2017

156 views

Category:

Engineering


0 download

TRANSCRIPT

Page 1: Embedded networks

Embedded NetworksGökhan URUL

Page 2: Embedded networks

Computer Networks• Client/Server Model

• File server A computer that stores and manages files for multiple users on a network

• Web server A computer dedicated to responding to requests (from the browser client) for web pages

• Local-area network (LAN) A network that connects a relatively small number of machines in a relatively close geographical area

Page 3: Embedded networks

Types of Networks

• Ring topology A configuration that connects all nodes in a closed loop on which messages travel in one direction

• Star topology A configuration that centers around one node to which all others are connected and through which all messages are sent

• Bus topology All nodes are connected to a single communication line that carries messages in both directions• Ethernet • CANBus

Page 4: Embedded networks

OSI Layer

Upper Layers

Lower Layers

Middle Layer

7. Application

6. Presentation

5. Session

4. Transport

3. Network

2. Data Link

1. Physical

• Open Systems Interconnection (OSI)

Page 5: Embedded networks

OSI Katmanı

Page 6: Embedded networks

OSI Layer

7. Application

6. Presentation

1. Physical

Node A

Data Out

Data InTo/from Node B

Page 7: Embedded networks

Layer Mimarisi ve Gerçek Haberleşme

7. Application

1. Physical

7. Application

1.Physical

Node a Node b

Page 8: Embedded networks

Layer Mimarisi ve Sanal Haberleşme

7. Application

3. Network

7. Application

3. Network

Page 9: Embedded networks

Wireshark

Page 10: Embedded networks

RS232 Seri Haberleşme

• Bilgisayar ve çevre birimleri• Askeri birimlerde çoğunlukla• Eski bir teknoloji• Çeşitli hızlarda 9600, 115200 Baudrate• Haberleşme çeşidi: Stream byte• Windows üzerinde ortak•

Page 11: Embedded networks

RS422/485 Seri Haberleşme

• Bilgisayar ve çevre birimleri• Askeri birimlerde çoğunlukla• Çeşitli hızlarda 9600, 115200,

968000 Baudrate(bit/second)• Haberleşme çeşidi: Stream byte • Windows üzerinde ortak

Page 12: Embedded networks

RS232 – RS422 Seri Haberleşme Programlama

• http://www.codeproject.com/Articles/678025/Serial-Comms-in-Csharp-for-Beginners

public static void Write() { _serialPort. Write(0x65); }

public static void Read() { while (_continue) { try { string message = _serialPort.ReadExisting(); Console.WriteLine(message); } catch (TimeoutException) { } } }

using System.IO.Ports; public class PortChat { static SerialPort _serialPort; public static void Main() { _serialPort = new SerialPort(); // Seri kanal özellikleri ayarlanır. _serialPort.PortName = SetPortName(“COM1”); _serialPort.BaudRate = SetPortBaudRate(“9600”); _serialPort.Parity = SetPortParity(“NONE”); _serialPort.DataBits = SetPortDataBits(“8”); _serialPort.StopBits = SetPortStopBits(“1”); // Geçerlilik süreleri ayarlanır. _serialPort.ReadTimeout = 500; _serialPort.WriteTimeout = 500; _serialPort.Open(); readThread.Start();

}

}

Page 13: Embedded networks

CANBus Haberleşme• Bus topology• The CAN protocol uses a

modified version of the Carrier Sense Multiple Access/Collision Avoidance (CSMA/CA) technique used on Ethernet

Page 14: Embedded networks

CANBus Haberleşme• Uses  a single terminated twisted pair cable• Is multi master• Maximum Signal frequency used is 1 Mbit/sec• Length is typically 40M at 1Mbit/sec up to 10KM

at 5Kbits/sec• Has high reliability with extensive error checking• Typical maximum data rate achievable is

40KBytes/sec• Maximum latency of high priority message <120

µsec at 1Mbit/sec

Page 15: Embedded networks

CANBus Haberleşme Yöntemi• Start of frame   (SOF)• Message Identifier  (MID)     the Lower the value the Higher the priority of the message

                 its length is either 11 or 29 bits long depending on the standard being used• Remote Transmission Request (RTR) = 0  ----- see "Remote Frames" para below for non

zero value• Control field  (CONTROL)  this specifies the number of bytes of data to follow (0-8)• Data Field (DATA) length 0 to 8 bytes• CRC field  containing a fifteen bit cyclic redundancy check code• Acknowledge field  (ACK)   an empty slot which will be filled by any and every node that

receives the frame                 it does NOT say that the node you intended the data for got it, just that at least one node on the whole network got it.

• End of Frame   (EOF)

Page 16: Embedded networks

CANBus OSI Layer

Page 17: Embedded networks

CANBus Programming• IXXAT

• Lawicel

Beschreibung VCI V2 VCI V3

Board selection

XAT_SelectHardware

XAT_EnumHwEntry

XAT_FindHwEntryXAT_GetConfig

vciSelectDeviceDlg

vciEnumDeviceOpenvciEnumDeviceNe xtvciEnumDeviceClose

vciFindDeviceByHwidvciFindDeviceByCla ss

Board initialization VCI2_PrepareBoard vciDeviceOpenBoard info VCI_ReadBoardInfo vciDeviceGetInfoCAN controller initialization VCI_InitCan canControlOpen

canControlInitializeCAN message filter VCI_SetAccMask canControlSetAccFilterCAN status VCI_ReadCanStatus canControlGetStatus

CAN channel initialization

VCI_ConfigQueue(Tx)VCI_ConfigQueue(Rx)VCI_AssignRxQueO bj

canChannelOpencanChannelInitializecanChannelActivate

CAN channel status VCI_ReadQueStatus canChannelGetStatusCAN controller start VCI_StartCan canControlStart

CAN message transmission

VCI_TransmitObjVCI_RequestObj

canChannelSendMessageandcanChannelPostMessage

CAN message receiving

VCI_ReadQueObj(Receive-Callbacks)

canChannelReadMessageorcanChannelWaitRxEventcanCha nnelPeekMessage

Cancel board VCI_CancelBoardcanChannelClosecanControlClosevciDeviceClose

Page 18: Embedded networks

CANOpen• Özellikleri

• CANopen a subset from CAL (CAN Application Layer) developed by CiA! • Auto configuration the network • Easy access to all device parameters • Device synchronization • Cyclic and event-driven data transfer • Synchronous reading or setting of inputs, outputs or parameters

• Uygulamalar• Machine automatisation

• Avantajları• Accommodating the integration of very small sensors and actuators • Open and vendor independent • Support s inter-operability of different devices • High speed real-time capability

Page 19: Embedded networks

CANOpen

• Object Dictionary

• Message Types• Service Data Objects (SDOs)• Process Data Objects (PDOs)• Network Management (NMT) • Guarding and Heartbeats• Emergency Messages

Page 20: Embedded networks

CANOpen

Page 21: Embedded networks

CANOpen / PDO , SDO, • Types

• transfer PDOs (TPDOs)• receive PDOs (RPDOs)

• Specs• Event driven• Sync based• polling• Time driven

• Detaylı CanOpen mesajlaşmaları için: CanOpen_Manual.pdf• Canopen Basics: CANopen Seminar.pdf