Know About AUTOSAR Ethernet Communication Stack
Tags: autosar, ethernet, autosarethernetstack, ethernetcommunicationstack
Published: 2022-10-13 07:33:49


![Know About AUTOSAR Ethernet Communication Stack](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/av60eqzydk1vsbuzvg6e.png) 
Hi folks, I'm Anil Das employee of **LUXOFT India**. Here I would like to provide a brief knowledge about AUTOSAR Ethernet Communication Stack.

The **Ethernet Communication Stack** in the **AUTOSAR** specifications includes many modules. Covering all the modules is beyond the scope of this article (definitely in some other article) so I will cover four of those. Please make sure to leave a comment if you have any questions.

## **AUTOSAR Ethernet Communication Stack:**
Instead of entering jumping directly to the Ethernet stack, Let's try to answer the question: **"What is Communication Stack (Com Stack)"?**  Communication Stack is a set of segments that we call modules that helps in communication between different components via a channel. It consists of three layers, each layer having different modules for different communication protocols and peripherals. They are:

1. Communication Services Layer
2. Communication Hardware abstraction layer
3. Communication Drivers

Let's not dive into these topics here (to avoid diversion from the current topic) but in another article (soon) on AUTOSAR Architecture.

Ethernet Stacks have so many modules and sub-modules in them, Let's go through them one by one.

### **Com Module:**

•	To provide access to signals or groups of signals and PDUs to the application module and vice-versa to perform or execute the task (main functionality of the COM module).
•	Com module is interfaced with the PDUR (Protocol Data Unit router) module, and this one is a second top-level module of the AUTOSAR COM Stack.
•	It handles signals-level access to Application layers and PDU-level access to lower layers.
•	It is responsible for packing and unpacking PDUs, which means the COM module packs the signals to PDUs during transmission from the application to lower layers and unpacks the received PDUs from PDUR, and provides signal-level access to the application layer at the receiver. 
•	And it is also responsible for the grouping of the PDUs, Communication transmission control (stop/start of I-PDU groups), and Byte order conversion.
•	Com module and PDUR module both are a part of the COM Services.
•	To receive or transmit the signals/PDUs, an application layer should be called by the COM module AUTOSAR API and it never calls lower-level modules directly.
•	All the PDUs and signals-related configurations will be done in the COM module.

![Flow of Com Module](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/942lnx8csxko4udt0743.png)


### PDUR (Protocol Data Unit Router) Module:

•	The main functionality of this module is routing the PDU (Protocol Data Unit) from the source module to its exact destination module.
•	PDUR is the second level module (just below COM as shown in the fig) in AUTOSAR COM Stack for all communications protocol stacks.
•	PDUR will be interfaced with the DCM module and COM module of AUTOSAR along with SoAd (Socket Adapter) and DoIP (Diagnostic Over IP) in the below lower layers of the stack.
•	A configurable routing table with information about PDUs is also present in this module.

![Flow of PDUR](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/knhe88ljy556j8tv15us.png)

### Socket Adapter (SoAd) Module:
•	A Socket is uniquely identified by the combination of IP addresses and ports of remote and local network nodes.
•	By using socket, packet-oriented UDP (User Datagram Protocol), and connection-oriented TCP (Transmission Control Protocol) user data are routed from the TCP/IP stack module to the application layer and vice-versa.
•	Transformation of socket-based communication into PDU-based communication and vice-versa is the functionality of the Socket Adapter module (SoAd).
•	The main purpose of the Socket Adapter module (SoAd) is to interconnect or provide an interface to the upper layer PDU-based module (PDUR) and the lower layer socket-based TCP/IP stack module.
•	It also maps the I-PDU Id with the socket-based connection.
•	Socket Adapter (SoAd) adds the socket header in PDU and sends it to the lower layer of the stack and when data arrives from the lower layer it removes the header and sends it to the upper layers of the stack.
•	For efficient communication via ethernet protocol multiple I-PDUs mapping to a single socket-based connection is possible.

![Flow of Socket Adapter](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/soo1yvgzy3gn5xv1y2l7.png)

### Service Discovery (Sd): (As per AUTOSAR SWS documents)

•	AUTOSAR Service Discovery module offers functionality to detect and provide available services i.e. functional entities (Methods/functions) within the vehicle network. To achieve that, it makes use of the IP Multicast and so-called SOME/IP-SD messages.
•	Service Discovery module (Sd) is positioned in between the AUTOSAR Socket Adaptor module (SoAd) and the AUTOSAR BSW Mode Manager module (BswM).

![Flow of Service Discovery](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s1itg1dvgy2s0he6ypbp.png)

•	The main functionality of the Service Discovery Module is managing the availability of functional entities called services in the in-vehicle communication and controlling the transmission behavior of event messages. This function is allowed to send only event messages to receivers (Publish/Subscribe).
•	The process described above is called SOME/IP-SD (Scalable Service-Oriented Middleware over IP – Service Discovery).
•	Service Instances are single implementations of a service that is defined by its service interface (specification in layman's terms).
•	The status of Service Instances in the Service Discovery can control transmission of special messages called events.
•	These events are grouped into Event groups, which the Service Discovery can turn on/off in a Publish/Subscribe manner.

### Conclusion:
 If you are here and reading this, means you have completed some modules of AUTOSAR ethernet communication stack today. You have covered AUTOSAR COM Module, AUTOSAR PDUR Module, AUTOSAR Socket Adapter (SoAd), and AUTOSAR Service Discovery (Sd).
 Hurray!!!. Cheers!!!
But still, a long way to go since there are a lot of modules in the Ethernet Stack. Thank you for reading and hope you have enjoyed it as well. Stay tuned for updates regarding my next articles (by subscribing). Feel free to comment with your questions.