CAN communicatoin stack,it take me a long time to found it, hope it help
patrickwang85
227 views
18 slides
Jan 01, 2024
Slide 1 of 18
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
About This Presentation
CAN 软件,很实用
Size: 557.21 KB
Language: en
Added: Jan 01, 2024
Slides: 18 pages
Slide Content
CAN stack
Overview AUTOSAR CAN Stack Overview. Included modules. From COMM_NO_COMMUNICATION to COMM_FULL_COMMUNICATION. Transmission request. Receive indication.
AUTOSAR can stack: Overview Autosar VFB The integration of functions from different suppliers is established through a virtual functional bus. Allow virtual integration between SW-c as long as communication mechanism is defined. Collection of all communication mechanism. Interfaces on an abstract level that allow s/w design regardless the target h/w. RTE Realization of VFB for a specific ECU. It mange the communication inter/intra ECU.
AUTOSAR can stack: Overview Communication Stack for CAN COM: - Transfer signals from, and to RTE. - Pass signals to CANTP or PDUR depending on the used service. PDU-Router : - Route I-PDUs between the following modules: Communication interface (CANIF), Transport protocol (CANTP), Diagnostics (DCM)
AUTOSAR can stack: Overview Communication Stack for CAN CANIF: - It abstracts the interface regardless Location of the driver (internal/external). CANTP : - Segment and reassemble data Longer than 8 bytes. CAN Driver: Abstraction for the CAN controller hardware.
AUTOSAR can stack: Overview Communication Stack for CAN CANSM : Change communication mode as requested. CANTRCV: Control external CAN transceiver hardware, It observe the bus and provide physical network diagnostics.
AUTOSAR can stack: Overview Included modules from service layer: ComM : Propagate requested communication mode to CanSM BSWM: Forward user requests to ComM and report communication state to the user. ECUM: Detect passive wake up and initialize related modules.
AUTOSAR can stack: Included modules
Active VS Passive Wake-up Active wake-up: when the current ECU is the source of the wake-up signal (sensor). Passive wake-up : when another ECU is the source of the wake-up signal. In this case the ECU should receive NM frames to keep the ECU in the passive wake-up mode. AUTOSAR can stack: From COMM_NO_COMMUNICATION to COMM_FULL_COMMUNICATION
Modules interaction For active wake-up User request communication mode. ComM propagate requested mode to CANSM. CANSM change the current mode to the requested mode by calling CANIF APIs. CANIF contact the CAN driver which write values in the CAN controller register to go the requested communication mode. The CAN controller send mode indication signal to upper modules till it is back to ComM . AUTOSAR can stack: From COMM_NO_COMMUNICATION to COMM_FULL_COMMUNICATION
6- ComM notifies the BSWM to manage what will happen next to start data transmitting. AUTOSAR can stack: From COMM_NO_COMMUNICATION to COMM_FULL_COMMUNICATION SWC1 RTE COMM CANSM CANIF CAN Controller Controller Red arrows indicate request direction Blue arrows indicate confirmation messages direction
AUTOSAR can stack: From COMM_NO_COMMUNICATION to COMM_FULL_COMMUNICATION APIs and State transitions: COMM CANSM CANIF CAN Hardware (controller) Start State COMM_NO_COMMUNICATION S_RNOCO: S_CAN_TRCV_NORMAL CANIF_CS_INIT: CANIF_CS_STOPPED CAN_READY STOP/SLEEP Called APIs CanSM_RequestComMode ( NetworkHandle,ComM_Mode :=COMM_FULL_COMMUNICATION) CanIf_SetControllerMode ( CanSMControllerId , CANIF_CS_STARTED) AND CanIf_SetPduMode ( CanSMControllerId , CANIF_SET_ONLINE) Can_SetControllerMode (Controller, CAN_T_STARTED). request CAN controller mode transition to START() Callback fn. Configurable confirmation to BswM . ComM_BusSM_ModeIndication ( Channel,ComMode : =COMM_FULL_COMMUNICATION) CanSM_ControllerModeIndication (uint8, COMM_FULL_COMMUNICATION) CanIf_ControllerModeIndication End State COMM_FULL_COMMUNICATION S_FUCO: S_NO_BUS_OFF CANIF_CS_INIT: CANIF_CS_STARTED CAN_READY START
AUTOSAR can stack: From COMM_NO_COMMUNICATION to COMM_FULL_COMMUNICATION Modules state machine: ComM CANSM CANIF CAN
Modules interaction When BSWM receive confirmation signal that the channel is ready it notifies the COM to take the massage from the RTE. COM propagate the IPDU to PDUR which in turn forward the message to the corresponding interface of TP modules (in our case if the message is loner than 8 bytes will be forwarded to CANTP else to CANIF ). CANIF sends data to the CAN driver which writes data in the CAN controller registers. After successful transmission TxConfirmation signal is sent to upper layers. AUTOSAR can stack: Transmission request
Modules interaction SWC1 RTE COM PDUR CANIF CAN Controller Controller Red arrows indicate request direction Blue arrows indicate confirmation messages direction AUTOSAR can stack: Transmission request
AUTOSAR can stack: Transmission request COM PduR CANIF CAN Hardware (controller) Called APIs PduR_ComTransmit CanIf_Transmit Can_write Copy LPDU to harware Callback fn. Rte_COMCbkTAck_signalX () Com_TxConfirmation PduR_CanTxConfirmation CanIf_CanTxConfirmation Tx interrupt APIs and State transitions:
Modules interaction To detect received data Interrupt or polling can be used Interrupt : The controller will notify CANIF when data is received Polling : CANIF will periodically check weather data is received or not. For both modes after the CANIF detects that there is received data it will notify upper modules to read data. After reaching the COM the received data will be available to be called by the RTE when required. AUTOSAR can stack: Receive indication
AUTOSAR can stack: Receive indication COM PduR CANIF CAN Hardware (controller) Callback fn. Rte_COMCbk_signalX () Com_RxIndication PduR _<module> RxIndication CanIf_RxIndication Receive Interrupt() Called APIs CanIf_ReadRxNotifStatus () CanIf_ReadRxPduData Read data from CANIF Rx buffer() APIs and State transitions: