embedded networks
TRANSCRIPT
Embedded NetworksGökhan URUL
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
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
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)
OSI Katmanı
OSI Layer
7. Application
6. Presentation
1. Physical
Node A
Data Out
Data InTo/from Node B
Layer Mimarisi ve Gerçek Haberleşme
7. Application
1. Physical
7. Application
1.Physical
Node a Node b
Layer Mimarisi ve Sanal Haberleşme
7. Application
3. Network
7. Application
3. Network
Wireshark
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•
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
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();
}
}
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
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
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)
CANBus OSI Layer
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
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
CANOpen
• Object Dictionary
• Message Types• Service Data Objects (SDOs)• Process Data Objects (PDOs)• Network Management (NMT) • Guarding and Heartbeats• Emergency Messages
CANOpen
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