Article count:1511 Read by:4580472

Account Entry

Automotive Ethernet Basics - EthIf

Latest update time:2023-03-23
    Reads:
Preface

First of all, I would like to ask you a few small questions. Do you know:

  • Do you know what the main function of the EthIf module is?

  • What is the relationship between EthIf and Ethernet controllers, Ethernet transceivers, and Ethernet gateways?

  • What are the common function interfaces of Ethif?

Today, let’s explore and answer these questions together. In order to facilitate everyone's understanding, the following is the topic outline of this article:


text

As we know about the CanIf module, as a CAN transceiver, the unified upper-layer ECU abstraction of the CAN controller allows us to decouple the upper-layer application module of CanIf from the underlying hardware, greatly increasing the portability of the software.

The same is true for automotive Ethernet. The AUTOSAR organization has implemented the software architecture distribution of the automotive Ethernet protocol stack according to the same methodology. Among them, EthIf and CanIf have the same role and status, both of which are to realize the underlying hardware such as Ethernet controller and The upper-layer abstraction of the Ethernet transceiver facilitates decoupling of software and hardware, greatly improving software reusability.

Next, we will explain to you the hierarchical relationship, main functions and common function interfaces of the AUTOSAR EthIf module.

Module hierarchy

According to the AUTOSAR standard document specification, the specific location of the EthIf module in the entire software architecture is described in Figure 1 below:


Figure 1 The relationship between EthIf and the Ethernet protocol stack

As shown in the figure above, the following basic conclusions can be drawn:

  • There can be Ethernet controllers from multiple suppliers in an Ethernet protocol stack, and each supplier's controller can be controlled independently without affecting each other;

  • There can be multiple Ethernet controllers from the same supplier, but only the same set of Ethernet controller drivers can be used;

  • The Ethernet drivers from the above three different vendors are part of the standard AUTOSAR MCAL and can be fully decoupled from the underlying hardware;

Ethernet controller relationships

In view of the coexistence of Ethernet controllers from multiple vendors, the AUTOSAR EthIf module implements unified management and implementation based on this situation, which can greatly improve the reuse efficiency of the same driver.

As shown in Figure 2 below, it clearly shows the mapping relationship between the EthIf software module and the Ethernet controller driver under the premise of different Ethernet controllers.

Through analysis, it was found that the following index mapping relationship exists between them. This mapping relationship will ensure that the EthIf module can uniquely and accurately control each controller module. The specific Mapping rules are as follows:

  • The EthIf software module has a globally unique number index for each Ethernet controller within it. The index starts from 0, as shown in the number represented by EthIf_CtrlIdx, which is globally unique;

  • For the same type of Ethernet controller, the corresponding Ethernet driver carries out an index number starting from 0 in its software internal module. As shown in the figure below, there are two Ethernet controllers of the same type, so the index numbers are 0 and 1 respectively. The globally unique index of the EthIf module does not conflict;

  • For different types of Ethernet controllers, the corresponding internal index of the corresponding driver module should also start from 0, regardless of whether other types of Ethernet drivers coexist;


Figure 2 Relationship between EthIf module and Ethernet controller

Ethernet transceiver relationships

As shown in Figure 3 below, the Ethernet transceiver and the EthIf module have the following corresponding Mapping relationship, which can be summarized as follows:

  • Ethernet transceivers of the same type can use the same Ethernet transceiver driver (Phy driver for short);

  • Different types of Ethernet transceivers should use different Ethernet transceiver drivers;


Figure 3 The relationship between the EthIf module and the Ethernet transceiver driver

As shown in Figure 4 below, comparing the relationship between the Ethernet controller and EthIf, we can also see the index mapping relationship between the Ethernet transceiver and EthIf:

If there are multiple transceivers of the same type in the Ethernet transceiver driver, they should be numbered internally starting from 0 to indicate their uniqueness;


Figure 3 Ethernet transceiver numbering relationship

Ethernet Switch relationship

Figure 4 below shows the Index relationship between Ethernet Switch and EthIf:

  • Use the same driver for the same type of Ethernet gateway;

  • Ports within the same Ethernet gateway will also be counted from 0 according to index. Port numbers within different Ethernet gateways are independent of each other and do not interfere with each other;

Figure 4 Ethernet Switch numbering relationship

Module main function

