Wiki source code of Front I/O

Version 1.4 by Kevin Wiki on 2024/07/04 16:49

Hide last authors
Kevin Wiki 1.1 1 (% class="row" %)
2 (((
3 (% class="col-xs-12 col-sm-8" %)
4 (((
Kevin Wiki 1.2 5 = Pinout =
Kevin Wiki 1.1 6
Kevin Wiki 1.2 7 There is a single cable that controls four parts, each half side of I/O LED and center column of blue LEDs.
Kevin Wiki 1.1 8
9 == Sub-paragraph ==
10
11 Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
12
13 == Sub-paragraph ==
14
15 Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
16
17 === Sub-sub paragraph ===
18
19 Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
20
21
Kevin Wiki 1.3 22 = How we got here =
Kevin Wiki 1.1 23
Kevin Wiki 1.3 24 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.
Kevin Wiki 1.1 25
Kevin Wiki 1.3 26 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.
Kevin Wiki 1.1 27
Kevin Wiki 1.3 28 == Finding i2c chip address ==
Kevin Wiki 1.1 29
Kevin Wiki 1.3 30 === SAA1064T ===
Kevin Wiki 1.1 31
Kevin Wiki 1.3 32 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.
33
34 === PCA9554 ===
35
36 asdf
37
38 === Code example finding i2c addresses ===
39
40 We can test the following addresses manually or use the following code snippet:
41
42 {{code language="C++"}}
43 /*I2C_scanner
44 This sketch tests standard 7-bit addresses.
45 Devices with higher bit address might not be seen properly.*/
46
47 #include <Wire.h>
48
49 void setup() {
50 Wire.begin();
51
52 Serial.begin(9600);
53 while (!Serial);
54 Serial.println("\nI2C Scanner");
55 }
56
57 void loop() {
58 byte error, address;
59 int nDevices;
60
61 Serial.println("Scanning...");
62
63 nDevices = 0;
64 for (address = 1; address < 127; address++ ) {
65 Wire.beginTransmission(address);
66 error = Wire.endTransmission();
67
68 if (error == 0) {
69 Serial.print("I2C device found at address 0x");
70 if (address < 16)
71 Serial.print("0");
72 Serial.print(address, HEX);
73 Serial.println(" !");
74
75 nDevices++;
76 }
77 else if (error == 4) {
78 Serial.print("Unknown error at address 0x");
79 if (address < 16)
80 Serial.print("0");
81 Serial.println(address, HEX);
82 }
83 }
84 if (nDevices == 0)
85 Serial.println("No I2C devices found\n");
86 else
87 Serial.println("done\n");
88
89 delay(5000);
90 }
91 {{/code}}
92
93 == i2c multiplexing with TCA9548 ==
94
95 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.
96
97 === Code example finding i2c ports ===
98
99 To verify wiring, connection, output ports and device addresses run the following script:
100
101 {{code language="c++"}}
102 /**
103 * TCA9548 I2CScanner.ino -- I2C bus scanner for Arduino
104 *
105 * Based on https://playground.arduino.cc/Main/I2cScanner/
106 *
107 */
108
109 #include "Wire.h"
110
111 #define TCAADDR 0x70
112
113 void tcaselect(uint8_t i) {
114 if (i > 7) return;
115
116 Wire.beginTransmission(TCAADDR);
117 Wire.write(1 << i);
118 Wire.endTransmission();
119 }
120
121
122 // standard Arduino setup()
123 void setup()
124 {
125 while (!Serial);
126 delay(1000);
127
128 Wire.begin();
129
130 Serial.begin(9600);
131 Serial.println("\nTCAScanner ready!");
132
133 for (uint8_t t=0; t<8; t++) {
134 tcaselect(t);
135 Serial.print("TCA Port #"); Serial.println(t);
136
137 for (uint8_t addr = 0; addr<=127; addr++) {
138 if (addr == TCAADDR) continue;
139
140 Wire.beginTransmission(addr);
141 if (!Wire.endTransmission()) {
142 Serial.print("Found I2C 0x"); Serial.println(addr,HEX);
143 }
144 }
145 }
146 Serial.println("\ndone");
147 }
148
149 void loop()
150 {
151 }
152 {{/code}}
Kevin Wiki 1.1 153 )))
154
155
156 (% class="col-xs-12 col-sm-4" %)
157 (((
158 {{box title="**Contents**"}}
159 {{toc/}}
160 {{/box}}
161
162 [[image:[email protected]]]
163 //Figure 1: [[Sea>>https://commons.wikimedia.org/wiki/File:Isle_of_Icacos_II.jpg]]//
164
165 [[image:[email protected]]]
166 //Figure 2: [[Waves>>https://commons.wikimedia.org/wiki/File:Culebra_-_Playa_de_Flamenco.jpg]]//
167 )))
168 )))