blob: 8b04b615e8efb99a58c4bdb4c67e80daf01118c5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# Can
```
2020-10-01:s5/net/mm8/noter/1 #2280
```
Can lever i layer 1 - 3 i OSI modellen.
## Bus
Requires that a single bit is received by all bus members.
1 is recessive, while 0 is dominant.
Recessive is the default so pull up and dominant is when the line is pulled down.
```
0 + 0 = 0
1 + 1 = 1
0 + 1 = 0 # Because 0 is dominant
```
CAN defines 0 as the dominant bit.
## Frame
Node id is also used as priority.
Smaller id gives a higher priority.
It therefore uses `CSMA/CA`.
This can be seen below:
1. First everyone starts transits zero.
2. Then nodes starts transmitting their id.
3. If a node hears something different than they are transmitting they know they are loosing.
4. The winner (TAKES IT ALL) can then send the rest of the frame.
5. Loosing nodes wait for end of frame, so they can try again.
In the ACK field the receiver sends a dominant bit to signal if the frame went fine.
This means that we are constantly listening while receiving and others can also jump in.
### Addressing
ID is not really a address.
One does not operate on source and destination but more different message ID's.
Like different sensor values have different id's, and other nodes can then subscribe on these id's.
Nodes only listen for id's they are interested in.
### Frame types
Data Frame
: a frame containing data.
Remote frame
: a request for a specific resource.
Error frame
: transmitted by a node on a error.
Overload frame
: Whaat
## Bit synchronization
Nodes need to agree on whats on the bus.
Bit time must be twice propagation time.
This means long lines give slower speeds.
### Problem
Periodic messages with different priority can give non-deteministic behavior, as their clock go in and out of phase.
This can be solved by finding a worst case and checking if it lives up to a requirement.
However this can be hard if there are many messages.
One can also run simulations.
|