To download the PDF version click here: EthernetSetup_AN.pdf
Table of Contents
Introduction
Scope
This document describes how to setup a basic configuration in RTA-BSW for Ethernet networking.
The document presents an example configuration for Eth, EthIf, EthSM, TcpIp and SoAd.
UdpNm module is not in the scope of the current version of this document.
Assumptions
It is assumed you have an ISOLAR-AB project with COM communication over a CAN network, such as a RTA Starter Kit project.
The following ETAS tools were used for this Application Note.
RTA-CAR 7.0.1 toolchain | |
---|---|
ISOLAR-AB | v 7.0.1 |
RTA-RTE | v 6.8.0 |
RTA-BSW | v 5.1.0 |
Combinations of other tool versions may or may not work with this Application Note.
Limitations
RTA-BSW does not support importing of Ethernet frames. Therefore this AN will not cover this part of a full AUTOSAR configuration.
Acronyms and abbreviations
Acronyms/Abbreviations | Description |
---|---|
ARP | Address Resolution Protocol |
DHCP | Dynamic Host Configuration Protocol |
ICMP | Internet Control Message Protocol |
NDP | Neighbor Discovery Protocol |
SoAd | Socket Adaptor |
TCP | Transmission Control Protocol |
TCP/IP | A family of communication protocols used in computer networks |
TP | Transport Protocol |
UDP | User Datagram Protocol |
Ethernet stack overview
The following is an overview of the Ethernet stack
The TcpIp module is the core and the main implementation of the ethernet stack. EthIf is the interface between the MCAL driver, the EthTrcv and the TcpIp stack.
The Socket Adaptor is the interface between the TcpIp stack and the PduR.
RTA-BSW provides all the module except the Eth Driver which is part of the MCAL layer.
RTA-BSW documentation
RTA-BSW Reference Guide provides configuration and integration advices for few modules (EthIf, EthSM, TcpIp, SoAd) which are not details in this document. Please refer to each module's section for more information during integration.
Eth module
Infineon MCAL was used for this project.
The most important parameters for the Eth Driver configuration are the following:
- EthSpeed: to configure the Ethernet Speed (10Mbps, 100Mbps, 1Gbps)
- EthOpMode: to configure the duplex mode (HALF or FULL duplex)
- EthPhyInterface: to configure the mechanism used to communicate between the Ethernet MAC controller and the PHY controller
- EthCtrlPhyAddress: contains the MAC address of the controller (00:03:19:00:00:01 in our case)
If interrupt mode is used for the Ethernet controller, interrupts will have to be enable in both driver and RTA-OS.
- EthCtrlEnableRxInterrupt and EthCtrlEnableTxInterrupt: to enable receive and transmit interrupt
Note: the folllowing MCAL modules will have to be updated
- Mcu configuration to generate Eth controller clock
- Port configuration to configure each port used for communication with the PHY controller (MII/RMII/RGMII and MDIO signals).
- Irq (optional, if using interrupts) Irq configuration as well as interrupt vectors configuration in RTA-OS
Please refer to MCAL documentation for more details.
Eth duplicate module
For generation purpose, it is required to duplicate the Eth configuration inside ISOLAR-AB. This duplicated configuration will be used during generation of EthIf and EthTrcv configuration files.
Eth Integration
A BSWMD file should be provided to the system description for RTE generation:
- periodic call to MainFunction, with period equal to the period configured in the MCAL
- vendorId and vendorApiInfix for RTE generation with the right function call
Note: the MainFunction can be used for diagnosis reporting only
EthTrcv module
The EthTrcv controls the following features of the PHY controller:
- Transceiver mode
- Baudrate configuration
- Auto negotiation configuration
- Report link status
- Wakeup feature
- PHY diagnostic
EthTrcv configuration
The following configuration was used in the example project.
EthTrcv generated code
RTA-BSW generates a configuration file EthTrcv_PBCfg.h which contains a list of steps being executed in order to configure the selected EthTrcv. For each supported EthTrcv, RTA-BSW generates a different list of steps and configuration based on the transceiver requirements.
EthTrcv Integration
The folder EthTrcv/integration contains files that should be reviewed and adapted to your system:
- EthTrcvCfgSchM.h should be populated with required locking/unlocking configuration
- EthTrcvCfgTime.h should be populated to provide a timing measurement according to your system
- EthTrcv_MemMap.h should be reviewed and adapt according to project specific requirements
The PHY controller supports one of the following Media Independant Interface: MII, RMII or RGMII for transmission and reception of Ethernet frames. The Media Independent Interface is used by the Eth driver for reception and transmission. It does also support MDIO interface for PHY configuration and status report which is used by the EthTrcv module.
EthTrcv module uses the following routines from the Eth driver to interface with the PHY controller:
- Eth_WriteMii
- Eth_ReadMii
An integration file should define the routines above to call coresponding MCAL routines.
RTA-BSW generates BSWMD files for the EthTrcv module that contains periodic schedulable entity definition for EthTrcv_MainFunction. The associated runnable should be mapped to a task during integration.
EthIf module
EthIf configuration
The EthIf layer is the link between the Ethernet controller, Eth PHY transceiver and the TcpIp stack.
EthIf integration
The folder EthIf/integration contains files that should be reviewed and adapted to your system.
RTA-BSW generates BSWMD files for the EthIf module that contains periodic schedulable entities definition. The associated runnables should be mapped to a task during integration.
RTA-BSW Reference Guide provides integration advices for EthIf module.
EthSM module
The EthSM operate with EthIf to control one or multiple underlying Ethernet Controllers and Ethernet Transceiver Drivers.
An example configuration can be seen below:
EthSM integration
RTA-BSW generates BSWMD files for the EthSM module that contains periodic schedulable entity definition for EthSM_MainFunction. The associated runnable should be mapped to a task during integration.
TcpIp module
The TcpIp module is composed by multiple modules which are integrated all together to form the TcpIp implementation. Each module implements a particular feature of the stack and is generated only if the feature is enabled.
The TcpIp modle is composed by:
Rba_EthArp and Rba_EthNdp
Rba_EthAutoIp
Rba_EthDHCP
Rba_EthICMP
Rba_EthIPv4 and Rba_EthIPv6
Rba_EthUdp
Rba_EthTcp
The build tool chain should build the module if generated by RTA-BSW.
TcpIp configuration
The TcpIpGeneral configuration configures the stack capability.
TcpIpScalabilityClass configures the use of TcpIp V4 and/or TcpIp V6.
TcpIpUdpSocketMax and TcpIpTcpSocketMax will define the number of maximum Tcp and Udp socket allowed in the configuration. Those parameters have an impact on the stack memory footprint.
The TcpIpCtrl container refers to the EthIf controller.
Only one parameter is required to configure the UDP layer in TcpIpUdpConfig.
The TcpIpTcpConfig configures the behavior of the TCP connection if required.
The local IP address can be configured statically or requested to a DHCP server.
When configured statically, local IP address and port are defined in the TcpIpStaticIpAddressConfig container.
TcpIp integration
RTA-BSW generates BSWMD files for the TcpIp module which contains a periodic schedulable entity definition for TcpIp_MainFunction. The associated runnable should be mapped to a task during integration.
SoAd module
The main purpose of the Socket Adaptor module is to create an interface between an AUTOSAR communication service module using PDUs (e.g. PDU Router) and a socket based TCP/IP stack. It will map I-PDU IDs to socket connections and vice versa. [AUTOSAR Specification of Socket Adaptor 4.2.2]
AUTOSAR defined a predefined list of SoAd upper layer modules:
- PDU router (PduR)
- UDP Network Manager (UdpNm)
- XCP on Ethernet (Xcp)
- Service Discovery (Sd)
- Diagnostics over IP (DoIP)
SoAd configuration
The maximum number of connection allowed will be defined in SoAd general. It will then affect the size of the memory allocated by the module.
The first part in configuring the SoAd, is to define which module will be transmitting an/or receiving Ethernet frames. In this example, the PduR will be the only uppe rlayer module using SoAd.
For the transmission of an upper layer module PDU via an UDP or TCP socket, the SoAd configuration specifies a PDU route which is linked to a socket connection. A PDU route (SoAdPduRoute, SoAdPduRouteDest) describes the route from an upper layer module of the SoAd to the related socket of the TcpIp stack which is described by the socket connection (SoAdSocketConnection, SoAdSocketConnectionGroup).
Here is an example configuration for a UDP transmission socket:
Here is an example configuration for the same UDP socket in reception
Note: when the parameter SoAdSocketConnectionGroup/SoAdSocketAutomaticSoConSetup is set to true, the connection will be automatically opened and closed during startup and shutdown.
SoAd integration
RTA-BSW generates BSWMD files for the SoAd module that contains periodic schedulable entity definition for SoAd_MainFunction. The associated runnable should be mapped to a task during integration.
UdpNm module
This optional module can be used to manage the Ethernet Network.
This is currently not covered by this AN.
ComM module
ComM configuration
The ComM module is used to manage the communication on the Ethernet bus. A new ComM channel should be configured in order to control the Ethernet bus status according to the system requirement.
ComMBusType should be set to COMMBUSTYPE_ETH.
The rest of the configuration is similar to a configuration for CAN bus and is assumed to be known here.
EcuM module
EcuM configuration
EcuM module is responsible for initializing the Ethernet driver.
BswM module
BswM configuration
BswM action list should be adapted in order to initialize Ethernet stack modules and request/release the COM on the Ethernet bus if required.
BswMGeneral->BswMUserIncludeFiles should also be updated to include the new modules:
- EthIf.h
- EthTrcv.h
- EthSM.h
- TcpIp.h
- SoAd.h
Testing advices
Here is a list of advice in order to test the software:
- Wireshark: powerful ethernet sniffer to track frame exchange between the computer and the target
- Cat5 ethernet cable require 4 twisted pairs if using Gb ethernet. Cables with only 2 pairs are limited to 100Mbs.