6.5 KiB
6.5 KiB
TTCAN 驱动规范 (Specification of TTCAN Driver)
AUTOSAR CP Release 4.4.0 文档 ID 445: AUTOSAR_SWS_TTCANDriver
元信息
| 项目 | 内容 |
|---|---|
| 文档标题 | TTCAN 驱动规范 |
| 文档所有者 | AUTOSAR |
| 文档责任方 | AUTOSAR |
| 文档标识号 | 445 |
| 文档状态 | Final |
| 所属 AUTOSAR 标准 | Classic Platform |
| 所属标准版本 | 4.4.0 |
文档变更历史
| 日期 | 版本 | 变更方 | 变更说明 |
|---|---|---|---|
| 2018-10-31 | 4.4.0 | AUTOSAR Release Management | 细微更正 |
| 2017-12-08 | 4.3.1 | AUTOSAR Release Management | 修正/澄清 |
| 2016-11-30 | 4.3.0 | AUTOSAR Release Management | 增加时间同步功能 |
| 2015-07-31 | 4.2.2 | AUTOSAR Release Management | 编辑修正 |
| 2014-10-31 | 4.2.1 | AUTOSAR Release Management | 初始正式版本 |
目录
1. 介绍
本规范规定了 AUTOSAR 基础软件模块 TTCAN 驱动 (TTCAN) 的功能、API 和配置。
TTCAN 驱动是 CAN 驱动的扩展,增加了时间触发能力。它支持 ISO 11898-4 Level 1 和 Level 2。
2. 缩略语
| 缩略语 | 描述 |
|---|---|
| API | Application Programming Interface |
| BSW | Basic Software |
| CAN | Controller Area Network |
| CanDrv | CAN Driver |
| DET | Default Error Tracer |
| ISR | Interrupt Service Routine |
| L1 | TTCAN Level 1 |
| L2 | TTCAN Level 2 |
| MCAL | Microcontroller Abstraction Layer |
| NTU | Network Time Unit |
| TT | Time Triggered |
| TTCAN | Time Triggered CAN |
| TUR | Time Unit Ratio |
3. 相关文档
3.1 输入文档
- [1] Layered Software Architecture
- [2] General Requirements on Basic Software Modules
- [3] Specification of Standard Types
- [4] Specification of CAN Driver
- [5] Specification of TTCAN Interface
- [6] Specification of Default Error Tracer
- [7] Specification of ECU Configuration
- [8] Basic Software Module Description Template
- [9] General Specification of Basic Software Modules
3.2 相关标准
- [10] ISO 11898-4:2004
3.3 相关规范
SWS BSW General [9] 适用。
4. 约束与假设
4.1 限制
TTCAN 驱动支持的硬件应符合 ISO 11898-4 标准。
4.2 适用车域
适用于使用 TTCAN 的车域。
5. 与其他模块的依赖
| 模块 | 依赖关系 |
|---|---|
| CanIfTTCAN | 上层模块 |
| MCAL | 硬件抽象 |
| EcuM | ECU 状态管理 |
| Os | 调度 |
6. 需求可追溯性
| 需求 ID | 描述 | 满足者 |
|---|---|---|
| SRS_BSW_00101 | 初始化 | SWS_TTCAN_00010 |
| SRS_BSW_00407 | 版本信息 | SWS_TTCAN_00020 |
| SRS_TTCAN_00001 | 时间触发支持 | SWS_TTCAN_00030 |
| SRS_TTCAN_00010 | 矩阵处理 | SWS_TTCAN_00040 |
[摘要] 完整需求追溯表见原文 PDF 第 15-22 页。
7. 功能规范
7.1 TTCAN 概述
TTCAN 通过 Master Message 和 Reference Message 提供时间触发通信。
7.2 状态机
| 状态 | 描述 |
|---|---|
| TTCAN_UNINIT | 模块未初始化 |
| TTCAN_READY | 模块已初始化,等待启动 |
| TTCAN_RUNNING | 正在 TT 通信 |
| TTCAN_INIT_DONE | 初始化完成 |
7.3 矩阵处理
- Master Message 启动矩阵周期
- Reference Message 同步时间
- 每个 Basic Cycle 包含多个 Time Window
7.4 时间同步
7.4.1 L1 同步
基于 Reference Message 时刻。
7.4.2 L2 同步
增加 TUR 调整,精确同步。
7.5 错误分类
7.5.1 开发错误
| 错误名 | 错误码 | 含义 |
|---|---|---|
| TTCAN_E_UNINIT | 0x01 | 未初始化 |
| TTCAN_E_PARAM_POINTER | 0x02 | NULL 指针 |
| TTCAN_E_PARAM_CONTROLLER | 0x03 | 无效控制器 |
8. API 规范
8.1 导入类型
| 模块 | 头文件 | 导入类型 |
|---|---|---|
| Can | Can.h | Can_PduType, Can_ReturnType |
| ComStack_Types | ComStack_Types.h | NetworkHandleType |
| Std_Types | Std_Types.h | Std_ReturnType, Std_VersionInfoType |
8.2 类型定义
8.2.1 TTCAN_ConfigType
typedef struct TTCAN_ConfigType TTCAN_ConfigType;
8.2.2 TTCAN_TimeType
typedef uint32 TTCAN_TimeType;
8.2.3 TTCAN_SyncStateType
typedef enum {
TTCAN_SYNC_OFF,
TTCAN_PRE_SYNC,
TTCAN_IN_SYNC,
TTCAN_LOST_SYNC
} TTCAN_SyncStateType;
8.3 函数定义
8.3.1 TTCAN_Init
void TTCAN_Init(const TTCAN_ConfigType* Config)
8.3.2 TTCAN_GetVersionInfo
void TTCAN_GetVersionInfo(Std_VersionInfoType* versioninfo)
8.3.3 TTCAN_Transmit
Std_ReturnType TTCAN_Transmit(
Can_HwHandleType Hth,
const Can_PduType* PduInfo
)
8.3.4 TTCAN_GetSyncState
Std_ReturnType TTCAN_GetSyncState(
uint8 Controller,
TTCAN_SyncStateType* StatePtr
)
8.3.5 TTCAN_GetTimeValue
Std_ReturnType TTCAN_GetTimeValue(
uint8 Controller,
TTCAN_TimeType* TimeValue
)
8.3.6 TTCAN_SetMatrixCycleStart
Std_ReturnType TTCAN_SetMatrixCycleStart(
uint8 Controller,
TTCAN_TimeType MatrixCycleStart
)
8.3.7 TTCAN_StartCommunication / TTCAN_StopCommunication
启动/停止 TT 通信。
8.4 回调通知
8.4.1 TTCAN_TT_RxIndication
TT 时间触发 RX 指示。
8.4.2 TTCAN_TT_TxConfirmation
TT 发送确认。
8.4.3 TTCAN_GlobalTimeSyncEvent
全局时间同步事件。
8.5 期望接口
8.5.1 强制接口
- CanIf_TTRxIndication
- CanIf_TTTxConfirmation
- CanIf_TTGlobalTimeSyncEvent
- Det_ReportError
9. 时序图
[摘要] 详细时序图见原文 PDF 第 38-44 页。
10. 配置规范
10.1 容器与配置参数
10.1.1 TTCAN
根容器。
10.1.2 TTCANGeneral
| 参数 | 类型 | 说明 |
|---|---|---|
| TTCANDevErrorDetect | bool | DET 启用 |
| TTCANVersionInfoApi | bool | 版本信息 API |
| TTCANLevel | enum | TTCAN_L1 / TTCAN_L2 |
| TTCANNTU | float | NTU 长度(秒) |
10.1.3 TTCANController
TTCAN 控制器配置(MasterCycle、ReferenceMessage 等)。
10.1.4 TTCANTriggerMessage
触发消息配置。
[摘要] 完整配置详见原文 PDF 第 45-54 页。
翻译说明
- 本译本基于 AUTOSAR CP 4.4.0 的 TTCAN 驱动规范 (Document ID 445,共 54 页)
- 摘要标记位置:第 6 章需求追溯、第 9 章时序图、第 10 章配置