Wiki source code of Front I/O

Version 5.2 by Kevin Wiki on 2024/07/05 09:25

Show last authors
1 (% class="row" %)
2 (((
3 (% class="col-xs-12 col-sm-8" %)
4 (((
5 = Pinout =
6
7 There is a single cable that controls four parts, each half side of I/O LED and center column of blue LEDs.
8
9 [[image:xserve io main cable and PCB pinout.drawio.png||alt="xserve io main cable pinout.drawio.png"]]
10
11 (% class="wikigeneratedid" %)
12 [[attach:xserve io main cable pinout.drawio.svg||target="_blank"]]
13
14
15 (% class="wikigeneratedid" %)
16 This cable allows us to communicate with 4 chips using two data lines, audio & service switch, case switch and (yet to be documented) compute LEDs
17
18 = How we got here =
19
20 Measure out the ground and power signals by comparing with other chips on board. E.g. we find [SAA1064T] datasheet, locate the GND (Vee) and 5V (Vcc) and measure connectivity (0 ohm resistance) between chip pins and cable pins. This gives us pins GND 2 & 8 and PWR 16 & 22.
21
22 We keep doing this for SCL & SDA pins on SAA1064T chip and find pins 14 & 15 and 20 & 21 are I2C clock and data pins for each chip.
23
24 == Finding i2c chip address ==
25
26 === SAA1064T ===
27
28 Reading the datasheet for SAA1064T chip we find that: "//This results in the corresponding valid addresses HEX 70, 72, 74 and 76 for writing and 71, 73, 75 and 77 for reading. All other addresses cannot be acknowledged by the circuit".// Giving us a clue what we are looking for, i2c addresses 0x70, 0x72 or 0x74.
29
30 === PCA9554 ===
31
32 asdf
33
34 === Code example finding i2c addresses ===
35
36 We can test the following addresses manually or use the following code snippet:
37
38 {{code language="C++"}}
39 /*I2C_scanner
40 This sketch tests standard 7-bit addresses.
41 Devices with higher bit address might not be seen properly.*/
42
43 #include <Wire.h>
44
45 void setup() {
46 Wire.begin();
47
48 Serial.begin(9600);
49 while (!Serial);
50 Serial.println("\nI2C Scanner");
51 }
52
53 void loop() {
54 byte error, address;
55 int nDevices;
56
57 Serial.println("Scanning...");
58
59 nDevices = 0;
60 for (address = 1; address < 127; address++ ) {
61 Wire.beginTransmission(address);
62 error = Wire.endTransmission();
63
64 if (error == 0) {
65 Serial.print("I2C device found at address 0x");
66 if (address < 16)
67 Serial.print("0");
68 Serial.print(address, HEX);
69 Serial.println(" !");
70
71 nDevices++;
72 }
73 else if (error == 4) {
74 Serial.print("Unknown error at address 0x");
75 if (address < 16)
76 Serial.print("0");
77 Serial.println(address, HEX);
78 }
79 }
80 if (nDevices == 0)
81 Serial.println("No I2C devices found\n");
82 else
83 Serial.println("done\n");
84
85 delay(5000);
86 }
87 {{/code}}
88
89 == i2c multiplexing with TCA9548 ==
90
91 We have two sets of chips, one for left and one for right where we have two different i2c chips on each side for controlling lights. Since the chips controlling their respective parts have the same address for each side, we can't distinguish them from each other. To handle this we use a i2c multiplexer to selectively communicate with one half at a time, switching TCA9548 between two different output ports.
92
93 === Code example finding i2c ports ===
94
95 To verify wiring, connection, output ports and device addresses run the following script:
96
97 {{code language="c++"}}
98 /**
99 * TCA9548 I2CScanner.ino -- I2C bus scanner for Arduino
100 *
101 * Based on https://playground.arduino.cc/Main/I2cScanner/
102 *
103 */
104
105 #include "Wire.h"
106
107 #define TCAADDR 0x70
108
109 void tcaselect(uint8_t i) {
110 if (i > 7) return;
111
112 Wire.beginTransmission(TCAADDR);
113 Wire.write(1 << i);
114 Wire.endTransmission();
115 }
116
117
118 // standard Arduino setup()
119 void setup()
120 {
121 while (!Serial);
122 delay(1000);
123
124 Wire.begin();
125
126 Serial.begin(9600);
127 Serial.println("\nTCAScanner ready!");
128
129 for (uint8_t t=0; t<8; t++) {
130 tcaselect(t);
131 Serial.print("TCA Port #"); Serial.println(t);
132
133 for (uint8_t addr = 0; addr<=127; addr++) {
134 if (addr == TCAADDR) continue;
135
136 Wire.beginTransmission(addr);
137 if (!Wire.endTransmission()) {
138 Serial.print("Found I2C 0x"); Serial.println(addr,HEX);
139 }
140 }
141 }
142 Serial.println("\ndone");
143 }
144
145 void loop()
146 {
147 }
148 {{/code}}
149
150 == SAA1064T data for driving center IO LED stack ==
151
152 Center IO stack is a stack of 23 LED's, 22 blue and 1 green for ethernet activity. These are duplicated next to each other and driven by each their SAA1064T chips. Earlier we found the i2c address and just by playing around figured out that 4 segments of 1 byte binary values are used to set ship register.
153
154 {{code language="C++"}}
155 void fillColumns() {
156 Serial.println("filling columns");
157 Wire.beginTransmission(saa1064);
158 Wire.write(1);
159 Wire.write(0x7F); // 127 - 1111111
160 Wire.write(0x7F); // 127 - 1111111
161 Wire.write(0x7F); // 127 - 1111111
162 Wire.write(0x1F); // 31 - 11111
163 Wire.endTransmission();
164
165 colsFilled = 1;
166 }
167 {{/code}}
168
169 (% class="wikigeneratedid" %)
170 Here the last byte we send only is 5 bits since we only have 5 LEDs instead of 6 to address (total of 23). Also note that we start the transmission with a single bit.
171
172 == Pinouts voltages from MLB ==
173
174 Powered off:
175
176 * PWR fail LED - 0.00 V
177 * UID LED - 4.5V
178 * OH/Fan fail LED - 4.72 V
179 * NIC1 LED - 0.8 - 2.6 V
180 * NIC2 LED - 2.95 V
181 * UID SW - 2.8V
182 * HDD LED - 0.00 V
183 * Power LED P3V3 - 0.00V
184 * Power LED - 0.00 V after unplug grows
185
186 Powered on:
187
188 * PWR tail LED - 3.47 V
189 * UID LED - 4.85V
190 * OH/Fan failed LED - 5 V
191 * NIC 1 LED - 1.2 - 2.9 V
192 * NIC 2 LED - 3.2 V
193 * UID SW - 3V
194 * HDD LED - 3 V
195 * Power LED P3V3 - 3.30V
196 * Power LED - 0.87 V
197
198
199 )))
200
201
202 (% class="col-xs-12 col-sm-4" %)
203 (((
204 {{box title="**Contents**"}}
205 {{toc/}}
206 {{/box}}
207
208 [[image:[email protected]]]
209 //Figure 1: [[Sea>>https://commons.wikimedia.org/wiki/File:Isle_of_Icacos_II.jpg]]//
210
211 [[image:[email protected]]]
212 //Figure 2: [[Waves>>https://commons.wikimedia.org/wiki/File:Culebra_-_Playa_de_Flamenco.jpg]]//
213
214
215
216
217
218
219
220 )))
221 )))