Wiki source code of Front I/O

Version 3.2 by Kevin Wiki on 2024/07/04 23:00

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 == ==
10
11
12 = How we got here =
13
14 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.
15
16 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.
17
18 == Finding i2c chip address ==
19
20 === SAA1064T ===
21
22 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.
23
24 === PCA9554 ===
25
26 asdf
27
28 === Code example finding i2c addresses ===
29
30 We can test the following addresses manually or use the following code snippet:
31
32 {{code language="C++"}}
33 /*I2C_scanner
34 This sketch tests standard 7-bit addresses.
35 Devices with higher bit address might not be seen properly.*/
36
37 #include <Wire.h>
38
39 void setup() {
40 Wire.begin();
41
42 Serial.begin(9600);
43 while (!Serial);
44 Serial.println("\nI2C Scanner");
45 }
46
47 void loop() {
48 byte error, address;
49 int nDevices;
50
51 Serial.println("Scanning...");
52
53 nDevices = 0;
54 for (address = 1; address < 127; address++ ) {
55 Wire.beginTransmission(address);
56 error = Wire.endTransmission();
57
58 if (error == 0) {
59 Serial.print("I2C device found at address 0x");
60 if (address < 16)
61 Serial.print("0");
62 Serial.print(address, HEX);
63 Serial.println(" !");
64
65 nDevices++;
66 }
67 else if (error == 4) {
68 Serial.print("Unknown error at address 0x");
69 if (address < 16)
70 Serial.print("0");
71 Serial.println(address, HEX);
72 }
73 }
74 if (nDevices == 0)
75 Serial.println("No I2C devices found\n");
76 else
77 Serial.println("done\n");
78
79 delay(5000);
80 }
81 {{/code}}
82
83 == i2c multiplexing with TCA9548 ==
84
85 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.
86
87 === Code example finding i2c ports ===
88
89 To verify wiring, connection, output ports and device addresses run the following script:
90
91 {{code language="c++"}}
92 /**
93 * TCA9548 I2CScanner.ino -- I2C bus scanner for Arduino
94 *
95 * Based on https://playground.arduino.cc/Main/I2cScanner/
96 *
97 */
98
99 #include "Wire.h"
100
101 #define TCAADDR 0x70
102
103 void tcaselect(uint8_t i) {
104 if (i > 7) return;
105
106 Wire.beginTransmission(TCAADDR);
107 Wire.write(1 << i);
108 Wire.endTransmission();
109 }
110
111
112 // standard Arduino setup()
113 void setup()
114 {
115 while (!Serial);
116 delay(1000);
117
118 Wire.begin();
119
120 Serial.begin(9600);
121 Serial.println("\nTCAScanner ready!");
122
123 for (uint8_t t=0; t<8; t++) {
124 tcaselect(t);
125 Serial.print("TCA Port #"); Serial.println(t);
126
127 for (uint8_t addr = 0; addr<=127; addr++) {
128 if (addr == TCAADDR) continue;
129
130 Wire.beginTransmission(addr);
131 if (!Wire.endTransmission()) {
132 Serial.print("Found I2C 0x"); Serial.println(addr,HEX);
133 }
134 }
135 }
136 Serial.println("\ndone");
137 }
138
139 void loop()
140 {
141 }
142 {{/code}}
143
144 == SAA1064T data for driving center IO LED stack ==
145
146 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.
147
148 {{code language="C++"}}
149 void fillColumns() {
150 Serial.println("filling columns");
151 Wire.beginTransmission(saa1064);
152 Wire.write(1);
153 Wire.write(0x7F); // 127 - 1111111
154 Wire.write(0x7F); // 127 - 1111111
155 Wire.write(0x7F); // 127 - 1111111
156 Wire.write(0x1F); // 31 - 11111
157 Wire.endTransmission();
158
159 colsFilled = 1;
160 }
161 {{/code}}
162
163 (% class="wikigeneratedid" %)
164 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.
165
166 == Pinouts voltages from MLB ==
167
168 Powered off:
169
170 * PWR fail LED - 0.00 V
171 * UID LED - 4.5V
172 * OH/Fan fail LED - 4.72 V
173 * NIC1 LED - 0.8 - 2.6 V
174 * NIC2 LED - 2.95 V
175 * UID SW - 2.8V
176 * HDD LED - 0.00 V
177 * Power LED P3V3 - 0.00V
178 * Power LED - 0.00 V after unplug grows
179
180 Powered on:
181
182 * PWR tail LED - 3.47 V
183 * UID LED - 4.85V
184 * OH/Fan failed LED - 5 V
185 * NIC 1 LED - 1.2 - 2.9 V
186 * NIC 2 LED - 3.2 V
187 * UID SW - 3V
188 * HDD LED - 3 V
189 * Power LED P3V3 - 3.30V
190 * Power LED - 0.87 V
191
192
193 )))
194
195
196 (% class="col-xs-12 col-sm-4" %)
197 (((
198 {{box title="**Contents**"}}
199 {{toc/}}
200 {{/box}}
201
202 [[image:[email protected]]]
203 //Figure 1: [[Sea>>https://commons.wikimedia.org/wiki/File:Isle_of_Icacos_II.jpg]]//
204
205 [[image:[email protected]]]
206 //Figure 2: [[Waves>>https://commons.wikimedia.org/wiki/File:Culebra_-_Playa_de_Flamenco.jpg]]//
207
208
209
210
211
212
213
214 )))
215 )))