autonomousguy 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +96 -0
- package/bin/validate.js +119 -0
- package/package.json +54 -0
- package/skills/autosar/autosar-bsw/SKILL.md +586 -0
- package/skills/autosar/autosar-bsw/references/adaptive-ap.md +104 -0
- package/skills/autosar/autosar-bsw/references/boot-nvm-power.md +127 -0
- package/skills/autosar/autosar-bsw/references/com-stack.md +118 -0
- package/skills/autosar/autosar-bsw/references/comms-protocol.md +130 -0
- package/skills/autosar/autosar-swc/SKILL.md +531 -0
- package/skills/autosar/autosar-swc/references/adaptive-ap.md +69 -0
- package/skills/autosar/autosar-swc/references/rte-api.md +149 -0
- package/skills/change-management/change-and-impact/SKILL.md +259 -0
- package/skills/change-management/change-and-impact/references/html-report-template.html +154 -0
- package/skills/code-quality/code-review/SKILL.md +287 -0
- package/skills/code-quality/code-review/references/adaptive-ap.md +30 -0
- package/skills/code-quality/code-review/references/html-report-template.html +154 -0
- package/skills/code-quality/misra/SKILL.md +306 -0
- package/skills/code-quality/misra/references/html-report-template.html +154 -0
- package/skills/code-quality/misra/references/rules.md +72 -0
- package/skills/debugging/embedded-debugging/SKILL.md +250 -0
- package/skills/debugging/embedded-debugging/references/adaptive-ap.md +33 -0
- package/skills/debugging/embedded-debugging/references/html-report-template.html +154 -0
- package/skills/requirements/requirements/SKILL.md +298 -0
- package/skills/safety/iso26262/SKILL.md +199 -0
- package/skills/safety/iso26262/references/asil-table.md +86 -0
- package/skills/testing/embedded-testing/SKILL.md +288 -0
- package/skills/workspace/codebase-analysis/SKILL.md +548 -0
- package/skills/workspace/codebase-analysis/references/adaptive-ap.md +77 -0
- package/skills/workspace/codebase-analysis/references/html-report-template.html +154 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Adaptive AUTOSAR (AP) variant - platform services and communication
|
|
2
|
+
|
|
3
|
+
Use this when the input names Adaptive AUTOSAR (AP): ara::com, ara::exec, ara::diag, ara::per, C++14+, POSIX/Linux/QNX, service-oriented (SOA), manifests, Execution Management, or State Management.
|
|
4
|
+
|
|
5
|
+
AP has no BSW layer and no COM stack. The Classic BSW concerns map onto ara:: Functional Clusters provided by the Adaptive Platform Foundation and Services. Communication is service-oriented over SOME/IP or DDS, not signal-based over CAN PDUs. Configuration is by JSON/ARXML manifests deployed per machine and per executable, not by static EB Tresos / DaVinci ECU config.
|
|
6
|
+
|
|
7
|
+
## Classic-to-Adaptive mapping
|
|
8
|
+
|
|
9
|
+
| Classic concern | Adaptive equivalent | Notes |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| Com / PduR (signals, I-PDUs) | ara::com (services, events, methods, fields) | proxy on consumer, skeleton on provider; service discovery; transport binding SOME/IP or DDS |
|
|
12
|
+
| Dcm / Dem (UDS, DTCs) | ara::diag | diagnostic server, DTCs, operation/monitor, ara::diag::DTCInformation |
|
|
13
|
+
| NvM / MemIf / Fee (persistence) | ara::per | key-value storage and file storage, redundancy/CRC via per config |
|
|
14
|
+
| Os (tasks, schedule, ExclusiveArea) | ara::exec + POSIX scheduling | Execution Management starts/stops processes; State/Function-Group state; threads, not OS tasks |
|
|
15
|
+
| Wdg (watchdog) | ara::phm (Platform Health Management) | supervised entities, alive/deadline/logical supervision |
|
|
16
|
+
| Det / Dlt | ara::log | severity-leveled logging, not DET hooks |
|
|
17
|
+
|
|
18
|
+
## Modes (AP)
|
|
19
|
+
|
|
20
|
+
### Service configuration (replaces BSW configuration)
|
|
21
|
+
|
|
22
|
+
1. Identify the service interface(s): events, methods, fields. Define in the service interface description (ARXML) and the deployment manifest (SOME/IP service ID, instance ID, event/method IDs).
|
|
23
|
+
2. Decide transport binding: SOME/IP (signal-based service binding, service discovery on UDP) or DDS.
|
|
24
|
+
3. Provider: implement the skeleton, OfferService(), set fields, Send() events. Consumer: FindService() / StartFindService(), create the proxy, Subscribe() to events, call methods (returning ara::core::Future).
|
|
25
|
+
4. Persistence: declare ara::per key-value or file storage in the manifest; access via OpenKeyValueStorage / OpenFileStorage.
|
|
26
|
+
5. Diagnostics: configure ara::diag DTCs and the diagnostic server manifest; map monitors to events.
|
|
27
|
+
6. Produce a manifest checklist and flag common deployment errors (mismatched service/instance IDs, missing service discovery, machine vs executable manifest scope).
|
|
28
|
+
|
|
29
|
+
### Manifest debugging (replaces ARXML debugging)
|
|
30
|
+
|
|
31
|
+
1. Classify the error: service/instance ID mismatch between provider and consumer manifests; missing required-port to provided-port binding; network endpoint (IP/port) wrong; transport binding mismatch (SOME/IP vs DDS); data type mismatch in the service interface.
|
|
32
|
+
2. Locate it in the right manifest scope: Machine Manifest (machine-wide, network, ara::com transport), Execution Manifest (per process, startup, state dependency), Service Instance Manifest (service-to-instance mapping).
|
|
33
|
+
3. Provide the corrected manifest fragment and a prevention rule.
|
|
34
|
+
|
|
35
|
+
### Startup / execution troubleshooting (replaces RTE generation troubleshooting)
|
|
36
|
+
|
|
37
|
+
There is no RTE generation in AP. The analogous failures are Execution Management and binding failures:
|
|
38
|
+
1. Process does not start: Execution Manifest startup config, dependency on a Function-Group state not reached, missing resource/permission.
|
|
39
|
+
2. Service not discovered: service discovery not running, service/instance ID mismatch, network down, firewall/multicast for SOME/IP-SD.
|
|
40
|
+
3. Method call hangs or throws: ara::core::Future timeout, skeleton not offering, ara::com error (kServiceNotAvailable). Inspect the ara::com::ErrorCode.
|
|
41
|
+
4. Give the exact manifest field or ara::com call to fix and a post-fix validation step.
|
|
42
|
+
|
|
43
|
+
### Service communication debugging (replaces COM stack debugging)
|
|
44
|
+
|
|
45
|
+
1. Classify symptom: event not received (subscription, offer, discovery), wrong value (serialization / data type / endianness in SOME/IP), intermittent (network loss, QoS), method error (Future error code).
|
|
46
|
+
2. Confirm network level first: capture SOME/IP or DDS traffic (Wireshark with the SOME/IP dissector, or DDS spy). Check service discovery (Offer/Subscribe/SubscribeAck) before blaming the application.
|
|
47
|
+
3. Walk the path: provider skeleton Offer/Send -> transport (SOME/IP-SD + serialization) -> consumer proxy Subscribe + event receive handler. This replaces the CanIf -> PduR -> Com layer-walk.
|
|
48
|
+
4. Probe with ara::log at each stage; inspect ara::core::Result / ErrorCode rather than DET hooks.
|
|
49
|
+
5. Common anti-patterns: service/instance ID mismatch; consumer subscribes before provider offers and never retries; serialization config mismatch (alignment, endianness, struct order) between provider and consumer; QoS/reliability mismatch in DDS.
|
|
50
|
+
|
|
51
|
+
## Output format (AP)
|
|
52
|
+
|
|
53
|
+
Begin with `Platform: Adaptive (AP)`. Then use the matching layout:
|
|
54
|
+
|
|
55
|
+
### Service configuration
|
|
56
|
+
```
|
|
57
|
+
## Service Configuration: <Service/Interface>
|
|
58
|
+
|
|
59
|
+
### Service Interface
|
|
60
|
+
[events / methods / fields, with SOME/IP or DDS binding]
|
|
61
|
+
|
|
62
|
+
### Deployment Manifest
|
|
63
|
+
| Manifest | Field | Value | Notes |
|
|
64
|
+
|----------|-------|-------|-------|
|
|
65
|
+
|
|
66
|
+
### Provider / Consumer Steps
|
|
67
|
+
[skeleton Offer + Send ; proxy Find + Subscribe + call]
|
|
68
|
+
|
|
69
|
+
### Common Errors & Resolutions
|
|
70
|
+
| Error | Root Cause | Fix |
|
|
71
|
+
|
|
72
|
+
### Validation Checklist
|
|
73
|
+
- [ ] ...
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Manifest debug / startup / communication
|
|
77
|
+
```
|
|
78
|
+
## AP Debug Report
|
|
79
|
+
|
|
80
|
+
### Classification
|
|
81
|
+
[event-not-received | wrong-value | method-error | startup | manifest-mismatch]
|
|
82
|
+
|
|
83
|
+
### Network/Discovery Confirmation
|
|
84
|
+
[SOME/IP-SD or DDS capture - service offered? subscribed? acked?]
|
|
85
|
+
|
|
86
|
+
### Path Walk
|
|
87
|
+
| Stage | Check | Expected | Observed / Next Probe |
|
|
88
|
+
|-------|-------|----------|------------------------|
|
|
89
|
+
| Provider skeleton | Offer/Send | ... | ... |
|
|
90
|
+
| Transport (SOME/IP/DDS) | discovery + serialization | ... | ... |
|
|
91
|
+
| Consumer proxy | Subscribe + handler | ... | ... |
|
|
92
|
+
|
|
93
|
+
### Most Likely Root Cause
|
|
94
|
+
[manifest field or ara:: call + one-sentence why]
|
|
95
|
+
|
|
96
|
+
### Fix
|
|
97
|
+
[corrected manifest fragment or ara:: code change]
|
|
98
|
+
|
|
99
|
+
### Safety Impact
|
|
100
|
+
[None / ASIL-X - re-verification scope]
|
|
101
|
+
|
|
102
|
+
### Prevention Rule
|
|
103
|
+
[one line]
|
|
104
|
+
```
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# Boot, NVM & power - reference
|
|
2
|
+
|
|
3
|
+
Depth for the **Boot, NVM & power** mode of the AUTOSAR BSW skill. Classic AUTOSAR (CP) focus.
|
|
4
|
+
ASCII only, no em dashes. Consult the relevant sub-area; do not load the whole file unless needed.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 1. Boot / startup
|
|
9
|
+
|
|
10
|
+
### 1a. Bare-metal startup
|
|
11
|
+
|
|
12
|
+
Reset vector -> startup code -> C runtime -> `main`:
|
|
13
|
+
|
|
14
|
+
1. Reset vector points to the startup routine (often `Reset_Handler`).
|
|
15
|
+
2. Set the initial stack pointer; configure the clock tree (PLL, flash wait states) so the rest of
|
|
16
|
+
init runs at the intended frequency.
|
|
17
|
+
3. Copy initialised data (`.data`) from flash to RAM; zero the `.bss` section.
|
|
18
|
+
4. Run C++ static constructors if any (`.init_array`).
|
|
19
|
+
5. Call `main` (or the AUTOSAR `EcuM_Init` path).
|
|
20
|
+
|
|
21
|
+
Common faults: `.bss` not zeroed (random initial state), `.data` copy skipped (initialised globals
|
|
22
|
+
read as garbage), wrong startup file for the silicon variant, vector table not at the address the
|
|
23
|
+
core expects (VTOR misconfigured).
|
|
24
|
+
|
|
25
|
+
### 1b. Classic AUTOSAR startup (EcuM / BswM)
|
|
26
|
+
|
|
27
|
+
Phase order:
|
|
28
|
+
|
|
29
|
+
- `EcuM_Init` -> `StartPreOS` sequence: init MCU/MCAL drivers needed before the OS (Mcu, Port, Dio,
|
|
30
|
+
Gpt, Wdg + WdgM init, BSW scheduler basics).
|
|
31
|
+
- `StartOS` (the OS starts, tasks begin scheduling).
|
|
32
|
+
- `StartPostOS` sequence: `NvM_ReadAll`, communication stack init (CanIf, Com, PduR, ComM, Nm),
|
|
33
|
+
Dem/Dcm init, then RTE start and SWC init runnables.
|
|
34
|
+
|
|
35
|
+
Driver init order must follow the dependency chain MCAL -> ECU abstraction -> BSW services -> RTE ->
|
|
36
|
+
SWC. A module initialised out of order (e.g. Com before its PDU config, or a SWC reading NvM data
|
|
37
|
+
before `NvM_ReadAll` finished) is the usual root cause of startup defects.
|
|
38
|
+
|
|
39
|
+
BswM arbitrates modes from rules (condition -> action list). It coordinates startup, wakeup,
|
|
40
|
+
shutdown, and partial networking actions.
|
|
41
|
+
|
|
42
|
+
### 1c. Bootloader and reprogramming (UDS flash download)
|
|
43
|
+
|
|
44
|
+
Typical UDS sequence for a flash update (ISO 14229 + ISO 15765 transport):
|
|
45
|
+
|
|
46
|
+
1. `0x10 02` - switch to programming session (often via `0x10 03` extended first).
|
|
47
|
+
2. `0x27` - security access (request seed, send computed key).
|
|
48
|
+
3. `0x31` - RoutineControl: erase memory / check programming preconditions.
|
|
49
|
+
4. `0x34` - RequestDownload (memory address + size, compression/encryption format).
|
|
50
|
+
5. `0x36` - TransferData (repeated blocks, block sequence counter).
|
|
51
|
+
6. `0x37` - RequestTransferExit.
|
|
52
|
+
7. `0x31` - RoutineControl: check memory / verify checksum or signature.
|
|
53
|
+
8. `0x11 01` - ECU reset; jump to the new application.
|
|
54
|
+
|
|
55
|
+
Design points:
|
|
56
|
+
- Dual-bank / A-B layout lets the old image stay valid until the new one is verified.
|
|
57
|
+
- An application-validity marker (and CRC or signature over the app) gates the bootloader's
|
|
58
|
+
jump-to-application decision; never jump to an unverified image.
|
|
59
|
+
- Keep the bootloader minimal and independently updatable only with great care (a bricked
|
|
60
|
+
bootloader is unrecoverable in the field).
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 2. NVM storage stack
|
|
65
|
+
|
|
66
|
+
### 2a. NvM block descriptor options
|
|
67
|
+
|
|
68
|
+
- `NvMBlockManagementType`: `NVM_BLOCK_NATIVE` (one copy), `NVM_BLOCK_REDUNDANT` (two copies, survives
|
|
69
|
+
one corrupted instance), `NVM_BLOCK_DATASET` (indexed set, e.g. per-variant calibration).
|
|
70
|
+
- CRC: `NvMBlockUseCrc` + `NvMCrcType` (CRC16/CRC32) detects torn or corrupted writes on read.
|
|
71
|
+
- Write policy: immediate (`NvM_WriteBlock` flushed promptly) vs deferred (queued, flushed by
|
|
72
|
+
`NvM_WriteAll` or the main function). Deferred trades latency for throughput - the source of many
|
|
73
|
+
"lost after power cut" bugs.
|
|
74
|
+
- `NvMWriteBlockOnce`: TRUE for write-once data (e.g. end-of-line VIN); FALSE for values that change.
|
|
75
|
+
- `NvMSelectBlockForWriteAll`: TRUE to include the block in the `NvM_WriteAll` sweep.
|
|
76
|
+
- Default value: applied on first-ever init (or after a failed CRC with no redundant copy).
|
|
77
|
+
|
|
78
|
+
### 2b. Fee / Ea over MemIf
|
|
79
|
+
|
|
80
|
+
NvM does not touch flash directly. It goes NvM -> MemIf -> Fee (flash EEPROM emulation) or Ea
|
|
81
|
+
(EEPROM abstraction) -> the flash/EEPROM driver. Fee/Ea manage logical blocks over physical
|
|
82
|
+
sectors, including sector switching when a sector fills.
|
|
83
|
+
|
|
84
|
+
### 2c. Wear leveling
|
|
85
|
+
|
|
86
|
+
Flash sectors have a finite erase-cycle budget. Strategies: rotate writes across sectors, coalesce
|
|
87
|
+
writes (avoid writing unchanged blocks), and budget the erase count against vehicle lifetime
|
|
88
|
+
(e.g. N writes/day x 15 years must stay under the endurance rating with margin). Watch write
|
|
89
|
+
amplification - a small logical write can trigger a full sector erase + copy.
|
|
90
|
+
|
|
91
|
+
### 2d. Sequencing
|
|
92
|
+
|
|
93
|
+
- Startup: `NvM_ReadAll` populates RAM mirrors; consumers must wait for completion.
|
|
94
|
+
- Runtime: `NvM_WriteBlock` (single) / `NvM_MainFunction` services the job queue.
|
|
95
|
+
- Shutdown: `NvM_WriteAll` flushes all selected blocks; poll `NvM_GetStatus() == NVM_IDLE` or use
|
|
96
|
+
the job-end notification before cutting power.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 3. Power / state management
|
|
101
|
+
|
|
102
|
+
### 3a. EcuM sleep / wakeup state machine
|
|
103
|
+
|
|
104
|
+
`RUN` -> (GoSleep requested) -> run shutdown/sleep prep (including `NvM_WriteAll`) -> `SLEEP`
|
|
105
|
+
(MCU low-power, selected wakeup sources armed) -> wakeup event -> wakeup validation -> back to `RUN`.
|
|
106
|
+
|
|
107
|
+
Wakeup sources (CAN, LIN, local pin, timer) must be configured and validated; a spurious wakeup
|
|
108
|
+
that fails validation should return the ECU to sleep rather than fully starting up.
|
|
109
|
+
|
|
110
|
+
### 3b. Partial networking (PN)
|
|
111
|
+
|
|
112
|
+
Partial Network Clusters (PNC) let parts of the network sleep while others stay awake. A
|
|
113
|
+
PN-capable CAN transceiver wakes only on a configured wakeup frame. ComM and Nm coordinate which
|
|
114
|
+
PNCs are active; the transceiver stays in a selective wake mode otherwise. Saves quiescent current.
|
|
115
|
+
|
|
116
|
+
### 3c. Ordered shutdown
|
|
117
|
+
|
|
118
|
+
BswM runs a shutdown action list. The critical ordering rule: complete `NvM_WriteAll` (and confirm
|
|
119
|
+
`NVM_IDLE`) BEFORE commanding the transceiver to Sleep and the MCU to low-power. If sleep is entered
|
|
120
|
+
while deferred NvM jobs are still queued, the data is lost on power-down. Confirm worst-case
|
|
121
|
+
WriteAll time fits the board hold-up time after ignition-off.
|
|
122
|
+
|
|
123
|
+
### 3d. Low-power MCU modes
|
|
124
|
+
|
|
125
|
+
SLEEP / STOP / STANDBY (names vary by silicon) trade wake latency and retained state against
|
|
126
|
+
current draw. Combine with clock gating and peripheral power-down. Verify which RAM/registers are
|
|
127
|
+
retained in the chosen mode so post-wake state is correct.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# AUTOSAR COM Stack — Layer-by-Layer Reference
|
|
2
|
+
|
|
3
|
+
Comprehensive reference for debugging the AUTOSAR Classic COM stack (CanDrv → CanIf → PduR → Com → RTE → SWC), TX and RX directions. Use alongside the SKILL.md COM-stack mode for fast layer-walk lookups.
|
|
4
|
+
|
|
5
|
+
## RX path (top-down from bus to SWC)
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Can_Hw (hardware FIFO / mailbox)
|
|
9
|
+
→ Can_RxIndication (CanDrv ISR)
|
|
10
|
+
→ CanIf_RxIndication (CanIf RX dispatch)
|
|
11
|
+
→ PduR_CanIfRxIndication (PduR routing)
|
|
12
|
+
→ Com_RxIndication (Com signal unpack)
|
|
13
|
+
→ Rte_Write_* (RTE to SWC)
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Layer responsibilities
|
|
17
|
+
|
|
18
|
+
| Layer | Owns | EB Tresos containers |
|
|
19
|
+
|--------|--------------------------------------------------------------|-----------------------------------------------|
|
|
20
|
+
| CanDrv | Hardware filters, mailbox config, baudrate, controller state | `CanHardwareObject`, `CanController` |
|
|
21
|
+
| CanIf | PDU dispatching, user upper-layer routing | `CanIfRxPduCfg`, `CanIfTxPduCfg`, `CanIfRxPduCanIdMask` |
|
|
22
|
+
| PduR | Routing table (CanIf ↔ Com / TP) | `PduRRoutingPath`, `PduRSrcPdu`, `PduRDestPdu` |
|
|
23
|
+
| Com | Signal pack/unpack, scaling, init, timeout | `ComIPdu`, `ComSignal`, `ComTimeoutNotification` |
|
|
24
|
+
|
|
25
|
+
## TX path (top-down from SWC to bus)
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
Rte_Write_* (SWC)
|
|
29
|
+
→ Com_SendSignal (Com signal pack)
|
|
30
|
+
→ Com_TriggerIPduSend (Com → PduR)
|
|
31
|
+
→ PduR_ComTransmit (PduR routing)
|
|
32
|
+
→ CanIf_Transmit (CanIf → hw)
|
|
33
|
+
→ Can_Write (CanDrv)
|
|
34
|
+
→ Can_Hw (hardware mailbox / FIFO)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Symptom → first layer to suspect
|
|
38
|
+
|
|
39
|
+
| Symptom | First suspect |
|
|
40
|
+
|----------------------------------------------------------|---------------------|
|
|
41
|
+
| No signal at all (always init value) | CanDrv (filters, controller state) |
|
|
42
|
+
| Wrong value (constant, but wrong) | Com (byte order, scaling, start bit) |
|
|
43
|
+
| Sometimes correct, sometimes init | CanIf RX buffer overflow / Com main-function task overrun |
|
|
44
|
+
| Correct after ignition cycle, then drifts to init | Com `ComTimeout` firing |
|
|
45
|
+
| Signal in CAN trace but SWC sees init | CanIf filter / PduR routing |
|
|
46
|
+
| SWC writes, nothing on bus (TX) | `Com_SendSignal` return + `Com_MainFunctionTx` |
|
|
47
|
+
| TX intermittent | `ComTxModeMode`, `ComMinimumDelayTime`, CanIf mailbox congestion |
|
|
48
|
+
|
|
49
|
+
## RX layer-walk checklist (when frame IS on bus but SWC sees nothing)
|
|
50
|
+
|
|
51
|
+
### CanDrv
|
|
52
|
+
- Controller `CAN_CS_STARTED`? `CanIf_GetControllerMode`.
|
|
53
|
+
- Hardware filter mask: `CanHardwareObject` → `CanHwObjectCount`, `CanIdValue`, `CanIdMask`. **Common bug**: mask requires bits the actual ID doesn't have.
|
|
54
|
+
- `Can_MainFunction_Read` actually being called? Default 1 ms; if its OS task is overrun or disabled, RX frames sit in the mailbox until overwritten.
|
|
55
|
+
|
|
56
|
+
### CanIf
|
|
57
|
+
- `CanIfRxPduCfg`: entry exists for this CAN ID + Controller + HRH?
|
|
58
|
+
- `CanIfRxPduCanIdMask` / `CanIfRxPduCanIdRange`: runtime CAN ID matches?
|
|
59
|
+
- `CanIfUserRxIndicationUL` must be `PDUR` (not `CDD` or `NONE`).
|
|
60
|
+
- If `CanIfPublicReadRxPduDataApi` is enabled and PduR uses polled read, confirm PduR is calling `CanIf_ReadRxPduData`.
|
|
61
|
+
|
|
62
|
+
### PduR
|
|
63
|
+
- `PduRRoutingPath` for this Rx PDU has destination `PDUR_COM`.
|
|
64
|
+
- `PduRSrcPdu` references the CanIf Rx PDU; `PduRDestPdu` references the Com Rx PDU.
|
|
65
|
+
- If routing is to a TP module instead (CanTp / FrTp), the frame won't reach Com.
|
|
66
|
+
|
|
67
|
+
### Com
|
|
68
|
+
- `ComIPdu` exists for the routed PDU; `ComIPduDirection = RECEIVE`.
|
|
69
|
+
- `ComSignal`: `ComBitPosition`, `ComBitSize`, `ComSignalEndianness` (`BIG_ENDIAN` / `LITTLE_ENDIAN` — must match DBC `@1+` vs `@0+`), `ComSignalType`, `ComInitValue`.
|
|
70
|
+
- `ComNotification` callback fires? Add a counter. If yes, problem is downstream (RTE/SWC). If no, upstream.
|
|
71
|
+
- `ComTimeoutNotification` / `ComFirstTimeout`: confirm timeout isn't triggering before first valid frame, replacing the value with `ComInitValue`.
|
|
72
|
+
|
|
73
|
+
## TX layer-walk checklist (when SWC writes but bus shows nothing)
|
|
74
|
+
|
|
75
|
+
### SWC / RTE
|
|
76
|
+
- Did the SWC actually call `Rte_Write_*`? Check return code.
|
|
77
|
+
- Confirm `Com_SendSignal` was reached (DET, breakpoint, callout).
|
|
78
|
+
|
|
79
|
+
### Com
|
|
80
|
+
- `ComIPdu` `ComIPduDirection = SEND`.
|
|
81
|
+
- `ComTxModeMode`: `PERIODIC`, `DIRECT`, or `MIXED`.
|
|
82
|
+
- `DIRECT` requires `ComTxModeNumberOfRepetitions ≥ 1` after `Com_SendSignal`.
|
|
83
|
+
- `PERIODIC` requires `Com_MainFunctionTx` to be running.
|
|
84
|
+
- `ComMinimumDelayTime`: two `Com_SendSignal` calls within this window are merged.
|
|
85
|
+
- `ComTxIPduUnusedAreasDefault`: non-zero defaults can corrupt unused bits.
|
|
86
|
+
|
|
87
|
+
### PduR
|
|
88
|
+
- `PduRRoutingPath` exists for the Com Tx PDU with destination `PDUR_CANIF`.
|
|
89
|
+
|
|
90
|
+
### CanIf
|
|
91
|
+
- `CanIfTxPduCfg` exists, references correct `CanHardwareObject` (HTH).
|
|
92
|
+
- `CanIfTxPduUserTxConfirmationUL = PDUR` so the confirmation closes the Com loop.
|
|
93
|
+
- Mailbox congestion: if `Can_Write` returns `CAN_BUSY` and the BSW retry strategy isn't configured, transmissions silently drop.
|
|
94
|
+
|
|
95
|
+
### CanDrv
|
|
96
|
+
- Bus-off state (`CanIf_GetControllerMode` → `CANIF_CS_STOPPED` indicates bus-off recovery).
|
|
97
|
+
- Controller not started, baudrate mismatch.
|
|
98
|
+
|
|
99
|
+
## Probe / instrumentation patterns
|
|
100
|
+
|
|
101
|
+
- DET hooks: enable `CANIF_DEV_ERROR_DETECT` and `COM_DEV_ERROR_DETECT`; route `Det_ReportError` to a trace buffer.
|
|
102
|
+
- Counters in `ComNotification`, `CanIf_RxIndication` user callback.
|
|
103
|
+
- For RX: temporarily map the signal to a debug output port or NvM trace block.
|
|
104
|
+
- For TX: capture the bus with the same CAN tool that proved the frame was missing.
|
|
105
|
+
|
|
106
|
+
## Common configuration anti-patterns
|
|
107
|
+
|
|
108
|
+
- CanIf Rx PDU uses a CAN ID mask that excludes the runtime ID (0x1FFFFFFF mask applied to an 11-bit ID, or vice versa).
|
|
109
|
+
- Com `ComSignalEndianness` mismatched with DBC: `@1+` is `LITTLE_ENDIAN` (Intel), `@0+` is `BIG_ENDIAN` (Motorola).
|
|
110
|
+
- `ComBitPosition` interpreted differently by sender and receiver — the DBC tool and AUTOSAR generator may number bits in opposite directions for Motorola signals.
|
|
111
|
+
- `Com_MainFunctionRx` and `Com_MainFunctionTx` mapped to different OS tasks with different priorities — starvation risk.
|
|
112
|
+
- `ComFilterAlgorithm` other than `ALWAYS` silently dropping values that don't match the filter (`MASKED_NEW_DIFFERS_X` is the classic gotcha).
|
|
113
|
+
|
|
114
|
+
## Bus-level pre-check (always step 1)
|
|
115
|
+
|
|
116
|
+
Never debug the stack before confirming what's on the wire:
|
|
117
|
+
- **RX**: capture with CANalyzer / BusMaster / candump / PCAN-View. Confirm expected CAN ID, DLC matches PDU length, cycle time within tolerance.
|
|
118
|
+
- **TX**: same capture. If your ECU should be transmitting and the frame isn't on the bus, before debugging the stack confirm hardware: bus terminated (60 Ω), transceiver not in Sleep, CAN_H/CAN_L not swapped, no bus-off state.
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Communication protocol - reference
|
|
2
|
+
|
|
3
|
+
Depth for the **Communication protocol** mode of the AUTOSAR BSW skill. Classic AUTOSAR (CP) focus,
|
|
4
|
+
with SOME/IP and DoIP that also appear on Adaptive. ASCII only, no em dashes. Consult the relevant
|
|
5
|
+
sub-area; do not load the whole file unless needed.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. On-board buses
|
|
10
|
+
|
|
11
|
+
### 1a. CAN and CAN FD
|
|
12
|
+
|
|
13
|
+
Frame and signal layout:
|
|
14
|
+
- A signal is defined by start bit, bit length, byte order, factor, offset, and value range.
|
|
15
|
+
- Byte order: DBC `@1+` = Intel / little-endian, `@0+` = Motorola / big-endian. AUTOSAR Com
|
|
16
|
+
`ComSignalEndianness` must match the DBC, and `ComBitPosition` follows the AUTOSAR convention
|
|
17
|
+
(which differs from DBC start-bit numbering for Motorola signals - a frequent defect).
|
|
18
|
+
- Classic CAN: up to 8 data bytes, DLC 0..8.
|
|
19
|
+
- CAN FD: payload up to 64 bytes; DLC values 9..15 map to lengths 12,16,20,24,32,48,64. Bit Rate
|
|
20
|
+
Switch (BRS) raises the data-phase bit rate; the arbitration phase stays at the nominal rate.
|
|
21
|
+
- Transmit modes: cyclic (fixed period), on-change (event), or mixed (cyclic + on-change).
|
|
22
|
+
- E2E protection (counter + CRC, AUTOSAR E2E profiles) for safety-relevant signals: the receiver
|
|
23
|
+
checks the counter sequence and CRC and applies a timeout/fault reaction.
|
|
24
|
+
|
|
25
|
+
### 1b. LIN
|
|
26
|
+
|
|
27
|
+
- Schedule table: the master runs frame slots on a fixed schedule; each slot is a frame header the
|
|
28
|
+
master sends, with a configured slot delay.
|
|
29
|
+
- Master/slave: the master sends the header; a configured responder (master or a slave) sends the
|
|
30
|
+
response bytes.
|
|
31
|
+
- Checksum: classic (data only) vs enhanced (data + PID); both ends must agree.
|
|
32
|
+
- Response timeout and the LIN error handling (no-response, checksum error, framing) feed the LIN
|
|
33
|
+
status and any diagnostic reaction.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 2. Transport and routing
|
|
38
|
+
|
|
39
|
+
### 2a. CanTp (ISO 15765-2) segmentation
|
|
40
|
+
|
|
41
|
+
For payloads larger than a single frame (> 7 data bytes classic, > 63 CAN FD, accounting for the
|
|
42
|
+
PCI byte):
|
|
43
|
+
- Single Frame (SF) for short messages.
|
|
44
|
+
- First Frame (FF) starts a multi-frame message and declares total length.
|
|
45
|
+
- Flow Control (FC) from the receiver: ClearToSend / Wait / Overflow, plus Block Size (BS = frames
|
|
46
|
+
between FCs) and STmin (minimum separation time between consecutive frames).
|
|
47
|
+
- Consecutive Frames (CF) carry the remaining data with a rolling sequence number.
|
|
48
|
+
- Timeouts: N_As / N_Ar (sender/receiver frame transmission), N_Bs (wait for FC), N_Cr (wait for
|
|
49
|
+
CF). A timeout aborts the segmented transfer.
|
|
50
|
+
|
|
51
|
+
### 2b. PduR routing
|
|
52
|
+
|
|
53
|
+
- Routing path types: signal routing, PDU (I-PDU) routing, and TP routing for segmented data.
|
|
54
|
+
- Gateway routing forwards PDUs between channels (e.g. CAN to CAN, CAN to Ethernet) with optional
|
|
55
|
+
gateway-on-the-fly for large TP messages.
|
|
56
|
+
- PduR also routes between the bus interface and upper layers (Com, Dcm) - a missing routing path
|
|
57
|
+
is a common reason a frame is on the bus but never reaches the SWC or the diagnostic stack.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## 3. Network management (ComM / Nm) and partial networking
|
|
62
|
+
|
|
63
|
+
- ComM: channels and users. A user requests FULL_COMMUNICATION or NO_COMMUNICATION; ComM aggregates
|
|
64
|
+
requests per channel and asks Nm to keep the bus awake or release it.
|
|
65
|
+
- Nm coordinated state machine: Repeat Message State -> Normal Operation State -> Ready Sleep State
|
|
66
|
+
-> Bus Sleep State. Nm messages keep all nodes awake together and coordinate a synchronized sleep
|
|
67
|
+
so no node is left talking to a sleeping bus.
|
|
68
|
+
- Partial Networking (PN): Partial Network Clusters (PNC) allow subsets of the network to sleep
|
|
69
|
+
while others run. A PN-capable transceiver wakes only on a configured wakeup frame. See the power
|
|
70
|
+
handling in `boot-nvm-power.md` for the transceiver/EcuM side.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## 4. Diagnostics over the bus (UDS / Dcm / Dem)
|
|
75
|
+
|
|
76
|
+
### 4a. UDS service handler - NRC check order
|
|
77
|
+
|
|
78
|
+
Validate every request in this order and return the first failing NRC:
|
|
79
|
+
1. message length -> NRC 0x13 (incorrectMessageLengthOrInvalidFormat)
|
|
80
|
+
2. service supported -> NRC 0x11 (serviceNotSupported)
|
|
81
|
+
3. sub-function supported -> NRC 0x12 (subFunctionNotSupported), or 0x7E in active session
|
|
82
|
+
4. session valid -> NRC 0x7F (serviceNotSupportedInActiveSession)
|
|
83
|
+
5. security unlocked -> NRC 0x33 (securityAccessDenied)
|
|
84
|
+
6. request in range -> NRC 0x31 (requestOutOfRange)
|
|
85
|
+
7. conditions correct -> NRC 0x22 (conditionsNotCorrect)
|
|
86
|
+
On success, the positive response SID is request SID + 0x40.
|
|
87
|
+
|
|
88
|
+
Common services: 0x10 (session control), 0x11 (ECU reset), 0x14/0x19 (clear/read DTC), 0x22/0x2E
|
|
89
|
+
(read/write DID), 0x27 (security access), 0x28 (communication control), 0x2F (IO control), 0x31
|
|
90
|
+
(routine control), 0x34-0x37 (download/transfer), 0x3E (tester present), 0x85 (control DTC setting).
|
|
91
|
+
|
|
92
|
+
In AUTOSAR these are implemented as Dcm callouts; Dcm handles session/security/response framing and
|
|
93
|
+
pending (0x78) responses for async operations. Do not parse UDS outside the Dcm framework.
|
|
94
|
+
|
|
95
|
+
### 4b. DTC status byte (ISO 14229-1)
|
|
96
|
+
|
|
97
|
+
Bit 0 testFailed, bit 1 testFailedThisOperationCycle, bit 2 pendingDTC, bit 3 confirmedDTC,
|
|
98
|
+
bit 4 testNotCompletedSinceLastClear, bit 5 testFailedSinceLastClear,
|
|
99
|
+
bit 6 testNotCompletedThisOperationCycle, bit 7 warningIndicatorRequested (MIL).
|
|
100
|
+
Never manipulate these bits directly. Report faults via Dem (`Dem_SetEventStatus` /
|
|
101
|
+
`Dem_ReportErrorStatus`); Dem manages the transitions per the configured debounce, operation
|
|
102
|
+
cycles, and aging. (Dcm/Dem configuration is in the BSW configuration mode.)
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## 5. Service-oriented Ethernet
|
|
107
|
+
|
|
108
|
+
### 5a. SOME/IP
|
|
109
|
+
|
|
110
|
+
Message format fields: Message ID (Service ID + Method/Event ID), Length, Request ID (Client ID +
|
|
111
|
+
Session ID), Protocol Version, Interface Version, Message Type (REQUEST, REQUEST_NO_RETURN,
|
|
112
|
+
NOTIFICATION, RESPONSE, ERROR), Return Code. Serialization packs parameters per the service
|
|
113
|
+
interface, big-endian by default, with configured alignment and length fields for dynamic data.
|
|
114
|
+
|
|
115
|
+
Service Discovery (SOME/IP-SD):
|
|
116
|
+
- Provider sends OfferService (service + instance + endpoint, with a TTL).
|
|
117
|
+
- Consumer sends FindService (optional) and SubscribeEventgroup (eventgroup + its own endpoint).
|
|
118
|
+
- Provider replies SubscribeEventgroupAck (or Nack). Only then are eventgroup events delivered.
|
|
119
|
+
- Events are delivered unicast or multicast; multicast requires the consumer to join the group.
|
|
120
|
+
- TTL must be renewed; TTL 0 means stop offering/subscribing.
|
|
121
|
+
|
|
122
|
+
### 5b. DoIP (ISO 13400)
|
|
123
|
+
|
|
124
|
+
- Vehicle announcement / VehicleIdentificationRequest-Response to discover the ECU on IP.
|
|
125
|
+
- Routing activation handshake: RoutingActivationRequest (source address, activation type) ->
|
|
126
|
+
RoutingActivationResponse (response code, logical addresses). UDS diagnostics only flow after a
|
|
127
|
+
successful activation.
|
|
128
|
+
- UDS is then tunneled in DoIP diagnostic messages (with source/target logical addresses) over TCP.
|
|
129
|
+
- On Classic this rides SoAd plus the SOME/IP / DoIP modules; on Adaptive the equivalent service
|
|
130
|
+
communication is provided by ara::com - state which platform applies.
|