As an abstraction layer for the underlying hardware driver, the EthIf module in the AUTOSAR standard has the following basic functions:

  • Complete the communication initialization function and create basic conditions for data sending and receiving;

  • It has the data sending function and provides interfaces to upper-layer applications to realize the normal sending of data;

  • It has the data receiving function and provides interfaces to upper-layer applications to realize the normal reception of data;

  • It has the underlying Phy Link status change management function and can monitor the status of the underlying Phy in a timely manner;

Next, we will describe the above four basic functions of the EthIf module, so that everyone can further understand the basic working principle of the EthIf module.

Communication initialization function

As shown in Figure 5 below, the necessary prerequisite for establishing communication between EthIf and the underlying driver is described, that is, the Eth controller and Eth transceiver need to be initialized by calling the EthIf_Init function;


Figure 5 Eth hardware initialization process

As shown in Figure 6 below, the relationship between EthSM, EthIf, Eth, and EthTrcv is described. EthSM implements the initialization of the Ethernet controller by calling the function EthIf_SetControllerMode of the EthIf module . At the same time, the Eth module will determine whether the initialization is successful through the callback function. Flag informs the EthSM module.

Then EthSM will call the function EthIf_SetTransceiverMode of the EthIf module to initialize the Eth transceiver. The Eth transceiver will inform the EthSM module through the callback function whether the initialization is successful;


Figure 6 EthIf module communication initialization process

Data sending function

The data sending function of the EthIf module is divided into two modes, one is Polling mode, and the other is Interrupt mode. Generally speaking, the interrupt mode is preferred to meet the real-time requirements of the system.

Figure 7 below shows the Polling mode. In the Polling mode, you can see that the EthIf_MainfunctionTx function will poll whether the transmission is successful. This is also a typical feature of the Polling mode.

Polling mode


Figure 7 EthIf data sending Polling mode

Interrupt mode

Figure 8 below shows the interrupt mode for Ethernet data transmission. Compared with the Polling mode, it can be seen that the EthIf_MainfunctionTx function is not used in the interrupt mode. Instead, the interrupt function of the Eth module is used to confirm whether the transmission is successful.


Figure 8 EthIf module data sending interrupt mode

Data receiving function

Similarly, compared with the data sending function, the data receiving function of the EthIf module can also be divided into Polling mode and interrupt mode. Figure 9 below shows the data receiving Polling mode of the EthIf module.

As shown in Figure 9 below, if the EthIf module data reception adopts Polling mode, then you need to use the EthIf_MainfunctionRx function. In this function, call EthIf_RxIndication to inform the upper layer that the data has been successfully received. Using this mode will greatly reduce the data reception efficiency. Generally , Interrupt mode is used first for reception .

Polling mode


Figure 9 EthIf module data receiving Polling mode

Interrupt mode

Figure 10 below shows the data reception interrupt function of the EthIf module. In this mode, you can see that the Eth module uses the interrupt function to inform the upper layer that the data has been received.


Figure 10 EthIf module data reception interrupt mode

Link status change management function

As shown in Figure 11 below, it is described that in the EthIf_MainfunctionRx function, the Link status of the transceiver is notified to the upper layer application by calling EthTrcv_GetLinkState of the EthTrcv module.


Figure 11 EthIf module Link status change monitoring

VLAN support

The EthIf module must support the VLAN function. This mode will classify VLAN as a virtual controller. The Ethernet driver and Ethernet transceiver will only target the real controller and transceiver, regardless of the VLAN feature.

If there is no valid VLAN ID set, the virtual controller will represent an untagged VLAN, and the EthIf module will use the Buffer provided by the Eth driver to support the VLAN function.

Wake up support

The EthIf module must be implemented by configuring EthIfWakeUpSupport . At the same time, the premise for Wakeup to be effective is that the underlying Ethernet transceiver (Phy) needs to support the sleep wake-up function .

Commonly used function interfaces

In order to facilitate everyone's debugging, Xiao T summarizes the commonly used functions of the EthIf module as follows:


Figure 12 Common function interface description
END



Latest articles about

 
EEWorld WeChat Subscription

 
EEWorld WeChat Service Number

 
AutoDevelopers

About Us Customer Service Contact Information Datasheet Sitemap LatestNews

Room 1530, Zhongguancun MOOC Times Building,Block B, 18 Zhongguancun Street, Haidian District,Beijing, China Tel:(010)82350740 Postcode:100190

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号