Autosar Sws Candriver
Autosar Sws Candriver
Autosar Sws Candriver
0 Rev 3
Document Title
Document Owner Document Responsibility Document Identification No Document Classification Document Version Document Status Part of Release Revision
1 of 101
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 15.10.2010 3.1.0 AUTOSAR Administration Modified CAN111 to correct the "Version Checking" information Added new requirements CAN435 to CAN440 to introduce Can_GeneralTypes.h. Added new requirements CAN441 and CAN442 to introduce multiple poll cycles Added new requirements CAN443 and CAN444 to provide an optional callback on every reception of a LPDU General improvements of requirements in preparation of CT-development. Can_MainFunction_Mode added to support asynchronous controller state change Limited number of supported message objects removed Description of CAN controller state transitions improved Debbuging concept added Legal disclaimer revised Legal disclaimer revised
30.11.2009
3.0.0
AUTOSAR Administration
23.06.2008 24.01.2008
2.2.2 2.2.1
Table formatting corrected Tables generated from UML-models, General improvements of requirements in preparation of CT-development. Functions Can_MainFunction_Write, Can_MainFunction_Read, Can_MainFunction_BusOff and Can_MainFunction_WakeUp changed to scheduled functions Cycle Parameters added for new scheduled functions Wakeup concept added (Chapter 7.7) and addition of function Can_Cbk_CheckWakeup Document meta information extended Small layout adaptations made
30.11.2007
2.2.0
2 of 101
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 31.01.2007 2.1.0 AUTOSAR Administration File structure reworked (chapter 5.2) Removed return value CAN_WAKEUP in function Can_SetControllerMode Replaced by CAN_NOT_OK Renamed CanIf_ControllerWakeup to CanIf_SetWakeupEvent Reworked development errors (chapter 7.10) Removed implementation specific description in Can_Write Changed timing of cyclic functions to "fixed cyclic" Reworked "Scope" for all configuration variables (chapter 10.2) Legal disclaimer revised Release notes added Advice for users revised Revision Information added Document structure adapted to common Release 2.0 SWS Template clarified development and production error handling and function abortion multiplexed transmission and TX cancellation version check configuration description according template individual main functions for RX TX and status Initial release
21.04.2006
2.0.0
AUTOSAR Administration
31.05.2005
1.0.0
AUTOSAR Administration
3 of 101
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 Disclaimer This specification and the material contained in it, as released by AUTOSAR, is for the purpose of information only. AUTOSAR and the companies that have contributed to it shall not be liable for any use of the specification. The material contained in this specification is protected by copyright and other types of Intellectual Property Rights. The commercial exploitation of the material contained in this specification requires a license to such Intellectual Property Rights. This specification may be utilized or reproduced without any modification, in any form or by any means, for informational purposes only. For any other purpose, no part of the specification may be utilized or reproduced, in any form or by any means, without permission in writing from the publisher. The AUTOSAR specifications have been developed for automotive applications only. They have neither been developed, nor tested for non-automotive applications. The word AUTOSAR and the AUTOSAR logo are registered trademarks.
Advice for users AUTOSAR specifications may contain exemplary items (exemplary reference models, "use cases", and/or references to exemplary technical solutions, devices, processes or software). Any such exemplary items are contained in the specifications for illustration purposes only, and they themselves are not part of the AUTOSAR Standard. Neither their presence in such specifications, nor any later documentation of AUTOSAR conformance of products actually implementing such exemplary items, imply that intellectual property rights covering such exemplary items are licensed under the same rules as applicable to the AUTOSAR Standard.
4 of 101
- AUTOSAR confidential -
Table of Content
1 2 Introduction and functional overview ................................................................... 8 Acronyms and abbreviations ............................................................................... 9 2.1 2.2 3 3.1 3.2 4 4.1 4.2 5 Priority Inversion......................................................................................... 10 CAN Hardware Unit.................................................................................... 11 Input documents......................................................................................... 13 Related standards and norms .................................................................... 14 Limitations .................................................................................................. 15 Applicability to car domains........................................................................ 15
Related documentation...................................................................................... 13
Dependencies to other modules........................................................................ 16 5.1.1 Static Configuration............................................................................. 16 5.1.2 Driver Services.................................................................................... 16 5.1.3 System Services ................................................................................. 17 5.1.4 Can module Users .............................................................................. 17 5.2 File structure .............................................................................................. 17 5.2.1 Code file structure ............................................................................... 17 5.2.2 Header file structure............................................................................ 17
6 7
Requirements traceability .................................................................................. 21 Functional specification ..................................................................................... 34 7.1 Driver scope ............................................................................................... 34 7.2 Driver State Machine.................................................................................. 35 7.3 CAN Controller State Machine ................................................................... 36 7.3.1 CAN Controller State Description........................................................ 37 7.3.2 CAN Controller State Transitions ........................................................ 38 7.3.3 State transition caused by function Can_Init ....................................... 39 7.3.4 State transition caused by function Can_ChangeBaudrate................. 39 7.3.5 State transition caused by function Can_SetControllerMode .............. 39 7.3.6 State transition caused by Hardware Events ...................................... 42 7.4 Can module/Controller Initialization............................................................ 43 7.5 L-PDU transmission ................................................................................... 45 7.5.1 Priority Inversion ................................................................................. 46 7.5.1.1 Multiplexed Transmission............................................................. 46 7.5.1.2 Transmit Cancellation .................................................................. 47 7.5.2 Transmit Data Consistency ................................................................. 48 7.6 L-PDU reception......................................................................................... 49 7.6.1 Receive Data Consistency .................................................................. 49 7.7 Wakeup concept......................................................................................... 50 7.8 Notification concept .................................................................................... 51 7.9 Reentrancy issues...................................................................................... 51 7.10 Error classification ...................................................................................... 52
5 of 101
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 7.10.1 Development Errors ............................................................................ 52 7.10.2 Production Errors ................................................................................ 53 7.10.3 Return Values ..................................................................................... 53 7.11 Error detection............................................................................................ 53 7.12 Error notification ......................................................................................... 53 7.13 Version Check ............................................................................................ 53 7.14 Debugging.................................................................................................. 54 8 API specification................................................................................................ 55 8.1 Imported types............................................................................................ 55 8.2 Type definitions .......................................................................................... 55 8.2.1 Can_ConfigType ................................................................................. 55 8.2.2 Can_ControllerBaudrateConfigType ................................................... 56 8.2.3 Can_PduType ..................................................................................... 56 8.2.4 Can_IdType......................................................................................... 56 8.2.5 Can_HwHandleType ........................................................................... 57 8.2.6 Can_StateTransitionType ................................................................... 57 8.2.7 Can_ReturnType................................................................................. 57 8.3 Function definitions .................................................................................... 58 8.3.1 Services affecting the complete hardware unit.................................... 58 8.3.1.1 Can_Init........................................................................................ 58 8.3.1.2 Can_GetVersionInfo .................................................................... 58 8.3.1.3 Can_CheckBaudrate.................................................................... 59 8.3.2 Services affecting one single CAN Controller...................................... 61 8.3.2.1 Can_ChangeBaudrate ................................................................. 61 8.3.2.2 Can_SetControllerMode............................................................... 62 8.3.2.3 Can_DisableControllerInterrupts.................................................. 64 8.3.2.4 Can_EnableControllerInterrupts................................................... 65 8.3.2.5 Can_CheckWakeup ..................................................................... 66 8.3.3 Services affecting a Hardware Handle ................................................ 67 8.3.3.1 Can_Write .................................................................................... 67 8.4 Call-back notifications ................................................................................ 69 8.4.1 Call-out function .................................................................................. 69 8.4.2 Enabling/Disabling wakeup notification ............................................... 69 8.5 Scheduled functions ................................................................................... 70 8.5.1.1 Can_MainFunction_Write............................................................. 70 8.5.1.2 Can_MainFunction_Read ............................................................ 71 8.5.1.3 Can_MainFunction_BusOff .......................................................... 71 8.5.1.4 Can_MainFunction_Wakeup........................................................ 72 8.5.1.5 Can_MainFunction_Mode ............................................................ 73 8.6 Expected Interfaces.................................................................................... 73 8.6.1 Mandatory Interfaces .......................................................................... 73 8.6.2 Optional Interfaces .............................................................................. 74 8.6.3 Configurable interfaces ....................................................................... 74 9 Sequence diagrams .......................................................................................... 75 9.1 9.2 10 10.1
6 of 101
Interaction between Can and CanIf module ............................................... 75 Wakeup sequence...................................................................................... 75 Configuration specification............................................................................. 76 How to read this chapter ............................................................................ 76
Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 10.1.1 Configuration and configuration parameters ....................................... 76 10.1.2 Variants ............................................................................................... 76 10.1.3 Containers........................................................................................... 76 10.1.4 Specification template for configuration parameters ........................... 77 10.2 Containers and configuration parameters .................................................. 77 10.2.1 Variants ............................................................................................... 78 10.2.2 Can ..................................................................................................... 85 10.2.3 CanGeneral......................................................................................... 85 10.2.4 CanController ...................................................................................... 88 10.2.5 CanControllerBaudrateConfig ............................................................. 91 10.2.6 CanHardwareObject............................................................................ 92 10.2.7 CanFilterMask ..................................................................................... 95 10.2.8 CanConfigSet...................................................................................... 95 10.2.9 CanMainFunctionRWPeriods .............................................................. 96 10.3 Published Information................................................................................. 97 11 11.1 11.2 11.3 11.4 12 Changes to Release 3 ................................................................................... 98 Deleted SWS Items .................................................................................... 98 Replaced SWS Items ................................................................................. 98 Changed SWS Items.................................................................................. 98 Added SWS Items ...................................................................................... 99 Not applicable requirements ........................................................................ 101
7 of 101
- AUTOSAR confidential -
8 of 101
- AUTOSAR confidential -
A CAN controller serves exactly one physical channel. A CAN Hardware Unit may consists of one or multiple CAN controllers of the same type and one or multiple CAN RAM areas. The CAN Hardware Unit is either on-chip, or an external device. The CAN Hardware Unit is represented by one CAN driver. CAN L-PDU Data Link Layer Protocol Data Unit. Consists of Identifier, DLC and Data (SDU). (see [18]) CAN L-SDU Data Link Layer Service Data Unit. Data that is transported inside the LPDU. (see [18]) DLC Data Length Code (part of L-PDU that describes the SDU length) Hardware Object A CAN hardware object is defined as a PDU buffer inside the CAN RAM of the CAN hardware unit / CAN controller. A Hardware Object is defined as L-PDU buffer inside the CAN RAM of the CAN Hardware Unit. Hardware The Hardware Receive Handle (HRH) is defined and provided by the Receive Handle CAN Driver. Each HRH typically represents just one hardware object. The (HRH) HRH can be used to optimize software filtering. The Hardware Transmit Handle (HTH) is defined and provided by the Hardware Transmit Handle CAN Driver. Each HTH typically represents just one or multiple hardware objects that are configured as hardware transmit buffer pool. (HTH) Inner Priority Transmission of a high-priority L-PDU is prevented by the presence of a Inversion pending low-priority L-PDU in the same transmit hardware object. ISR Interrupt Service Routine L-PDU Handle The L-PDU handle is defined and placed inside the CanIf module layer. Typically each handle represents an L-PDU, which is a constant structure with information for Tx/Rx processing. MCAL Microcontroller Abstraction Layer Outer Priority A time gap occurs between two consecutive transmit L-PDUs. Inversion In this case a lower priority L-PDU from another node can prevent sending the own higher priority L-PDU. Here the higher priority L-PDU cannot participate in arbitration during network access because the lower priority L-PDU already won the arbitration. Physical Channel A physical channel represents an interface from a CAN controller to the CAN Network. Different physical channels of the CAN hardware unit may access different networks. Priority The Priority of a CAN L-PDU is represented by the CAN Identifier. The lower the numerical value of the identifier, the higher the priority. SFR Special Function Register. Hardware register that controls the controller behavior. SPAL Standard Peripheral Abstraction Layer
9 of 101
- AUTOSAR confidential -
"If only a single transmit buffer is used inner priority inversion may occur. Because of low priority a message stored in the buffer waits until the traffic on the bus calms down. During the waiting time this message could prevent a message of higher priority generated by the same microcontroller from being transmitted over the bus." 1
10 of 101
- AUTOSAR confidential -
"The problem of outer priority inversion may occur in some CAN implementations. Let us assume that a CAN node wishes to transmit a package of consecutive messages with high priority, which are stored in different message buffers. If the interframe space between these messages on the CAN network is longer than the minimum space defined by the CAN standard, a second node is able to start the transmission of a lower priority message. The minimum interframe space is determined by the Intermission field, which consists of 3 recessive bits. A message, pending during the transmission of another message, is started during the Bus Idle period, at the earliest in the bit following the Intermission field. The exception is that a node with a waiting transmission message will interpret a dominant bit at the third bit of Intermission as Start-of-Frame bit and starts transmission with the first identifier bit without first transmitting an SOF bit. The internal processing time of a CAN module has to be short enough to send out consecutive messages with the minimum interframe space to avoid the outer priority inversion under all the scenarios mentioned." 2
11 of 101
- AUTOSAR confidential -
CAN Controller A Tx A Rx A Message Object Mailbox A CAN Transceiver A CAN Bus A Physical Channel A
CAN Bus B
Physical Channel B
12 of 101
- AUTOSAR confidential -
3 Related documentation
3.1 Input documents
[1] Layered Software Architecture AUTOSAR_EXP_LayeredSoftwareArchitecture..pdf General Requirements on Basic Software Modules AUTOSAR_SRS_BSWGeneral.pdf General Requirements on SPAL AUTOSAR_SRS_SPALGeneral.pdf Requirements on CAN AUTOSAR_SRS_CAN.pdf Specification of CAN Interface AUTOSAR_SWS_CANInterface.pdf Specification of Development Error Tracer AUTOSAR_SWS_DevelopmentErrorTracer.pdf Specification of ECU State Manager AUTOSAR_SWS_ECUStateManager.pdf Specification of MCU Driver AUTOSAR_SWS_MCUDriver.pdf Specification of Operating System AUTOSAR_SWS_OS.pdf
[2]
[3]
[4]
[5]
[6]
[7]
[8]
[9]
[10] Specification of ECU Configuration AUTOSAR_TPS_ECUConfiguration.pdf [11] Specification of C Implementation Rules AUTOSAR_TR_CImplementationRules.pdf [12] Specification of SPI Handler/Driver AUTOSAR_SWS_SPIHandlerDriver.doc.pdf [13] Specification of Memory Mapping AUTOSAR_SWS_MemoryMapping.pdf [14] Specification of BSW Scheduler AUTOSAR_SWS_BSW_Scheduler.pdf [15] Basic Software Module Description Template AUTOSAR_TPS_BSWModuleDescriptionTemplate.pdf
13 of 101 Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 [16] List of Basis Software Modules AUTOSAR_TR_BSWModuleList.pdf
14 of 101
- AUTOSAR confidential -
15 of 101
- AUTOSAR confidential -
In this case the CAN driver is not any more part of the C abstraction layer but put part of the ECU abstraction layer. Therefore it is (theoretically) allowed to use any C abstraction layer driver it needs.
16 of 101 Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 5.1.3 System Services [CAN280] In special hardware cases, the Can module shall poll for events of the hardware.() [CAN281] The Can module shall use the free running timer provided by the system service for timeout detection in case the hardware does not react in the expected time (hardware malfunction) to prevent endless loops.() Implementation hint: The blocking time of the Can module function that is waiting for hardware reaction shall be shorter than the CAN main function (i.e. Can_MainFunction_Read) trigger period, because the CAN main functions can't be used for that purpose.
5.1.4 Can module Users [CAN058] The Can module interacts among other modules (eg. Diagnostic Event Manager (DEM), Development Error Tracer (DET), Ecu State Manager (ECUM)) with the CanIf module in a direct way. This document never specifies the actual origin of a request or the actual destination of a notification. The driver only sees the CanIf module as origin and destination.(BSW12092)
5.2.1 Code file structure [CAN078] The code file structure shall not be defined within this specification completely. At this point it shall be pointed out that the code-file structure shall include the following file named: Can_PBcfg.c. This file shall contain all post-build time configurable parameters. Can_Lcfg.c is not required because the Can module does not support link-time configuration.(BSW00380, BSW00419) 5.2.2 Header file structure [CAN034]
17 of 101
- AUTOSAR confidential -
Figure 5-1: File structure for the Can module(BSW00381, BSW00412, BSW00346,
BSW158, BSW00435, BSW00436, BSW00348, BSW00301) [CAN043] The header file Can.h contains the declaration of the Can module API.() [CAN435] The Can.h file shall include Can_GeneralTypes.h.() [CAN037] The header file Can.h only contains 'extern' declarations of constants, global data, type definitions and services that are specified in the Can module SWS. (BSW00302) [CAN436] Can_GeneralTypes.h shall contain all types and constants that are shared among the AUTOSAR CAN modules Can, CanIf and CanTrcv.()
18 of 101 Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 [CAN437] The integrator of the Can modules shall provide the file Can_GeneralTypes.h. () [CAN418] Constants, global data types and functions that are only used by the Can module internally, are declared in Can.c() [CAN388] The header file Can.h shall include the header file ComStack_Types.h.() [CAN389] The implementation of the Can module shall provide the header file Can_Cfg.h that shall contain the pre-compile-time configuration parameters. (BSW00345) [CAN035] The file Can_Irq.c contains the implementation of interrupt frames [BSW00314]. The implementation of the interrupt service routine shall be in Can.c (BSW00314) The Can module does not provide callback functions (no Can_Cbk.h, see also CAN244) [CAN036] The Can module shall include the header file CanIf_Cbk.h, in which the callback functions called by the Can module at the CAN Interface module are declared.(BSW00370) [CAN390] The Can module shall include the header file EcuM_Cbk.h, in which the callback functions called by the Can module at the Ecu State Manager module are declared.() [CAN391] Can module implementations for off-chip CAN controllers shall include the header file Spi.h. By this inclusion, the APIs to access an external CAN controller by the SPI module [12] are included.() [CAN392] If an implementation defines implementation specific production errors, the Can module shall include the header file Dem.h. By this inclusion, the APIs to report production errors as well as the required Event Id symbols are included. () [CAN393] If the development error detection for the Can module is enabled, the Can module shall include the header file Det.h. By this inclusion, the APIs to report development errors are included.()
19 of 101
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 [CAN394] The Can module shall include the header file MemMap.h and apply the memory mapping abstraction mechanisms as specified by [13].(BSW00436) [CAN397] The Can module shall include the header file Os.h file. By this inclusion, the API to read a free running timer value (GetCounterValue) provided by the system service shall be included.() [CAN406] The Can module shall include the header file SchM_Can.h in order to access the module specific functionality provided by the BSW Scheduler [14]. (BSW00435)
20 of 101
- AUTOSAR confidential -
6 Requirements traceability
Requirement 21 of 101
Satisfied by CAN368 CAN420 CAN267 CAN427 CAN440 CAN404 CAN269 CAN209 CAN391 CAN215 CAN290 CAN284 CAN205 CAN268 CAN200 CAN056 CAN217 CAN280 CAN175 CAN188 CAN252 CAN397 CAN446 CAN362 CAN179 CAN180 CAN244 CAN398 CAN417 CAN373 CAN413 CAN275 CAN206 CAN386 CAN255
Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
CAN228 CAN197 CAN390 CAN426 CAN230 CAN409 CAN190 CAN419 CAN416 CAN423 CAN183 CAN447 CAN438 CAN370 CAN439 CAN385 CAN395 CAN204 CAN187 CAN410 CAN379 CAN198 CAN227 CAN256 CAN282 CAN432 CAN174 CAN424 CAN261 CAN360 CAN229 CAN369 CAN262 CAN222 CAN444 CAN418 CAN300 CAN260 CAN226
Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
CAN219 CAN181 CAN435 CAN281 CAN392 CAN411 CAN084 CAN442 CAN445 CAN429 CAN083 CAN283 CAN422 CAN265 CAN218 CAN405 CAN414 CAN225 CAN425 CAN408 CAN208 CAN178 CAN177 CAN199 CAN202 CAN299 CAN259 CAN189 CAN082 CAN251 CAN186 CAN363 CAN270 CAN384 CAN196 CAN441 CAN388 CAN437 CAN258
Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
CAN080 CAN210 CAN393 CAN224 CAN412 CAN443 CAN415 CAN216 CAN264 CAN266 CAN043 CAN263 CAN434 CAN185 CAN240 CAN294 CAN436 CAN276 CAN184 CAN433 CAN361 CAN034 CAN037 CAN079 CAN999 CAN079 CAN079 CAN232, CAN231, CAN233, CAN214 CAN035 CAN026 CAN999 CAN999 CAN079 CAN104, CAN039 CAN999 CAN104, CAN027, CAN026, CAN028 CAN027, CAN028 CAN999 CAN021
Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
CAN389 CAN034 CAN077 CAN034 CAN999 CAN223 CAN999 CAN999 CAN089 CAN036 CAN031 CAN271, CAN364 CAN031 CAN239 CAN999 CAN078 CAN034 CAN999 CAN104 CAN089 CAN234 CAN999 CAN999 CAN999 CAN999 CAN111 CAN999 CAN021 CAN021 CAN103 CAN105 CAN999 CAN034 CAN999 CAN223 CAN999 CAN999 CAN078 CAN999
Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
CAN999 CAN999 CAN999 CAN999 CAN999 CAN110 CAN999 CAN112, CAN108, CAN109, CAN031 CAN999 CAN406, CAN034 CAN394, CAN034 CAN291 CAN999 CAN999 CAN365, CAN366, CAN367 CAN999 CAN999 CAN999 CAN999 CAN999 CAN999 CAN431 CAN999 CAN999 CAN242, CAN238 CAN079 CAN245, CAN246 CAN062 CAN050, CAN049 CAN279, CAN396 CAN212, CAN214, CAN213 CAN016 CAN017 CAN271, CAN364, CAN235 CAN234, CAN020 CAN012, CAN011 CAN274, CAN273, CAN272 CAN007 CAN048
Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
Satisfied by CAN021
Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
Chapter 10.2 Chapter 10.2 Chapter 10.2 Chapter 10.2 not applicable (the parameters are defined in a way that their values are independent from other settings. The dependency is in the code generation (implementation) not in the configuration description -> hardware abstraction) [BSW00396] Configuration classes Chapter 10.2 [BSW00397] Pre-compile-time parameters Not applicable: this is not a requirement but a definition of term. [BSW00398] Link-time parameters Not applicable: this is not a requirement but a definition of term. [BSW00399] Loadable Post-build time parameters Not applicable: this is not a requirement but a definition of term. [BSW00400] Selectable Post-build time Not applicable: this is not a requirement but a parameters definition of term. [BSW00438] Post Build Configuration Data CAN291 Structure [BSW00402] Published information Chapter 10.2.2 [BSW00375] Notification of wake-up reason CAN271, CAN364 [BSW101] Initialization interface CAN250 [BSW168] Diagnostic Interface of SW not applicable components (requirement for the diagnostic services, not for the BSW module) [BSW00416] Sequence of Initialization not applicable (this is a general software integration requirement) [BSW00406] Check module initialization CAN103, defined development error CAN_E_UNINIT [BSW00437] NoInit--Area in RAM not applicable
28 of 101 Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
- AUTOSAR confidential -
[BSW00342] Usage of source code and object code [BSW00343] Specification and configuration of time [BSW160] Human-readable configuration data [BSW00453] Harmonization of BSW Modules [BSW007] HIS MISRA C [BSW00300] Module naming convention [BSW00413] Accessing instances of BSW modules [BSW00347] Naming separation of drivers [BSW00441] Enumeration literals and #define naming convention [BSW00305] Self-defined data types naming convention [BSW00307] Global variables naming convention
[BSW00310] API naming convention [BSW00373] Main processing function naming convention [BSW00327] Error values naming convention [BSW00335] Status values naming convention [BSW00350] Development error detection keyword [BSW00408] Configuration parameter naming convention [BSW00410] Compiler switches shall have defined values [BSW00411] Get version info keyword [BSW00346] Basic set of module files [BSW158] Separation of configuration from implementation [BSW00314] Separation of interrupt frames and service routines [BSW00370] Separation of callback interface from API [BSW00435] Module Header File Structure for the Basic Software Scheduler [BSW00436] Module Header File Structure for the Basic Software Memory Mapping [BSW00447] Standardizing Include file structure of BSW Modules Implementing Autosar Service [BSW00348] Standard type header [BSW00353] Platform specific type header [BSW00361] Compiler specific language extension header [BSW00301] Limit imported information [BSW00302] Limit exported information
30 of 101
- AUTOSAR confidential -
Document: AUTOSAR requirements on Basic Software, cluster SPAL (general SPAL requirements) [3]
Requirement
31 of 101
Satisfied by
Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
[BSW12461] Responsibility for register initialization [BSW12462] Provide settings for register initialization [BSW12463] Combine and forward settings for register initialization [BSW12068] MCAL initialization sequence [BSW12069] Wake-up notification of ECU State Manager [BSW157] Notification mechanisms of drivers and handlers [BSW12169] Control of operation mode [BSW12063] Raw value mode [BSW12075] Use of application buffers [BSW12129] Resetting of interrupt flags [BSW12064] Change of operation mode during running operation [BSW12448] Behavior after development error detection [BSW12067] Setting of wake-up conditions [BSW12077] Non-blocking implementation [BSW12078] Runtime and memory efficiency [BSW12092] Access to drivers [BSW12265] Configuration data shall be kept constant [BSW12264] Specification of configuration items
[BSW01139] CAN controller specific initialization [BSW01033] Basic Software Modules Requirements [BSW01034] Hardware independent implementation [BSW01035] Multiple CAN controller support [BSW01036] CAN Identifier Length Configuration [BSW01037] Hardware Filter Configuration
32 of 101
- AUTOSAR confidential -
33 of 101
- AUTOSAR confidential -
7 Functional specification
On L-PDU transmission, the Can module writes the L-PDU in an appropriate buffer inside the CAN controller hardware. See chapter 7.5 for closer description of L-PDU transmission. On L-PDU reception, the Can module calls the RX indication callback function with ID, DLC and pointer to L-SDU as parameter. See chapter 7.6 for closer description of L-PDU reception. The Can module provides an interface that serves as periodical processing function, and which must be called by the Basic Software Scheduler module periodically. Furthermore, the Can module provides services to control the state of the CAN controllers. Bus-off and Wake-up events are notified by means of callback functions. The Can module is a Basic Software Module that accesses hardware resources. Therefore, it is designed to fulfill the requirements for Basic Software Modules specified in AUTOSAR_SRS_SPAL (see [3]). [CAN033] The Can module shall implement the interrupt service routines for all CAN Hardware Unit interrupts that are needed. (BSW164, BSW12129) [CAN419] The Can module shall disable all unused interrupts in the CAN controller. () [CAN420] The Can module shall reset the interrupt flag at the end of the ISR (if not done automatically by hardware). () Implementation hint: The Can module shall not set the configuration (i.e. priority) of the vector table entry. [CAN079] The Can module shall fulfill all design and implementation guidelines described in [11].(BSW007, BSW00306, BSW00308, BSW00309, BSW00330)
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 modules shall be implemented such that no two functions with the same name are generated.() The naming convention is as follows:
<Can module name>_<vendorID>_<Vendor specific API name><driver abbreviation>()
BSW00347 specifies the naming convention. [CAN385] The naming conventions shall be used only in that case, if multiple different CAN controller types on one ECU have to be supported. () [CAN386] If only one controller type is used, the original naming conventions without any <driver abbreviation> extensions are sufficient.() See [5] for description how several Can modules are handled by the CanIf module.
Figure 7-1
[CAN246] The function Can_Init shall change the module state to CAN_READY, after initializing all controllers inside the HW Unit.(BSW12057, BSW01041)
35 of 101
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 [CAN245] The function Can_Init shall initialize all CAN controllers according to their configuration.(BSW12057, BSW01041) Each CAN controller must then be started separately by calling the function Can_SetControllerMode(CAN_T_START). Implementation hint: Hardware register settings that have impact on all CAN controllers inside the HW Unit can only be set in the function Can_Init. Implementation hint: The ECU State Manager module shall call Can_Init at most once during runtime.
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 wrong implementation by the upper layer module, the Can module raises the development error CAN_E_TRANSITION. The Can module does not check the actual state before it performs Can_Write or raises callbacks. During a transition phase - where the software controller state inside the CanIf module differs from the hardware state of the CAN controller transmit might fail or be delayed because the hardware CAN controller is not yet participating on the bus. The Can module does not provide a notification for this case. 7.3.1 CAN Controller State Description This chapter describes the required hardware behavior for the different SW states. The software state machine itself is implemented and described in the CanIf module. Please refer to [5] for the state diagram. CAN controller state UNINIT The CAN controller is not initialized. All registers belonging to the CAN module are in reset state, CAN interrupts are disabled. The CAN Controller is not participating on the CAN bus.
CAN controller state STOPPED In this state the CAN Controller is initialized but does not participate on the bus. In addition, error frames and acknowledges must not be sent. (Example: For many controllers entering an 'initialization'-mode causes the controller to be stopped.)
CAN controller state STARTED The controller is in a normal operation mode with complete functionality, which means it participates in the network. For many controllers leaving the 'initialization'mode causes the controller to be started.
CAN controller state SLEEP The hardware settings only differ from state STOPPED for CAN hardware that support a sleep mode (wake-up over CAN bus directly supported by CAN hardware). [CAN257] When the CAN hardware supports sleep mode and is triggered to transition into SLEEP state, the Can module shall set the controller to the SLEEP state from which the hardware can be woken over CAN Bus.(BSW12067)
37 of 101
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 [CAN258] When the CAN hardware does not support sleep mode and is triggered to transition into SLEEP state, the Can module shall emulate a logical SLEEP state from which it returns only, when it is triggered by software to transition into STOPPED state.() [CAN404] The CAN hardware shall remain in state STOPPED, while the logical SLEEP state is active.() 7.3.2 CAN Controller State Transitions A state transition is triggered by software with the function Can_SetControllerMode with the required transition as parameter. A successful state transition triggered by software is notified by the callback function (CanIf_ControllerModeIndication). The monitoring whether the requested state is achieved is part of an upper layer module and is not part of the Can module. Some transitions are triggered by events on the bus (hardware). These transitions cause a notification by means of a callback function (CanIf_ControllerBusOff, EcuM_CheckWakeup). Plausibility checks for state transitions are only performed with development error detection switched on. The behavior for invalid transitions in production code is undefined. Figure 7-2 shows all valid state transitions.
PowerON reset
UNINT
STOPPED
SLEEP
STARTED
Figure 7-2
38 of 101
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 7.3.3 State transition caused by function Can_Init UNINIT STOPPED (for all controllers in HW unit) software triggered by the function call Can_Init does configuration for all CAN controllers inside HW Unit All control registers are set according to the static configuration. [CAN259] The function Can_Init shall set all CAN controllers in the state STOPPED. () When the function Can_Init is entered and the Can module is not in state CAN_UNINIT or the CAN controllers are not in state UNINIT, it shall raise the error CAN_E_TRANSITION (Compare to CAN174 and CAN408).
7.3.4 State transition caused by function Can_ChangeBaudrate STOPPED STOPPED software triggered by the function call Can_ChangeBaudrate changes the CAN controller configuration
CAN controller registers are set according to the static configurations. [CAN256] The Can modules environment shall only call Can_ChangeBaudrate when the CAN controller is in state STOPPED.() [CAN260] The function Can_ChangeBaudrate shall maintain the CAN controller in the state STOPPED.() [CAN422] The function Can_ChangeBaudrate shall ensure that any settings that will cause the CAN controller to participate in the network are not set.() When the function Can_ChangeBaudrate is entered and the CAN controller is not in state STOPPED, it shall raise the error CAN_E_TRANSITION (Compare to CAN190). 7.3.5 State transition caused by function Can_SetControllerMode The software can trigger a CAN controller state transition with the function Can_SetControllerMode. Depending on the CAN hardware, a change of a register setting to transition to a new CAN controller state may take over only after a delay. The Can module notifies the upper layer (CanIf_ControllerModeIndication) after a successful state transition about the new state. The monitoring whether the
39 of 101 Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 requested state is achieved is part of an upper layer module and is not part of the Can module. [CAN370] The function Can_Mainfunction_Mode shall poll a flag of the CAN status register until the flag signals that the change takes effect and notify the upper layer with function CanIf_ControllerModeIndication about a successful state transition.() [CAN371] This polling shall take the maximum time of CanTimeoutDuration for blocking function and thus the polling time is limited.(BSW12077) [CAN398] The function Can_SetControllerMode shall use the system service GetCounterValue for timeout monitoring to avoid blocking functions.() [CAN372] In case the flag signals that the change takes no effect and the maximum time CanTimeoutDuration is elapsed, the function Can_SetControllerMode shall be left and the function Can_Mainfunction_Mode shall continue to poll the flag. (BSW12077) [CAN373] The function Can_Mainfunction_Mode shall call the function CanIf_ControllerModeIndication to notify the upper layer about a successful state transition of the CAN controller, in case the state transition was triggered by function Can_SetControllerMode.()
[CAN261] The function Can_SetControllerMode(CAN_T_START) shall set the hardware registers in a way that makes the CAN controller participating on the network.() [CAN262] The function Can_SetControllerMode(CAN_T_START) shall wait for limited time until the CAN controller is fully operational. Compare to CAN371.() Transmit requests that are initiated before the CAN controller is operational get lost. The only indicator for operability is the reception of TX confirmations or RX indications. The sending entities might get a confirmation timeout and need to be able to cope with that.
40 of 101
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 [CAN409] When the function Can_SetControllerMode(CAN_T_START) is entered and the CAN controller is not in state STOPPED it shall detect a invalid state transition (Compare to CAN200).()
[CAN263] The function Can_SetControllerMode(CAN_T_STOP) shall set the bits inside the CAN hardware such that the CAN controller stops participating on the network.() [CAN264] The function Can_SetControllerMode(CAN_T_STOP) shall wait for a limited time until the CAN controller is really switched off. Compare to CAN371.() [CAN282] The function Can_SetControllerMode(CAN_T_STOP) shall cancel pending messages. () [CAN283] The function Can_SetControllerMode(CAN_T_STOP) shall not call a cancellation notification.() Hint: Even if pending messages are cancelled by the function Can_SetControllerMode(CAN_T_STOP), there are hardware restrictions and racing problems. So it cannot be guaranteed if the cancelled messages are still processed by the hardware or not. [CAN410] When the function Can_SetControllerMode(CAN_T_STOP) is entered and the CAN controller is neither in state STARTED nor in state STOPPED, it shall detect a invalid state transition (Compare to CAN200).()
[CAN265] The function Can_SetControllerMode(CAN_T_SLEEP) shall set the controller into sleep mode.() [CAN266] If the CAN HW does support a sleep mode, the function Can_SetControllerMode(CAN_T_SLEEP) shall wait for a limited time until the CAN
41 of 101 Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 controller is in SLEEP state and it is assured that the CAN hardware is wake able. Compare to CAN371.() [CAN290] If the CAN HW does not support a sleep mode, the function Can_SetControllerMode(CAN_T_SLEEP) shall set the CAN controller to the logical sleep mode.() [CAN405] This logical sleep mode shall left only, if function
Can_SetControllerMode(CAN_T_WAKEUP) is called.() [CAN411] When the function Can_SetControllerMode(CAN_T_SLEEP) is entered and the CAN controller is neither in state STOPPED nor in state SLEEP, it shall detect a invalid state transition (Compare to CAN200).()
[CAN267] If the CAN HW does not support a sleep mode, the function Can_SetControllerMode(CAN_T_WAKEUP) shall return from the logical sleep mode, but have no effect to the CAN controller state (as the controller is already in stopped state).() [CAN268] The function Can_SetControllerMode(CAN_T_WAKEUP) shall wait for a limited time until the CAN controller is in STOPPED state. Compare to CAN371.() [CAN412] When the function Can_SetControllerMode(CAN_T_WAKEUP) is entered and the CAN controller is neither in state SLEEP nor in state STOPPED, it shall detect a invalid state transition (Compare to CAN200).() 7.3.6 State transition caused by Hardware Events State transition caused by Hardware Wakeup (triggered by wake-up event from CAN bus) SLEEP STOPPED triggered by incoming L-PDUs The ECU Statemanager module is notified with the function EcuM_CheckWakeup
This state transition will only occur when sleep mode is supported by hardware.
42 of 101 Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 [CAN270] On hardware wakeup (triggered by a wake-up event from CAN bus), the CAN controller shall transition into the state STOPPED.() [CAN271] On hardware wakeup (triggered by a wake-up event from CAN bus), the Can module shall call the function EcuM_CheckWakeup either in interrupt context or in the context of Can_MainFunction_Wakeup.(BSW00375, BSW12069, BSW01054) [CAN269] The Can module shall not further process the L-PDU that caused a wakeup.() [CAN048] In case of a CAN bus wake-up during sleep transition, the function Can_SetControllerMode(CAN_T_WAKEUP) (BSW01122) shall return CAN_NOT_OK.
State transition caused by Bus-Off (triggered by state change of CAN controller) [CAN020] STARTED STOPPED triggered by hardware if the CAN controller reaches bus-off state The CanIf module is notified with the function CanIf_ControllerBusOff after STOPPED state is reached.(BSW01055) [CAN272] After bus-off detection, the CAN controller shall transition to the state STOPPED and the Can module shall ensure that the CAN controller doesn't participate on the network anymore.(BSW01060) [CAN273] After bus-off detection, the Can module shall cancel still pending messages without raising a cancellation notification.(BSW01060) [CAN274] The Can module shall disable or suppress automatic bus-off recovery. (BSW01060)
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 static variables, including flags, Common setting for the complete CAN HW unit CAN controller specific settings for each CAN controller(BSW101)
[CAN053] Can_Init shall not change registers of CAN controller Hardware resources that are not used. (BSW12125) The Can module shall apply the following rules regarding initialization of controller registers: [CAN407] If the hardware allows for only one usage of the register, the Can module implementing that functionality is responsible initializing the register. If the register can affect several hardware modules and if it is an I/O register it shall be initialized by the PORT driver. If the register can affect several hardware modules and if it is not an I/O register it shall be initialized by the MCU driver. One-time writable registers that require initialization directly after reset shall be initialized by the startup code. All other registers shall be initialized by the startup code.(BSW12461) [CAN056] Post-Build configuration elements that are marked as 'multiple' ('M' or 'x') in chapter 10 can be selected by passing the pointer 'Config' to the init function of the module. () [CAN023] The consistency of the configuration must be checked by the configuration tool(s).(BSW167) [CAN062] The function Can_ChangeBaudrate shall re-initialize the CAN controller and the controller specific settings.(BSW01139, BSW01042) The CanIf module must first set the CAN controller in STOPPED state. Then Can_ChangeBaudrate can be invoked by the appropriate upper layer. [CAN255] The function Can_ChangeBaudrate shall only affect register areas that contain specific configuration for a single CAN controller. () [CAN021] The desired CAN controller configuration can be selected with the parameter Config. (BSW00344, BSW00404, BSW00405, BSW12263, BSW12265) [CAN291] Config is a pointer into an array of implementation specific data structure stored in ROM. The different controller configuration sets are located as data structures in ROM.(BSW00438)
44 of 101 Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 The possible values for Config are provided by the configuration description (see chapter 10). The Can module configuration defines the global CAN HW Unit settings and references to the default CAN controller configuration sets.
[CAN100] Several TX hardware objects with unique HTHs may be configured. The CanIf module provides the HTH as parameter of the TX request. See Figure 7-3 for a possible configuration.(BSW01135)
Message Objects of CAN Hardware
ID ID ID ID ID ID ID ID
Figure 7-3: Example of assignment of HTHs and HRHs to the Hardware Objects. The numbering of HTHs and HRHs are implementation specific. The chosen numbering is only an example.
45 of 101
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 [CAN276] The function Can_Write shall store the swPduHandle that is given inside the parameter PduInfo until the Can module calls the CanIf_TxConfirmation for this request where the swPduHandle is given as parameter. () The feature of CAN276 is used to reduce time for searching in the CanIf module implementation. [CAN016] The Can module shall call CanIf_TxConfirmation to indicate a successful transmission. It shall either called by the TX-interrupt service routine of the corresponding HW resource or inside the Can_MainFunction_Write in case of polling mode.(BSW01051) 7.5.1 Priority Inversion To prevent priority inversion two mechanisms are necessary: multiplexed transmission and hardware cancellation (see chapter 2.1). 7.5.1.1 Multiplexed Transmission [CAN277] The Can module shall allow that the functionality Multiplexed Transmission is statically configurable (ON | OFF) at pre-compile time.(BSW01134) [CAN401] Several transmit hardware objects shall be assigned by one HTH to represent one transmit entity to the upper layer.(BSW01134) [CAN402] The Can module shall support multiplexed transmission mechanisms for devices where either - Multiple transmit hardware objects, which are grouped to a transmit entity can be filled over the same register set, and the microcontroller stores the L-PDU into a free buffer autonomously, or - The Hardware provides registers or functions to identify a free transmit hardware object within a transmit entity.(BSW01134) [CAN403] The Can module shall support multiplexed transmission for devices, which send L-PDUs in order of L-PDU priority.(BSW01134) [CAN076] The Can module shall NOT support software emulation for the transmission in order of LPDU-priority.(BSW01134)
46 of 101
- AUTOSAR confidential -
Figure 7-4: Example of assignment of HTHs and HRHs to the Hardware Objects with multiplexed transmission. The numbering of HTHs and HRHs are implementation specific. The chosen numbering is only an example.
7.5.1.2 Transmit Cancellation For some applications, it is required to transmit always the newest data on the bus. L-PDUs which are pending in the transmit buffer from the previous transmit cycle must be replaced by an L-PDU of current transmit cycle. This requirement is supported by cancellation of pending L-PDUs with identical priority. However, cancellation and replacement of an L-PDU with identical priority can lead to priority inversion, which is in conflict with the requirement to prevent priority inversion. To satisfy both requirements, the configuration parameter CanIdenticalIdCancellation enables/disables the cancellation of L-PDUs with identical priority. [CAN278] The Can module shall allow that the functionality Transmit Cancellation is statically configurable (ON | OFF) at pre-compile time.(BSW01133) The complete cancellation sequence is described in the CanIf module [5]. [CAN432] The Can module shall allow that the cancellation of pending L-PDUs with identical priority is statically configurable at pre-compile time by parameter CanIdenticalIdCancellation.() [CAN285] Transmit cancellation may only be used when transmit buffers are enabled inside the CanIf module.(BSW01133)
47 of 101
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 [CAN286] The Can module shall initiate a cancellation, when the hardware transmit object assigned by a HTH is busy and an L-PDU with higher priority is requested to be transmitted.(BSW01133) [CAN433] The Can module shall initiate a cancellation, when the hardware transmit object assigned by a HTH is busy, an L-PDU with identical priority is requested to be transmitted and CanIdenticalIdCancellation is enabled.() The following two items are valid, in case multiplexed transmission functionality is enabled and several hardware transmit objects are assigned by one HTH: [CAN399] The Can module shall initiate a cancellation of the L-PDU with the lowest priority, when all hardware transmit objects assigned by the HTH are busy and an LPDU with a higher priority is requested to be transmitted.(BSW01133) [CAN400] The Can module shall initiate a cancellation, when one of the hardware transmit objects assigned by the HTH is busy, an L-PDU with identical priority is requested to be transmitted and CanIdenticalIdCancellation is enabled.(BSW01133) The incoming request is also rejected because the cancellation is asynchronous. [CAN287] The Can module shall raise a notification when the cancellation was successful by calling the function CanIf_CancelTxConfirmation.(BSW01133) [CAN288] The TX request for the new L-PDU shall be repeated by the CanIf module, inside the notification function CanIf_CancelTxConfirmation. (BSW01133) Implementation note: For sequence relevant streams the sender must assure that the next transmit request for the same CAN ID is only initiated after the last request was confirmed. 7.5.2 Transmit Data Consistency [CAN011] The Can module shall directly copy the data from the upper layer buffers. It is the responsibility of the upper layer to keep the buffer consistent until return of function call (Can_Write).(BSW12075, BSW01059)
48 of 101
- AUTOSAR confidential -
49 of 101
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 If the CAN hardware cannot be configured to lock the RX hardware object after reception (hardware feature), it could happen that the hardware buffer is overwritten by a newly arrived message. In this case, the CAN controller detects an overwrite event, if supported by hardware. If the CAN hardware can be configured to lock the RX hardware object after reception, it could happen that the newly arrived message cannot be stored to the hardware buffer. In this case, the CAN controller detects an overrun event, if supported by hardware. [CAN395] If the development error detection for the Can module is enabled, the Can module shall raise the error CAN_E_DATALOST in case of overwrite or overrun event detection.() Implementation Hint: The system designer shall assure that the runtime for message reception (interrupt driven or polling) correlates with the fasted possible reception in the system.
- AUTOSAR confidential -
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 The CAN main functions (i.e. Can_MainFunction_Read) shall not be interrupted by themselves. Therefore these CAN main functions are not reentrant.
Relevance
Development
Value [hex]
0x01 0x02 0x03 0x04 0x05 0x06 0x07
API Service used without initialization Invalid transition for the current mode Received CAN message is lost
7.10.1 Development Errors [CAN026] The Can module shall indicate errors that are caused by erroneous usage of the Can module API. This covers API parameter checks and call sequence errors. (BSW00337, BSW00323, BSW157) [CAN028] The Can module shall call the Development Error Tracer when DET is switched on and the Can module detects an error. (BSW00337, BSW00338, BSW157) [CAN091] After return of the DET the Can modules function that raised the development error shall return immediately.(BSW12448) [CAN089] The Can modules environment shall indicate development errors only in the return values of a function of the Can module when DET is switched on and the function provides a return value. The returned value is CAN_NOT_OK. (BSW00369, BSW00386, BSW12448) [CAN080] Development error values are of type uint8.()
52 of 101
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 7.10.2 Production Errors The Can module does not call the Diagnostic Event Manager, because there is no production error code defined for the Can module. 7.10.3 Return Values CAN_BUSY is reported via return value of the function Can_Write. The CanIf module reacts according the sequence diagrams specified for the CanIf module. CAN_NOT_OK is reported via return value in case of a wakeup during transition to sleep mode. Bus-off and Wake-up events are forwarded via notification callback functions.
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 The imported included files shall be checked by preprocessing directives. (BSW004) The following version numbers shall be verified: - <MAB>_AR_RELEASE_MAJOR_VERSION - <MAB>_AR_RELEASE_MINOR_VERSION Where <MAB> is the Module Abbreviation of the other (external) modules which provide header files included by the CAN module. If the values are not identical to the expected values, an error shall be reported.
7.14 Debugging
[CAN365] Each variable that shall be accessible by AUTOSAR Debugging, shall be defined as global variable.(BSW00442) [CAN366] All type definitions of variables which shall be debugged, shall be accessible by the header file Can.h.(BSW00442) [CAN367] The declaration of variables in the header file shall be such, that it is possible to calculate the size of the variables by C-"sizeof" operation.(BSW00442)
54 of 101
- AUTOSAR confidential -
8 API specification
The prefix of the function names may be changed in an implementation with several Can modules as described in CAN284.
Std_Types
()
- AUTOSAR confidential -
()
()
Description:
()
56 of 101
- AUTOSAR confidential -
()
Description:
()
Description:
(BSW00331)
57 of 101
- AUTOSAR confidential -
Service ID[hex]: Sync/Async: Reentrancy: Parameters (in): Parameters (inout): Parameters (out): None None Return value: This function initializes the module. Description:
(BSW00358, BSW00414) Symbolic names of the available configuration sets are provided by the configuration description of the Can module. See chapter 10 about configuration description. [CAN174] If development error detection for the Can module is enabled: The function Can_Init shall raise the error CAN_E_TRANSITION if the driver is not in state CAN_UNINIT.() [CAN408] If development error detection for the Can module is enabled: The function Can_Init shall raise the error CAN_E_TRANSITION if the CAN controllers are not in state UNINIT.() [CAN175] If development error detection for the Can module is enabled: The function Can_Init shall raise the error CAN_E_PARAM_POINTER if a NULL pointer was given as config parameter.() 8.3.1.2 Can_GetVersionInfo [CAN224]
58 of 101 Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
Service ID[hex]: Sync/Async: Reentrancy: Parameters (in): Parameters (inout): Parameters (out): versioninfo Pointer to where to store the version information of this module. None Return value: This function returns the version information of this module. Description:
() [CAN105] The function Can_GetVersionInfo shall return the version information of this module. The version information includes: - Module Id - Vendor Id - Vendor specific version numbers (BSW00407).(BSW00407) [CAN251] If source code for caller and callee is available, the function Can_GetVersionInfo should be realized as a macro, defined in the Can modules header file.() [CAN177] If development error detection for the Can module is enabled: The function Can_GetVersionInfo shall raise the error CAN_E_PARAM_POINTER if the parameter versionInfo is a null pointer.() [CAN252] The function Can_GetVersionInfo shall be pre compile time configurable (On/Off) by the configuration parameter: CanVersionInfoApi.()
- AUTOSAR confidential -
()
[CAN455] The service Can_CheckBaudrate(Controller, Baudrate) shall be called by CanIf_CheckBaudrate() for the requested CAN controller. () [CAN456] If the CAN Driver module was not initialized before calling Can_CheckBaudrate(Controller, Baudrate) and if development error detection is enabled (i.e. CAN_DEV_ERROR_DETECT equals ON), then the Can shall report development error code CAN_E_UNINIT to the Det_ReportError service of the DET module.() [CAN457] If parameter Controller of Can_CheckBaudrate(Controller, Baudrate)has an invalid value and if development error detection is enabled (i.e. CAN_DEV_ERROR_DETECT equals ON), then the Can shall report development error code CAN_E_PARAM_CONTROLLER to the Det_ReportError service of the DET module.() [CAN458] If parameter Baudrate of Can_CheckBaudrate(Controller, Baudrate)has an invalid value and if development error detection is enabled (i.e. CAN_DEV_ERROR_DETECT equals ON), then the Can shall report development error code CAN_E_PARAM_BAUDRATE to the Det_ReportError service of the DET module.() [CAN459] Caveats of Can_CheckBaudrate(Controller, Baudrate): The call context is on task level (polling mode). The Can must be initialized after Power ON.() [CAN460] Configuration of Can_CheckBaudrate(Controller, Baudrate): If Can supports changing of the baudrate and thus this service, shall be configurable via CAN_CHANGE_BAUDRATE_SUPPORT.()
60 of 101
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 8.3.2 Services affecting one single CAN Controller
Parameters (inout): Parameters (out): None Std_ReturnType E_OK: Service request accepted, baudrate change started Return value: E_NOT_OK: Service request not accepted This service shall change the baudrate of the CAN controller. Description:
() The function Can_ChangeBaudrate re-initializes the CAN controller and the controller specific settings (see CAN062). Different sets of static configuration may have been configured. The parameter *Config points to the hardware specific structure that describes the configuration (see CAN291). Global CAN Hardware Unit settings must not be changed. Only a subset of parameters may be changed during runtime (see chapter 10). For further explanation, see also chapter 7.4 The CAN controller must be in state STOPPED when this function is called (see CAN256 and CAN260). The CAN controller is in state STOPPED after (re-)initialization (see CAN259). [CAN450] If development error detection for the Can module is enabled: The function Can_ChangeBaudrate shall raise the error CAN_E_UNINIT if the driver is not yet initialized.() [CAN451] If development error detection for the Can module is enabled: The function Can_ChangeBaudrate shall raise the error CAN_E_PARAM_BAUDRATE if the parameter Baudrate has an invalid value.()
61 of 101 Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 [CAN452] If development error detection for the Can module is enabled: The function Can_ChangeBaudrate shall raise the error CAN_E_PARAM_CONTROLLER if the parameter Controller is out of range.() [CAN453] If development error detection for the Can module is enabled: if the controller is not in state STOPPED, the function Can_ChangeBaudrate shall raise the error CAN_E_TRANSITION.() [CAN461] If hardware supports wake-up (i.e. CanWakeupSupport == true), it shall be checked during controller initialization if there was a wake-up event on the specific CAN controller. If a wake-up event has been detected, the wake-up shall directly be reported to the EcuM via EcuM_SetWakeupEvent call-back function. ()
Parameters (inout): Parameters (out): None Can_ReturnType CAN_OK: request accepted CAN_NOT_OK: request not accepted, a development error Return value: occurred This function performs software triggered state transitions of the CAN controller Description: State machine.
() [CAN017] The function Can_SetControllerMode shall perform software triggered state transitions of the CAN controller State machine. See also [BSW12169] (BSW12169, BSW01053)
62 of 101
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 [CAN384] Each time the CAN controller state machine is triggered with the state transition value CAN_T_START, the function Can_SetControllerMode shall reinitialize the CAN controller with the same controller configuration set previously used by functions Can_ChangeBaudrate or Can_Init.() Refer to CAN048 for the case of a wakeup event from CAN bus occurred during sleep transition. [CAN294] The function Can_SetControllerMode shall disable the wake-up interrupt, while checking the wake-up status. () [CAN196] The function Can_SetControllerMode shall enable interrupts that are needed in the new state. () [CAN425] Enabling of CAN interrupts shall not be executed, when CAN interrupts have been disabled by function Can_DisableControllerInterrupts.() [CAN197] The function Can_SetControllerMode shall disable interrupts that are not allowed in the new state. () [CAN426] Disabling of CAN interrupts shall not be executed, when CAN interrupts have been disabled by function Can_DisableControllerInterrupts.() Caveat: The behavior of the transmit operation is undefined when the 'software' state in the CanIf module is already CANIF_CS_STARTED, but the CAN controller is not yet in operational mode. The CanIf module must ensure that the function is not called before the previous call of Can_SetControllerMode returned. The CanIf module is responsible not to initiate invalid transitions. [CAN198] If development error detection for the Can module is enabled: if the module is not yet initialized, the function Can_SetControllerMode shall raise development error CAN_E_UNINIT and return CAN_NOT_OK.() [CAN199] If development error detection for the Can module is enabled: if the parameter Controller is out of range, the function Can_SetControllerMode shall raise development error CAN_E_PARAM_CONTROLLER and return CAN_NOT_OK.()
63 of 101
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 [CAN200] If development error detection for the Can module is enabled: if an invalid transition has been requested, the function Can_SetControllerMode shall raise the error CAN_E_TRANSITION and return CAN_NOT_OK.()
Service ID[hex]: Sync/Async: Reentrancy: Parameters (in): Parameters (inout): Parameters (out): None None Return value: This function disables all interrupts for this CAN controller. Description:
(BSW00312) [CAN049] The function Can_DisableControllerInterrupts shall access the CAN controller registers to disable all interrupts for that CAN controller only, if interrupts for that CAN Controller are enabled.(BSW01043) [CAN202] When Can_DisableControllerInterrupts has been called several times, Can_EnableControllerInterrupts must be called as many times before the interrupts are re-enabled.() Implementation note: The function Can_DisableControllerInterrupts can increase a counter on every execution that indicates how many Can_EnableControllerInterrupts need to be called before the interrupts will be enabled (incremental disable). [CAN204] The Can module shall track all individual enabling and disabling of interrupts in other functions (i.e. Can_SetControllerMode) , so that the correct interrupt enable state can be restored.() Implementation example: - in 'interrupts enabled mode': For each interrupt state change does not only modify the interrupt enable bit, but also a software flag. - in 'interrupts disabled mode': only the software flag is modified.
64 of 101 Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 - Can_DisableControllerInterrupts and Can_EnableControllerInterrupts do not modify the software flags. - Can_EnableControllerInterrupts reads the software flags to re-enable the correct interrupts. [CAN205] If development error detection for the Can module is enabled: The function Can_DisableControllerInterrupts shall raise the error CAN_E_UNINIT if the driver not yet initialized.() [CAN206] If development error detection for the Can module is enabled: The function Can_DisableControllerInterrupts shall raise the error CAN_E_PARAM_CONTROLLER if the parameter Controller is out of range.() 8.3.2.4 Can_EnableControllerInterrupts [CAN232]
Service name: Syntax: Can_EnableControllerInterrupts void Can_EnableControllerInterrupts( uint8 Controller ) 0x05 Synchronous Reentrant Controller CAN controller for which interrupts shall be re-enabled None
Service ID[hex]: Sync/Async: Reentrancy: Parameters (in): Parameters (inout): Parameters (out): None None Return value: This function enables all allowed interrupts. Description:
(BSW00312) [CAN050] The function Can_EnableControllerInterrupts shall enable all interrupts that must be enabled according the current software status.(BSW01043) CAN202 applies to this function. [CAN208] The function Can_EnableControllerInterrupts shall perform no action when Can_DisableControllerInterrupts has not been called before.() See also implementation example for Can_DisableControllerInterrupts. [CAN209] If development error detection for the Can module is enabled: The function Can_EnableControllerInterrupts shall raise the error CAN_E_UNINIT if the driver not yet initialized.()
65 of 101 Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 [CAN210] If development error detection for the Can module is enabled: The function Can_EnableControllerInterrupts shall raise the error CAN_E_PARAM_CONTROLLER if the parameter Controller is out of range.() 8.3.2.5 Can_CheckWakeup [CAN360]
Service name: Syntax: Can_CheckWakeup Can_ReturnType Can_CheckWakeup( uint8 Controller ) 0x0b Synchronous Non Reentrant Controller Controller to be checked for a wakeup. None
Service ID[hex]: Sync/Async: Reentrancy: Parameters (in): Parameters (inout): Parameters (out): None Can_ReturnType CAN_OK: A wakeup was detected for the given controller. CAN_NOT_OK: No wakeup was detected for the given Return value: controller. This function checks if a wakeup has occurred for the given controller. Description:
() [CAN361] The function Can_CheckWakeup shall check if the requested CAN controller has detected a wakeup. If a wakeup event was successfully detected since the last go to SLEEP, the function shall return CAN_OK, otherwise CAN_NOT_OK. () [CAN362] If development error detection for the Can module is enabled: The function Can_CheckWakeup shall raise the error CAN_E_UNINIT if the driver is not yet initialized.() [CAN363] If development error detection for the Can module is enabled: The function Can_CheckWakeup shall raise the error CAN_E_PARAM_CONTROLLER if the parameter Controller is out of range.()
66 of 101
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 8.3.3 Services affecting a Hardware Handle
Parameters (inout): Parameters (out): None Can_ReturnType CAN_OK: Write command has been accepted CAN_NOT_OK: development error occurred Return value: CAN_BUSY: No TX hardware buffer available or pre-emptive call of Can_Write that can't be implemented re-entrant -Description:
(BSW00312) The function Can_Write first checks if the hardware transmit object that is identified by the HTH is free and if another Can_Write is ongoing for the same HTH. [CAN212] The function Can_Write shall perform following actions if the hardware transmit object is free: The mutex for that HTH is set to 'signaled' the ID, DLC and SDU are put in a format appropriate for the hardware (if necessary) and copied in the appropriate hardware registers/buffers. All necessary control operations to initiate the transmit are done The mutex for that HTH is released The function returns with CAN_OK(BSW01049) [CAN213] The function Can_Write shall perform no actions if the hardware transmit object is busy with another transmit request for an L-PDU that has higher priority than that for the current request: The transmission of the L-PDU with higher priority shall not be cancelled and the function Can_Write is left without any actions. The function Can_Write shall return CAN_BUSY(BSW01049)
67 of 101
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 [CAN215] The function Can_Write shall perform following actions if the hardware transmit object is busy with another transmit request for an L-PDU that has lower priority than that for the current request: The transmission of the L-PDU with lower priority shall be cancelled (asynchronously) in case transmit cancellation functionality is enabled. Compare to chapter 7.5.1.2. The function Can_Write shall return CAN_BUSY() [CAN434] The function Can_Write shall perform following actions if the hardware transmit object is busy with another transmit request for an L-PDU that has identical priority than that for the current request: The transmission of the L-PDU with identical priority shall be cancelled (asynchronously) in case CanIdenticalIdCancellation is enabled. Compare to chapter 7.5.1.2. The transmission of the L-PDU with identical priority shall not be cancelled in case CanIdenticalIdCancellation is disabled and the function Can_Write is left without any actions. The function Can_Write shall return CAN_BUSY() [CAN214] The function Can_Write shall return CAN_BUSY if a preemptive call of Can_Write has been issued, that could not be handled reentrant (i.e. a call with the same HTH).(BSW00312, BSW01049) [CAN275] The function Can_Write shall be non-blocking.() [CAN216] If development error detection for the Can module is enabled: The function Can_Write shall raise the error CAN_E_UNINIT and shall return CAN_NOT_OK if the driver is not yet initialized.() [CAN217] If development error detection for the Can module is enabled: The function Can_Write shall raise the error CAN_E_PARAM_HANDLE and shall return CAN_NOT_OK if the parameter Hth is not a configured Hardware Transmit Handle. () [CAN218] If development error detection for the Can module is enabled: The function Can_Write shall raise the error CAN_E_PARAM_DLC and shall return CAN_NOT_OK if the length is more than 8 byte.() [CAN219] If development error detection for the Can module is enabled: The function Can_Write shall raise the error CAN_E_PARAM_POINTER and shall return CAN_NOT_OK if the parameter PduInfo or the SDU pointer inside PduInfo is a nullpointer.()
68 of 101 Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
[CAN443] The L-PDU-Callout API shall be defined as: FUNC(boolean, COM_APPL_CODE) <LPDU_CalloutName>
( uint8 Can_IdType uint8 const uint8 ) Hrh, CanId, CanDlc, *CanSduPtr
() where <LPDU_CalloutName> has to be substituted with the concrete L-PDU callout name which is configurable, see CAN434_Conf. [CAN444] If the L-PDU callout returns false, the L-PDU shall not be processed any
further. ()
8.4.2 Enabling/Disabling wakeup notification [CAN445] Can driver shall use the following APIs provided by Icu driver, to enable and disable the wakeup event notification: - Icu_EnableNotification
-
Icu_DisableNotification()
[CAN446] Icu_EnableNotification shall be called when "external" Can controllers have been transitioned to SLEEP state (CANIF_CS_SLEEP).() [CAN447] Icu_DisableNotification "external" Can controllers have been transitioned to STOPPED state (CANIF_CS_STOPPED).()
69 of 101
- AUTOSAR confidential -
() [CAN031] The function Can_MainFunction_Write shall perform the polling of TX confirmation and TX cancellation confirmation when CanTxProcessing is set to POLLING.(BSW00432, BSW00373, BSW00376, BSW157) [CAN178] The Can module may implement the function Can_MainFunction_Write as empty define in case no polling at all is used.() [CAN179] If development error detection for the module Can is enabled: The function Can_MainFunction_Write shall raise the error CAN_E_UNINIT if the driver is not yet initialized.() [CAN441] The API name of Can_MainFunction_Write() shall obey the following pattern: - Can_MainFunction_Wrtte_0() - Can_MainFunction_Write_1() - Can_MainFunction_Write_2()
70 of 101 Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 - Can_MainFunction_Write_3() - ... and so on, if more than one period (see CAN356_Conf) is supported.()
() [CAN108] The function Can_MainFunction_Read shall perform the polling of RX indications when CanRxProcessing is set to POLLING.(BSW00432, BSW157) [CAN180] The Can module may implement the function Can_MainFunction_Read as empty define in case no polling at all is used.() [CAN181] If development error detection for the Can module is enabled: The function Can_MainFunction_Read shall raise the error CAN_E_UNINIT if the driver is not yet initialized.() [CAN442] The API name of Can_MainFunction_Read() shall obey the following pattern: - Can_MainFunction_Read_0() - Can_MainFunction_Read_1() - Can_MainFunction_Read_2() - Can_MainFunction_Read_3() - ... and so on, if more than one period (see CAN358_Conf) is supported.() 8.5.1.3 Can_MainFunction_BusOff [CAN227]
Service name: Syntax: Can_MainFunction_BusOff void Can_MainFunction_BusOff( void )
Document ID 011: AUTOSAR_SWS_CANDriver
71 of 101
- AUTOSAR confidential -
() [CAN109] The function Can_MainFunction_BusOff shall perform the polling of busoff events that are configured statically as 'to be polled'.(BSW00432, BSW157) [CAN183] The Can module may implement the function Can_MainFunction_BusOff as empty define in case no polling at all is used.() [CAN184] If development error detection for the Can module is enabled: The function Can_MainFunction_BusOff shall raise the error CAN_E_UNINIT if the driver is not yet initialized.() 8.5.1.4 Can_MainFunction_Wakeup [CAN228]
Service name: Syntax: Can_MainFunction_Wakeup void Can_MainFunction_Wakeup( void ) 0x0a FIXED_CYCLIC This function performs the polling of wake-up events that are configured statically as 'to be polled'.
() [CAN112] The function Can_MainFunction_Wakeup shall perform the polling of wake-up events that are configured statically as 'to be polled'. (BSW00432, BSW157) [CAN185] The Can module may implement the function
Can_MainFunction_Wakeup as empty define in case no polling at all is used.() [CAN186] If development error detection for the Can module is enabled: The function Can_MainFunction_Wakeup shall raise the error CAN_E_UNINIT if the driver is not yet initialized.()
72 of 101
- AUTOSAR confidential -
() [CAN369] The function Can_MainFunction_Mode shall implement the polling of CAN status register flags to detect transition of CAN Controller state. Compare to chapter 7.3.2.() [CAN379] If development error detection for the Can module is enabled: The function Can_MainFunction_Mode shall raise the error CAN_E_UNINIT if the driver is not yet initialized.()
(BSW00387, BSW01055)
73 of 101 Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 8.6.2 Optional Interfaces This chapter defines all interfaces that are required to fulfill an optional functionality of the module. [CAN235]
API function Description CanIf_CancelTxConfirmation This service informs CanIf that a L-PDU shall be buffered in CanIf Txbuffer from CAN hardware object to avoid priority inversion. Dem_ReportErrorStatus Queues the reported events from the BSW modules (API is only used by BSW modules). The interface has an asynchronous behavior, because the processing of the event is done within the Dem main function. Det_ReportError Service to report development errors. EcuM_CheckWakeup This callout is called by the EcuM to poll a wakeup source. It shall also be called by the ISR of a wakeup source to set up the PLL and check other wakeup sources that may be connected to the same interrupt. Icu_DisableNotification This function disables the notification of a channel. Icu_EnableNotification This function enables the notification on the given channel.
(BSW12056, BSW01054) 8.6.3 Configurable interfaces There is no configurable target for the Can module. The Can module always reports to CanIf module.
74 of 101
- AUTOSAR confidential -
9 Sequence diagrams
9.1 Interaction between Can and CanIf module
For sequence diagrams see the CanIf module Specification [5]. There are described the sequences for Transmission, Reception and Error Handling.
75 of 101
- AUTOSAR confidential -
10 Configuration specification
This chapter defines configuration parameters and their clustering into containers. In order to support the specification Chapter 10.1 describes fundamentals. It also specifies a template (table) you shall use for the parameter specification. We intend to leave Chapter 10.1 in the specification to guarantee comprehension. Chapter 10.2 specifies the structure (containers) and the parameters of the Can module. Chapter 10.3 specifies published information of the Can module.
10.1.2 Variants Variants describe sets of configuration parameters. E.g., variant 1: only pre-compile time configuration parameters; variant 2: mix of pre-compile- and post build timeconfiguration parameters. In one variant a parameter can only be of one configuration class.
10.1.3 Containers Containers structure the set of configuration parameters. This means:
76 of 101 Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 all configuration parameters are kept in containers. (sub-) containers can reference (sub-) containers. It is possible to assign a multiplicity to these references. The multiplicity then defines the possible number of instances of the contained parameters.
10.1.4 Specification template for configuration parameters The following tables consist of three sections: the general section the configuration parameter section the section of included/referenced containers specifies whether the configuration parameter shall be of configuration class Pre-compile time or not
Pre-compile time
Label x --
Description The configuration parameter shall be of configuration class Pre-compile time. The configuration parameter shall never be of configuration class Pre-compile time.
Link time
specifies whether the configuration parameter shall be of configuration class Link time or not
Label x --
Description The configuration parameter shall be of configuration class Link time. The configuration parameter shall never be of configuration class Link time.
Post Build
specifies whether the configuration parameter shall be of configuration class Post Build or not
Label x L M --
Description The configuration parameter shall be of configuration class Post Build and no specific implementation is required. Loadable the configuration parameter shall be of configuration class Post Build and only one configuration parameter set resides in the ECU. Multiple the configuration parameter shall be of configuration class Post Build and is selected out of a set of multiple parameters by passing a dedicated pointer to the init function of the module. The configuration parameter shall never be of configuration class Post Build.
- AUTOSAR confidential -
Specification of CAN Driver V4.0.0 R4.0 Rev 3 [CAN022] The code configuration of the Can module is CAN controller specific. If the CAN controller is sited on-chip, the code generation tool for the Can module is Controller specific. If the CAN controller is an external device, the generation tool must not be Controller specific.(BSW159) [CAN047] The configuration data shall be human readable. (BSW160) [CAN024] The valid values that can be configured are hardware dependent. Therefore the rules and constraints can't be given in the standard. The configuration tool is responsible to do a static configuration checking, also regarding dependencies between modules (i.e. Port driver, MCU driver etc.)(BSW167, BSW12463) 10.2.1 Variants The Can module provides two variants of configuration sets: [CAN220] VARIANT-PRE-COMPILE: Only pre-compile configuration parameters.() [CAN221] VARIANT-POST-BUILD: Mix of pre compile- and post build time configuration parameters.()
78 of 101
- AUTOSAR confidential -
+container +subContainer CanGeneral : EcucParamConfContainerDef upperMultiplicity = 1 lowerMultiplicity = 1 CanController : EcucParamConfContainerDef upperMultiplicity = * lowerMultiplicity = 1 +destination CanControllerRef : EcucReferenceDef +reference
79 of 101
- AUTOSAR confidential -
+subContainer CanControllerId : EcucIntegerParamDef upperMultiplicity = 1 lowerMultiplicity = 1 symbolicNameValue = true min = 0 max = 255 CanController : EcucParamConfContainerDef upperMultiplicity = * lowerMultiplicity = 1 +reference
+parameter
CanControllerActivation : EcucBooleanParamDef
+parameter
+subContainer
CanWakeupSupport : EcucBooleanParamDef
+parameter +reference
CanControllerDefaultBaudrate : EcucReferenceDef
+subContainer
+parameter
CanTxProcessing : EcucEnumerationParamDef
+literal
+literal
+parameter
CanRxProcessing : EcucEnumerationParamDef
+literal +literal
+parameter
+parameter
CanWakeupProcessing : EcucEnumerationParamDef
+literal
80 of 101
- AUTOSAR confidential -
+parameter
+parameter
+parameter
+parameter
+parameter
81 of 101
- AUTOSAR confidential -
+parameter
CanHardwareCancellation : EcucBooleanParamDef
CanMultiplexedTransmission : EcucBooleanParamDef
+parameter CanMainFunctionRWPeriods : EcucParamConfContainerDef +parameter CanMainFunctionReadPeriod : EcucFloatParamDef lowerMultiplicity = 0 upperMultiplicity = * min = 0.001 max = 65.535 +parameter +subContainer CanMainFunctionWritePeriod : EcucFloatParamDef +parameter lowerMultiplicity = 0 upperMultiplicity = * min = 0.001 max = 65.535
+parameter
CanIdenticalIdCancellation : EcucBooleanParamDef
+reference +parameter
CanCounterRef : EcucReferenceDef
+destination
+parameter
82 of 101
- AUTOSAR confidential -
83 of 101
- AUTOSAR confidential -
+literal
+parameter +subContainer
+parameter
+reference
CanControllerRef : EcucReferenceDef
+literal +destination STANDARD : EcucEnumerationLiteralDef CanFilterMask : EcucParamConfContainerDef upperMultiplicity = * lowerMultiplicity = 0 +reference CanMainFunctionRWPeriodRef : EcucReferenceDef lowerMultiplicity = 0 upperMultiplicity = 1 +destination CanMainFunctionRWPeriods : EcucParamConfContainerDef
84 of 101
- AUTOSAR confidential -
10.2.2 Can
Module Name Module Description Included Containers Container Name CanConfigSet CanGeneral Can This container holds the configuration of a single CAN Driver.
Multiplicity Scope / Dependency 1 This is the multiple configuration set container for CAN Driver This container contains the parameters related each CAN 1 Driver Unit.
10.2.3 CanGeneral
CAN328_Conf : SWS Item CanGeneral{CanDriverGeneralConfiguration} Container Name This container contains the parameters related each CAN Driver Unit. Description Configuration Parameters SWS Item Name Description CAN436_Conf : CanChangeBaudrateApi {CAN_CHANGE_BAUDRATE_API} The support of the Can_ChangeBaudrate API is optional. If this parameter is set to true the Can_ChangeBaudrate API shall be supported. Otherwise the API is not supported. 1 EcucBooleanParamDef false X All Variants Pre-compile time -Link time -Post-build time scope: ECU CAN064_Conf : CanDevErrorDetection {CAN_DEV_ERROR_DETECT} Switches the Development Error Detection and Notification ON or OFF. 1 EcucBooleanParamDef -X All Variants Pre-compile time -Link time -Post-build time scope: Can module CAN069_Conf : CanHardwareCancellation {CAN_HW_TRANSMIT_CANCELLATION} Specifies if hardware cancellation shall be supported.ON or OFF 1 EcucBooleanParamDef -X All Variants Pre-compile time
Document ID 011: AUTOSAR_SWS_CANDriver
Scope / Dependency SWS Item Name Description Multiplicity Type Default value ConfigurationClass
Scope / Dependency SWS Item Name Description Multiplicity Type Default value ConfigurationClass
85 of 101
- AUTOSAR confidential -
Scope / Dependency
Scope / Dependency SWS Item Name Description Multiplicity Type Range Default value ConfigurationClass
Scope / Dependency SWS Item Name Description CAN434_Conf : CanLPduReceiveCalloutFunction This parameter defines the existence and the name of a callout function that is called after a successful reception of a received CAN Rx L-PDU. If this parameter is omitted no callout shall take place. 0..1 EcucFunctionNameDef ----X All Variants Pre-compile time -Link time -Post-build time scope: module CAN355_Conf : CanMainFunctionBusoffPeriod This parameter describes the period for cyclic call to Can_MainFunction_Busoff. Unit is seconds. 0..1 EcucFloatParamDef 0.001 .. 65.535 -X All Variants Pre-compile time -Link time -Post-build time
Document ID 011: AUTOSAR_SWS_CANDriver
Scope / Dependency SWS Item Name Description Multiplicity Type Range Default value ConfigurationClass
86 of 101
- AUTOSAR confidential -
Scope / Dependency SWS Item Name Description Multiplicity Type Range Default value ConfigurationClass CAN357_Conf : CanMainFunctionWakeupPeriod This parameter describes the period for cyclic call to Can_MainFunction_Wakeup. Unit is seconds. 0..1 EcucFloatParamDef 0.001 .. 65.535 -X All Variants Pre-compile time -Link time -Post-build time
Scope / Dependency SWS Item Name Description Multiplicity Type Default value ConfigurationClass CAN095_Conf : CanMultiplexedTransmission {CAN_MULTIPLEXED_TRANSMISSION} Specifies if multiplexed transmission shall be supported.ON or OFF 1 EcucBooleanParamDef -X All Variants Pre-compile time -Link time -Post-build time scope: Can module, CanIf module dependency: CAN Hardware Unit supports multiplexed transmission CAN113_Conf : CanTimeoutDuration {CAN_TIMEOUT_DURATION} Specifies the maximum time for blocking function until a timeout is detected. Unit is seconds. 1 EcucFloatParamDef 0.001 .. 65.535 -X All Variants Pre-compile time -Link time -Post-build time scope: Can module CAN106_Conf : CanVersionInfoApi {CAN_VERSION_INFO_API}
Document ID 011: AUTOSAR_SWS_CANDriver
Scope / Dependency
SWS Item Name Description Multiplicity Type Range Default value ConfigurationClass
- AUTOSAR confidential -
Scope / Dependency SWS Item Name Description CAN430_Conf : CanSupportTTCANRef The parameter refers to CanIfSupportTTCAN parameter in the CAN Interface Module configuration. The CanIfSupportTTCAN parameter defines whether TTCAN is supported. 1 Reference to [ CanIfPrivateCfg ] X All Variants Pre-compile time -Link time -Post-build time
Scope / Dependency --
10.2.4 CanController
SWS Item Container Name Description Configuration Parameters SWS Item Name Description Multiplicity Type Range ConfigurationClass
88 of 101
CAN354_Conf : CanController{CanController} This container contains the configuration parameters of the CAN controller(s).
CAN314_Conf : CanBusoffProcessing {CAN_BUSOFF_PROCESSING} Enables / disables API Can_MainFunction_BusOff() for handling busoff events in polling mode. 1 EcucEnumerationParamDef INTERRUPT Interrupt Mode of operation. POLLING Polling Mode of operation. X All Variants Pre-compile time
Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
Scope / Dependency SWS Item Name Description Multiplicity Type Range Default value ConfigurationClass
Scope / Dependency SWS Item Name Description CAN316_Conf : CanControllerId {CAN_DRIVER_CONTROLLER_ID} This parameter provides the controller ID which is unique in a given CAN Driver. The value for this parameter starts with 0 and continue without any gaps. 1 EcucIntegerParamDef (Symbolic Name generated for this parameter) 0 .. 255 -X All Variants Pre-compile time -Link time -Post-build time
Scope / Dependency SWS Item Name Description Multiplicity Type Range ConfigurationClass CAN317_Conf : CanRxProcessing {CAN_RX_PROCESSING} Enables / disables API Can_MainFunction_Read() for handling PDU reception events in polling mode. 1 EcucEnumerationParamDef INTERRUPT Interrupt Mode of operation. POLLING Polling Mode of operation. X All Variants Pre-compile time -Link time -Post-build time
CAN318_Conf :
Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
Scope / Dependency SWS Item Name Description Multiplicity Type Range ConfigurationClass CAN319_Conf : CanWakeupProcessing {CAN_WAKEUP_PROCESSING} Enables / disables API Can_MainFunction_Wakeup() for handling wakeup events in polling mode. 1 EcucEnumerationParamDef INTERRUPT Interrupt Mode of operation. POLLING Polling Mode of operation. X All Variants Pre-compile time -Link time -Post-build time
Scope / Dependency SWS Item Name Description Multiplicity Type Default value ConfigurationClass CAN330_Conf : CanWakeupSupport {CAN_WAKEUP_SUPPORT} CAN driver support for wakeup over CAN Bus. 1 EcucBooleanParamDef -X All Variants Pre-compile time -Link time -Post-build time
Scope / Dependency SWS Item Name Description Multiplicity Type ConfigurationClass CAN435_Conf : CanControllerDefaultBaudrate {CAN_CONTROLLER_DEFAULT_BAUDRATE} Reference to baudrate configuration container configured for the Can Controller. 1 Reference to [ CanControllerBaudrateConfig ] X VARIANT-PRE-COMPILE Pre-compile time -Link time X VARIANT-POST-BUILD Post-build time
CAN313_Conf : CanCpuClockRef {CAN_CPU_CLOCK_REFERENCE} Reference to the CPU clock configuration, which is set in the MCU driver configuration 1 Reference to [ McuClockReferencePoint ] X All Variants Pre-compile time
Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
Scope / Dependency
Included Containers Container Name Multiplicity Scope / Dependency CanControllerBaudrateConfi This container contains bit timing related configuration 1..* g parameters of the CAN controller(s). This container contains the configuration (parameters) of the CanFilterMask 0..* CAN Filter Mask(s). This container is only included and valid if TTCAN SWS is used and TTCAN is enabled. This container contains the configuration parameters of the TTCAN controller(s) (which 0..1 CanTTController are needed in addition to the configuration parameters of the CAN controller(s)). CanTTController is only included, if the controller supports TTCAN.
10.2.5 CanControllerBaudrateConfig
SWS Item Container Name Description Configuration Parameters SWS Item Name Description Multiplicity Type Range Default value ConfigurationClass CAN005_Conf : CanControllerBaudRate {CAN_CONTROLLER_BAUD_RATE} Specifies the baudrate of the controller in kbps. 1 EcucIntegerParamDef 0 .. 2000 -X VARIANT-PRE-COMPILE Pre-compile time -Link time X VARIANT-POST-BUILD Post-build time scope: Can module CAN073_Conf : CanControllerPropSeg {CAN_CONTROLLER_PROP_SEG} Specifies propagation delay in time quantas. 1
Document ID 011: AUTOSAR_SWS_CANDriver
CAN387_Conf : CanControllerBaudrateConfig{CanControllerBaudrateConfig} This container contains bit timing related configuration parameters of the CAN controller(s).
- AUTOSAR confidential -
X -X
VARIANT-PRE-COMPILE VARIANT-POST-BUILD
Scope / Dependency SWS Item Name Description Multiplicity Type Range Default value ConfigurationClass
Scope / Dependency SWS Item Name Description Multiplicity Type Range Default value ConfigurationClass
CAN074_Conf : CanControllerSeg1 {CAN_CONTROLLER_PHASE_SEG1} Specifies phase segment 1 in time quantas. 1 EcucIntegerParamDef 0 .. 255 -X VARIANT-PRE-COMPILE Pre-compile time -Link time X VARIANT-POST-BUILD Post-build time scope: Can module CAN075_Conf : CanControllerSeg2 {CAN_CONTROLLER_PHASE_SEG2} Specifies phase segment 2 in time quantas. 1 EcucIntegerParamDef 0 .. 255 -X VARIANT-PRE-COMPILE Pre-compile time -Link time X VARIANT-POST-BUILD Post-build time scope: Can module CAN383_Conf : CanControllerSyncJumpWidth {CAN_CONTROLLER_SJW} Specifies the synchronization jump width for the controller in time quantas. 1 EcucIntegerParamDef 0 .. 255 -X VARIANT-PRE-COMPILE Pre-compile time -Link time X VARIANT-POST-BUILD Post-build time
Scope / Dependency SWS Item Name Description Multiplicity Type Range Default value ConfigurationClass
10.2.6 CanHardwareObject
SWS Item Container Name Description
92 of 101
CAN324_Conf : CanHardwareObject{CanHardwareObject} This container contains the configuration (parameters) of CAN Hardware Objects.
Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
ConfigurationClass
Scope / Dependency
ConfigurationClass
Scope / Dependency SWS Item Name Description Multiplicity Type Range Default value ConfigurationClass
Multiplicity
93 of 101
- AUTOSAR confidential -
Scope / Dependency SWS Item Name Description Multiplicity Type Range ConfigurationClass
Scope / Dependency SWS Item Name Description CAN321_Conf : CanFilterMaskRef {CAN_MASK_REFERENCE} Reference to the filter mask that is used for hardware filtering together with the CAN_ID_VALUE. Different CanHardwareObjects with different CanIdTypes (STANDARD, MIXED, EXTENDED) can share the same CanFilterMask (i.e., the CanFilterMaskRef parameters of these CanHardwareObjects reference the very same CanFilterMask container). This shall be allowed and must be supported by the configuration generators. The CanFilterMaskRef is omitted for 1) CanHardwareObjects with CanObjectType set to TRANSMIT 2) CanHardwareObjects with CanObjectType set to RECEIVE if only a single Can ID shall be received via this CanHardwareObjects (i.e., exact match with CanIdValue) 0..1 Reference to [ CanFilterMask ] X VARIANT-PRE-COMPILE Pre-compile time -Link time X VARIANT-POST-BUILD Post-build time
CAN438_Conf : CanMainFunctionRWPeriodRef {CAN_CONTROLLER_REFERENCE} Reference to CAN Controller to which the HOH is associated to. 0..1 Reference to [ CanMainFunctionRWPeriods ] X VARIANT-PRE-COMPILE Pre-compile time -Link time
Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
Multiplicity Scope / Dependency This container is only included and valid if TTCAN SWS is used and TTCAN is enabled. This container contains the configuration (parameters) of TTCAN triggers for Hardware CanTTHardwareObjectTrigge 0..* Objects, which are additional to the configuration r (parameters) of CAN Hardware Objects. CanTTHardwareObjectTrigger is only included, if the controller supports TTCAN.
10.2.7 CanFilterMask
SWS Item Container Name Description Configuration Parameters SWS Item Name Description CAN066_Conf : CanFilterMaskValue {CAN_FILTER_MASK_VALUE} Describes a mask for hardware-based filtering of CAN identifiers. The CAN identifiers of incoming messages are masked with the appropriate CanFilterMaskValue. Bits holding a 0 mean don't care, i.e. do not compare the message's identifier in the respective bit position. The mask shall be build by filling with leading 0. In case of CanIdType EXTENDED or MIXED a 29 bit mask shall be build. In case of CanIdType STANDARD a 11 bit mask shall be build 1 EcucIntegerParamDef 0 .. 4294967295 -X VARIANT-PRE-COMPILE Pre-compile time -Link time X VARIANT-POST-BUILD Post-build time scope: Can module, CanIf module dependency: The filter mask settings must be known by the CanIf configuration for optimization of the SW filters. CAN351_Conf : CanFilterMask{CanFilterMask} This container contains the configuration (parameters) of the CAN Filter Mask(s).
Scope / Dependency
No Included Containers
10.2.8 CanConfigSet
CAN343_Conf : SWS Item CanConfigSet [Multi Config Container] Container Name This is the multiple configuration set container for CAN Driver Description Configuration Parameters Included Containers
95 of 101 Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
10.2.9 CanMainFunctionRWPeriods
CAN437_Conf : SWS Item CanMainFunctionRWPeriods{CAN_MAIN_FUNCTION_RWPERIODS} Container Name -Description Configuration Parameters SWS Item Name Description CAN356_Conf : CanMainFunctionReadPeriod This parameter describes the period for cyclic call to Can_MainFunction_Read. Unit is seconds. Different poll-cycles will be configurable if more than one CanMainFunctionReadPeriod is configured. In this case multiple Can_MainFunction_Read() will be provided by the CAN Driver module. 0..* EcucFloatParamDef 0.001 .. 65.535 -X All Variants Pre-compile time -Link time -Post-build time
Scope / Dependency SWS Item Name Description CAN358_Conf : CanMainFunctionWritePeriod This parameter describes the period for cyclic call to Can_MainFunction_Write. Unit is seconds. Different poll-cycles will be configurable if more than one CanMainFunctionWritePeriod is configured. In this case multiple Can_MainFunction_Write() will be provided by the CAN Driver module. 0..* EcucFloatParamDef 0.001 .. 65.535 -X All Variants Pre-compile time -Link time -Post-build time
96 of 101
- AUTOSAR confidential -
97 of 101
- AUTOSAR confidential -
11 Changes to Release 3
11.1 Deleted SWS Items
SWS Item CAN248 CAN241 CAN292, CAN293 CAN029, CAN081, CAN295, CAN296, CAN297, CAN298, CAN092, CAN093 CAN063 CAN247, CAN249 CAN301 CAN054, CAN055 CAN243, CAN421 CAN176, CAN192, CAN201 Rationale Requirement was wrong. CAN174 contains the correct description. Requirement changed into a implementation hint, because it is not a requirement for the Can module. Requirement not necessary for these IR functions. Requirements removed, because Can module does not report production errors to DEM. Requirement was erroneously re-implemented caused by a wrong metamodel. Requirement changed into implementation hint, because these are requirements to the ECU State Manager. Requirement changed into implementation hint, because it is not requirement for the Can module. General SPAL requirements BSW12058 and BSW12059 does not exist anymore. Requirement changed into implementation hint, because it is not a requirement to the Can module. Requirement removed, because upper layer modules perform timeout handling.
CANxxx
CANxxx_Conf
CAN101
CAN402, CAN403
Rationale Rewritten to improve understanding. Rewritten to support asynchronous state transition concept. Can_Cbk_CheckWakeup renamed to Can_CheckWakeup, because it is not a callback-function. Return type changed from Std_ReturnType to Can_Type. Meaning of return value changed to support asynchronous state transition concept. Parameter moved from CanGeneral to CanController container. Scope and dependency to CanIf module removed. Type changed from derivedEnumerationParamDef to EnumerationParamDef, because there is
Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
Rationale Id number of CanHandleType changed from CAN324_Conf to CAN323_Conf, because CAN324_Conf was given twice. Item added to support debugging concept. Item added to support debugging concept. Item added to support debugging concept. Item added to support asynchronous state transition concept. Item added to support asynchronous state transition concept. Item added to support asynchronous state transition concept. Item added to support asynchronous state transition concept. Item added to support asynchronous state transition concept. Item added to support asynchronous state transition concept. Item added to support asynchronous state transition concept. Item added to support asynchronous state transition concept. Item added to support asynchronous state transition concept. Item added to support mapping between CAN controller ID and CAN controller hardware. Item added to support CAN controller synchronization jump width. Item added to support asynchronous state transition concept. Item added to support naming convention for multiple CAN Driver. Item added to multiple CAN configuration sets. Items added to describe header file structure. Item added to support CAN_E_DATALOST development error detection. Item added to support transmit cancellation. Item added to support multiplexed transmission. Item added to support logical sleep mode. Item added to limit the support of remote frames. Item added to support [BSW01051] Transmit Confirmation
Document ID 011: AUTOSAR_SWS_CANDriver
- AUTOSAR confidential -
Formal item IDs given to the types defined in section 8.2. CAN037 split into atomic SWS items: CAN037 and CAN418 CAN033 split into atomic SWS items: CAN033, CAN419 and CAN420 CAN260 split into atomic SWS items: CAN260 and CAN422 CAN279 split into atomic SWS items: CAN279 and CAN423 CAN027 split into atomic SWS items: CAN027 and CAN424 CAN196 split into atomic SWS items: CAN196 and CAN425 CAN197 split into atomic SWS items: CAN197 and CAN426 Plain text converted into SWS item. Item added for new Can_HwHandle_Type Item added to support TTCAN. Item added to support [BSW00450] Main Function Processing for UnInitialized Modules. Items added to support configuration of cancellation functionality. Rework of Published Information
100 of 101
- AUTOSAR confidential -
101 of 101
- AUTOSAR confidential -