Post Page Advertisement [Top]

AUTOSAR CANIF

The CAN Interface module provides a unique interface to manage different CAN hardware device types like CAN controllers and CAN transceivers used by the defined ECU hardware layout. Thus multiple internal and external CAN controllers/CAN transceivers can be controlled by the CAN State Manager module.

CANIF is responsible for the below functions 

  • Transmit request services: The CANIF’s transmit request function CanIf_Transmit()  is a common interface for upper layers to transmit PDUs on the CAN network. The upper communication layer modules initiate the transmission only via the CAN Interface module's services without direct access to the CANDrv.
  • Transmit confirmation services: If a previous transmit request is completed successfully, the CANDrv notifies it to the CanIf by the call of CanIf_TxConfirmation(). When callback notification CanIf_TxConfirmation() is called, the CANIF shall identify the upper layer communication layer , which is linked to the successfully transmitted L-PDU, and shall notify it about the performed transmission by call of CANIF's transmit confirmation service User_TxConfirmation() 
  • Reception indication services: This service indicates a successful reception of an L-PDU to the upper layer module after passing all filters and validation checks  
  • Controller mode  control services: The CAN controller status may be changed at request of the upper layer by the calling of CanIf_SetControllerMode() service. The request is validated and passed by the CanIf via the CanDrv API to the addressed CAN controller
  • PDU mode control services: CanIf_SetPduMode() service sets the requested mode at the L-PDUs of a predefined logical PDU channel. 

Data transfer

Data transfer happens via Hardware Object Handles (HOH) for transmission (HTH - hardware transmit handle) as well as for reception(HRH- Hardware receive handle). These handles are abstract structures referring to a CAN hardware object structure, that contains CAN related parameters such as CanId, DLC and data. CanIf calls CAN driver interfaces using these abstract references and never uses the actual hardware CanId, hence CanIf remains hardware independent



CanIf links the PDU channel groups to Hardware object handles provided by the CAN driver which in-turn points to the HW object of the CAN controller. Data flows from the physical can bus to the CAN controller HW object to the Hardware object handles in the CAN Driver to CanIf which after processing provides it to upper layers and vice versa.

In case of Transmission of a PDU, CanIf is responsible for mapping the Hardware Transmit Handles to the CAN hardware objects, determining the CAN driver on which the PDU has to be transmitted, triggering a call to Can_Write api. Once the Can_Write is completed, notifying the upper about the transmission status of the PDU. In case of Reception of a PDU, CanIf is responsible for filtering of the received PDU, DLC check, buffering of the received PDU and indicating the upper layer about the PDU reception.



Handling of CAN Hardware:

The CAN hardware unit combines one or multiple CAN controller modules of the same type, which may be located on-chip or as external standalone devices. Each CAN hardware unit is served by the corresponding CAN Driver module. If different types of CAN controllers are used, also different types of CAN Driver modules have to be applied with a unified API to the CAN Interface module. The CAN Interface module collects information about number and types of CAN controller modules and their hardware objects in its mapping tables at configuration time. This allows transparent and hardware independent access to upper layer modules using HOHs.

Handling Basic and Full CAN:

CanIf distinguishes between BasicCAN and FullCAN handling for activation of software acceptance filtering. A CAN Hardware Object for FullCAN operation only enables transmission or reception of single CanIds. A CAN Hardware Object for BasicCAN operation of one Hardware Object enables to transmit or receive a range of CanIds. BasicCAN and FullCAN objects can coexist in a single configuration setup.



1 comment:

  1. Thanks for such a beautiful blog on Canif module,i hope we will be seeing more blogs on the Autosar BSW modules and keep continuing :)

    ReplyDelete

Bottom Ad [Post Page]