Browse Source

Memory now working.

Also changed nitrate to highest one possible with our clock speed,
38400bps.
Thomas Buck 12 years ago
parent
commit
006665ba0b

+ 1
- 1
CubeControl/libSerial/unixSerial.c View File

33
 #include <dirent.h>
33
 #include <dirent.h>
34
 #include <errno.h>
34
 #include <errno.h>
35
 
35
 
36
-#define BAUD B19200
36
+#define BAUD B38400
37
 
37
 
38
 int fd = -1;
38
 int fd = -1;
39
 
39
 

+ 1
- 1
CubeControl/libSerial/winSerial.c View File

28
 #include <stdio.h>
28
 #include <stdio.h>
29
 #include <windows.h>
29
 #include <windows.h>
30
 
30
 
31
-#define BAUD CBR_19200;
31
+#define BAUD CBR_38400;
32
 
32
 
33
 HANDLE hSerial = INVALID_HANDLE_VALUE;
33
 HANDLE hSerial = INVALID_HANDLE_VALUE;
34
 
34
 

+ 11
- 2
CubeFirmware/main.c View File

86
 	uint64_t lastChecked;
86
 	uint64_t lastChecked;
87
 
87
 
88
 	initCube();
88
 	initCube();
89
-	serialInit(51, 8, NONE, 1);
89
+	serialInit(25, 8, NONE, 1);
90
 	i2c_init();
90
 	i2c_init();
91
 	initSystemTimer();
91
 	initSystemTimer();
92
 	sei(); // Enable Interrupts
92
 	sei(); // Enable Interrupts
115
 #ifdef DEBUG
115
 #ifdef DEBUG
116
 	refreshAnimationCount = 0; // Don't talk to FRAM yet...
116
 	refreshAnimationCount = 0; // Don't talk to FRAM yet...
117
 
117
 
118
-	serialWriteString("Initialized: ");
118
+	serialWriteString("\n\nInitialized: ");
119
 	serialWriteString(VERSION);
119
 	serialWriteString(VERSION);
120
 	serialWriteString("Took ");
120
 	serialWriteString("Took ");
121
 	serialWriteString(itoa(getSystemTime(), buffer, 10));
121
 	serialWriteString(itoa(getSystemTime(), buffer, 10));
220
 #ifdef DEBUG
220
 #ifdef DEBUG
221
 		serialWriteString("(t)ime, (a)udio, (c)ount, (x)Custom count\n");
221
 		serialWriteString("(t)ime, (a)udio, (c)ount, (x)Custom count\n");
222
 		serialWriteString("(y)Set fixed animation count\n");
222
 		serialWriteString("(y)Set fixed animation count\n");
223
+		serialWriteString("S(e)lf Test\n");
223
 #endif
224
 #endif
224
 		break;
225
 		break;
225
 
226
 
286
 		setAnimationCount(0x2201);
287
 		setAnimationCount(0x2201);
287
 		serialWriteString("Animation count now 8705!\n");
288
 		serialWriteString("Animation count now 8705!\n");
288
 		break;
289
 		break;
290
+
291
+	case 'e': case 'E':
292
+		c = selfTest();
293
+		serialWriteString("Self-Test: 0b");
294
+		serialWriteString(itoa(c, buffer, 2));
295
+		serialWrite('\n');
296
+		printErrors(c);
297
+		break;
289
 #endif
298
 #endif
290
 
299
 
291
 	default:
300
 	default:

+ 8
- 8
CubeFirmware/mem.c View File

37
 		// Address needs more than 16 bits, we have to set the PAGE bit in i2c address
37
 		// Address needs more than 16 bits, we have to set the PAGE bit in i2c address
38
 		memAddress |= 2;
38
 		memAddress |= 2;
39
 	}
39
 	}
40
-	addA = memAddress & 0xFF00;
41
-	addB = memAddress & 0xFF;
40
+	addA = address & 0xFF00;
41
+	addB = address & 0xFF;
42
 
42
 
43
 	if (i2c_start(memAddress | I2C_WRITE) == 0) { // Send start, write address to read
43
 	if (i2c_start(memAddress | I2C_WRITE) == 0) { // Send start, write address to read
44
 		i2c_write(addA);
44
 		i2c_write(addA);
61
 		// Address needs more than 16 bits, we have to set the PAGE bit in i2c address
61
 		// Address needs more than 16 bits, we have to set the PAGE bit in i2c address
62
 		memAddress |= 2;
62
 		memAddress |= 2;
63
 	}
63
 	}
64
-	addA = memAddress & 0xFF00;
65
-	addB = memAddress & 0xFF;
64
+	addA = address & 0xFF00;
65
+	addB = address & 0xFF;
66
 	ret = (uint8_t *)malloc(length); // Allocate memory for values read
66
 	ret = (uint8_t *)malloc(length); // Allocate memory for values read
67
 	if (ret == NULL) {
67
 	if (ret == NULL) {
68
 #ifdef DEBUG
68
 #ifdef DEBUG
92
 		// Address needs more than 16 bits, we have to set the PAGE bit in i2c address
92
 		// Address needs more than 16 bits, we have to set the PAGE bit in i2c address
93
 		memAddress |= 2;
93
 		memAddress |= 2;
94
 	}
94
 	}
95
-	addA = memAddress & 0xFF00;
96
-	addB = memAddress & 0xFF;
95
+	addA = address & 0xFF00;
96
+	addB = address & 0xFF;
97
 	if (i2c_start(memAddress | I2C_WRITE) == 0) {
97
 	if (i2c_start(memAddress | I2C_WRITE) == 0) {
98
 		i2c_write(addA);
98
 		i2c_write(addA);
99
 		i2c_write(addB); // Give address to memory
99
 		i2c_write(addB); // Give address to memory
108
 		// Address needs more than 16 bits, we have to set the PAGE bit in i2c address
108
 		// Address needs more than 16 bits, we have to set the PAGE bit in i2c address
109
 		memAddress |= 2;
109
 		memAddress |= 2;
110
 	}
110
 	}
111
-	addA = memAddress & 0xFF00;
112
-	addB = memAddress & 0xFF;
111
+	addA = address & 0xFF00;
112
+	addB = address & 0xFF;
113
 	if (i2c_start(memAddress | I2C_WRITE) == 0) {
113
 	if (i2c_start(memAddress | I2C_WRITE) == 0) {
114
 		i2c_write(addA);
114
 		i2c_write(addA);
115
 		i2c_write(addB); // Give address to memory
115
 		i2c_write(addB); // Give address to memory

Loading…
Cancel
Save