summaryrefslogtreecommitdiff
path: root/FlightComputerBoard.mdwn
blob: e3d12ba7436d4bb3eb77296f4bf19d4bb79f86ea (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
Links:

Here's a link to documentation on the AMD Elan SC520: <http://www.amd.com/products/epd/processors/4.32bitcont/14.lan5xxfam/24.lansc520/>

----

## <a name="Info on the MOPS/520 Intel 82527"></a> Info on the MOPS/520 Intel 82527 CAN Configuration

On power up, with no configuration, the 82527 had the following properties:

- Crystal = 8.0MHz
- CLLKOUT = 4.0MHz
- Address Mode 3: (Mode1 pin = 1, Mode0 pin = 1) selects an 8-bit non-multiplexed ad-

dress data bus for either synchronous or asynchronous communication. The asynchronous mode uses R/W#, CS#, and DSACK0# (E=1). The synchronous mode uses R/W#, CS#, and E.

Clocks on board: XTAL (outboard crystal), SCLK (system ( = CAN statemachine &amp; thus CAN bitrate) clock), MCLK (memory (CPU interface) clock). Because the crystal is 8MHz, we'll stick with the defaults of FXTAL = SCLK = MCLK.

<table border=1 cellpadding=0 cellspacing=0>
  <tr>
    <td> fXTAL </td>
    <td> SCLK (DSC bit) </td>
    <td> MCLK (DMC bit) </td>
  </tr>
  <tr>
    <td> 8 MHz </td>
    <td> 8 MHz (0) </td>
    <td> 8 MHz (0) </td>
  </tr>
</table>

## <a name="Configuration registers"></a> Configuration registers

Control Register @ 0x00

<table border=1 cellpadding=0 cellspacing=0>
  <tr>
    <td> Mode </td>
    <td> Rsvd </td>
    <td> CCE </td>
    <td> Rsvd </td>
    <td> EIE </td>
    <td> SIE </td>
    <td> IE </td>
    <td> Init </td>
  </tr>
  <tr>
    <td> Configure (off bus) </td>
    <td> 0 </td>
    <td> 1 </td>
    <td> 00 </td>
    <td> 0 </td>
    <td> 0 </td>
    <td> 0 </td>
    <td> 1 </td>
  </tr>
  <tr>
    <td> Run (On bus) </td>
    <td> 0 </td>
    <td> 0 </td>
    <td> 00 </td>
    <td> 0 </td>
    <td> 1 </td>
    <td> 1 </td>
    <td> 0 </td>
  </tr>
</table>

CPU Interface Register @ 0x02

<table border=1 cellpadding=0 cellspacing=0>
  <tr>
    <td>[[RstSt]]</td>
    <td> DSC </td>
    <td> DMC </td>
    <td>[[PwD]]</td>
    <td> Sleep </td>
    <td> Mux </td>
    <td> Rsvd </td>
    <td> CEn </td>
  </tr>
  <tr>
    <td> read = 0 </td>
    <td> 0 </td>
    <td> 0 </td>
    <td> 0 </td>
    <td> 0 </td>
    <td> 0 </td>
    <td> 0 </td>
    <td> 0 </td>
  </tr>
</table>

## <a name="Bit timing on the 82527"></a> Bit timing on the 82527

We want to run the CAN bus at 1Mbps. This means 1us per bit. The CAN bus defines three time "slices" to each bit (the time it takes to transmit one bit):

<table border=1 cellpadding=0 cellspacing=0>
  <tr>
    <td> Tsync </td>
    <td> Tseg1 </td>
    <td> Tseg2 </td>
  </tr>
</table>

Each of these sections are defined in terms of "time quanta" Tq which is based on the 82527's crystal. In our case, with a 8.0MHz crystal, a Tq is 1/8MHz = 125ns. Usually if Tq &lt;&lt; Tbit, then you can do this nifty technique of sampling the bit three times and letting the samples vote on what the bit it (0 or 1). This helps with noise. However, in our case Tq ~ Tbit so we'll have to skip the "sampling option" and just take a snapshot of the bit at one time - the border between Tseg1 and Tseg2.

The sections also require certain rules:

<table border=1 cellpadding=0 cellspacing=0>
  <tr>
    <td> Tsync </td>
    <td> Tseg1 </td>
    <td> Tseg2 </td>
  </tr>
  <tr>
    <td> 1 Tq </td>
    <td> &amp;gt;= 3Tq </td>
    <td> &amp;gt;= 2Tq </td>
  </tr>
</table>

Other constraints are:

- Tseg1 &gt; = Tsjw + Tprop
- Tseg2 &gt; = Tsjw

Where the "synchronization jump width" is how many Tq the 82527 can jump in order to resynchronize bit edges. **QUESTION:** Does it specify the maximum the chip CAN jump? and the chip jumps less if necessary? Or does it always jump Tsjw?

Given all of this, it makes sense to do:

<table border=1 cellpadding=0 cellspacing=0>
  <tr>
    <td> Tsync </td>
    <td> Tseg1 </td>
    <td> Tseg2 </td>
    <td> = Total Bit Time </td>
  </tr>
  <tr>
    <td> 1 Tq </td>
    <td> 4Tq </td>
    <td> 3Tq </td>
    <td> = 8 Tq = 8 * 125ns = 1us = 1MHz </td>
  </tr>
</table>

So, in terms of registers:

Bit Timing Register 0 @ 0x3F

<table border=1 cellpadding=0 cellspacing=0>
  <tr>
    <td> SJW </td>
    <td> BRP </td>
  </tr>
  <tr>
    <td> 00 (=1Tq) </td>
    <td> 000000 (=SCLK) </td>
  </tr>
</table>

Bit Timing Register 1 @ 0x4F

<table border=1 cellpadding=0 cellspacing=0>
  <tr>
    <td> Spl </td>
    <td> TSEG2 </td>
    <td> TSEG1 </td>
  </tr>
  <tr>
    <td> 0 (1 sample only) </td>
    <td> 011 (=4Tq) </td>
    <td> 0010 (=3Tq) </td>
  </tr>
</table>

Note that the CLKOUT register has to do with providing an external clock for some other chip (like a microcontroller, so we can ignore it). However, to reduce EMI, I'd recommend (ONLY if nothing else uses the clock output, which I doubt they do):

<table border=1 cellpadding=0 cellspacing=0>
  <tr>
    <td> Reserved </td>
    <td> SL1 </td>
    <td> SL0 </td>
    <td> CDv </td>
  </tr>
  <tr>
    <td> 00 </td>
    <td> 1 </td>
    <td> 1 </td>
    <td> 1110 </td>
  </tr>
</table>

-- [[AndrewGreenberg]] - 22 Aug 2001 <br />