Im englischen Bereich blieben viele Fragen offen, daher Frage ich hier mal, ob der Code und der Schaltplan OK sind.
Ich möchte Gameking-Spielmodule auslesen (Epoxy-ROM, 8 Daten-, 20 ADR-Leitungen aber nur 512 KB für 4 Spiele).
Manche Pins (wie OE) und Funktionen sind unklar oder unbekannt.
Da es keine fertige Sockel (2x30 pin) gibt muss ich mir selber einen basteln. Die obere Reihe halte ich eventuell per Hand, daher wäre es hilfreich, die Lesezeit zu kennen (für vielleicht erstmal 130 KB) .
Arduino ProMini 3.3V mit 3x74HC595 und FTDI Basic Breakout.
Mir fehlen noch ein paar Teile, daher habe ich die FTDI Treiber noch nicht installiert.
Gibt es da nur ein Serial-Out Fenster oder Funktionen zum Export in eine Datei? Kann man das in den Arduino Sketch mit einbauen (andere Leute benutzen ein 2. Programm dazu). Verschwindet das Serial-Data Fenster bzw die Daten, wenn man den USB Stecker zieht?
Die meisten vergleichbaren Projekte haben entweder 16-Bit, EEPROM lesen+schreiben, weitere Lesefunktionen wie RAM, weniger Schieberegister usw. Viele Projekte beziehen sich nur auf LED.
Viele weitere Fragen stehen im Code. Weitere Details, Schaltplan und fritzing-Datei hier. Über weitere Tipps wäre ich auch dankbar.
http://forum.arduino.cc/index.php?topic=207306.0
// Gameking cart reader ino sketch by Gamekin. Mostly snippets from other sources
//1 game carts have 17 Adress lines (128 K), 4in1 carts 20. So need to read up to 1 MB
//Some pin functions are unknown or unsure. So can only use CE, not OE. And use 3V.
//No RAM no EEPROMs just 1 ROM. 3x74HC595, so I think I have to read 3 Bytes each loop.
//changed. multicarts obviously only 512 KB. But I first try to read 1 game for time reasons of poor slot
#include "pins_arduino.h"
//taken from Atariromreader unknown if needed
//Pin connected to ST_CP of 74HC595
int latchPin = 10; //Latch, SS ? might be changed, but ProMini has limited pins
//Pin connected to SH_CP of 74HC595
int clockPin = 13; //SCK
////Pin connected to DS of 74HC595
int dataPin = 11; // MOSI
int d0Pin = 2; //necessary ? most don't have this, but I have wired this
int d1Pin = 3;
int d2Pin = 4;
int d3Pin = 5;
int d4Pin = 6;
int d5Pin = 7;
int d6Pin = 8;
int d7Pin = 9;
//Arduino ProMini has internal pull-up resistors, also for data lines. Unsure if I should use them.
//digitalWrite(d0Pin, HIGH); d0-7, digitalWrite(irqPin, HIGH); would activate them
// I have external resistors and 3.3V Arduino and cart
//a buffer for bytes to burn
#define ROM_SIZE 133120
// in bytes. 512 KB or 1MB , but for now read a bit more than 1 game=128 KB+2
// byte buffer[ROM_SIZE]; -used by other sketch. Overflow in arry dimension error with this value
int data = 0; //Used in counting up to the ROM's maximum byte
byte myByte = 0x00; // Used later as D0-D7 byte
//unknown if need more definitions like irqPin. What about CE (at the 74HC595) and SRCLR? physically tied to GND/VCC
void setup(){
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT); // ---one code says INPUT here, but maybe later
}
//taken from MEEPROMMER or other projects
void data_bus_input() {
pinMode(d0Pin, INPUT);
pinMode(d1Pin, INPUT);
pinMode(d2Pin, INPUT);
pinMode(d3Pin, INPUT);
pinMode(d4Pin, INPUT);
pinMode(d5Pin, INPUT);
pinMode(d6Pin, INPUT);
pinMode(d7Pin, INPUT);
}
//switch IO lines of databus to OUTPUT state. --- Unknown why input and output. EEPROM write? or combined ADR and Data lines for SegaGen
void data_bus_output() {
pinMode(d0Pin, OUTPUT);
pinMode(d1Pin, OUTPUT);
pinMode(d2Pin, OUTPUT);
pinMode(d3Pin, OUTPUT);
pinMode(d4Pin, OUTPUT);
pinMode(d5Pin, OUTPUT);
pinMode(d6Pin, OUTPUT);
pinMode(d7Pin, OUTPUT);
}
//set databus to input and read a complete byte from the bus
//be sure to set data_bus to input before --- do I have to write to the data_bus?
byte read_data_bus(){
Serial.begin(57600); //max 57600 for atmega328p, unknown if FTDI drivers needs other than serial, unsure if serial.begin before pinmode
}
void loop() {
while (Serial.available() <=0){
delay (200);
}
//for (int i=0; i<24; i++){ // 3x8 bits ?? first attempt from other sketch
//void shiftOut24bit(int clockPin, int latchPin, int dataPin, unsigned long value) { //taken from sgcexplorer
//digitalWrite(latchPin, LOW);
//shiftOut(dataPin, clockPin, MSBFIRST, (value & 0x00FF0000) >> 16);
//shiftOut(dataPin, clockPin, MSBFIRST, (value & 0x0000FF00) >> 8);
//shiftOut(dataPin, clockPin, MSBFIRST, (value & 0x000000FF));
//digitalWrite(latchPin, HIGH);
digitalWrite(latchPin, LOW); //make shift reg listen
if (data < ROM_SIZE) { //Do I need to open a file and filename before?
shiftOut(dataPin, clockPin, MSBFIRST, (data >> 16)); //read 3 Bytes and shift. binary output?
shiftOut(dataPin, clockPin, MSBFIRST, data >> 8);
shiftOut(dataPin, clockPin, MSBFIRST, data);
digitalWrite(latchPin, HIGH);
delay(5);
myByte = d7Pin //originally called myDigitalRead (9), data pin 9-2 , taken from AtariRomread
| d6Pin <<1
| d5Pin <<2
| d4Pin <<3
| d3Pin <<4
| d2Pin <<5
| d1Pin <<6
| d0Pin <<7;
Serial.write(myByte);
data++;
delay (5);
//digitalWrite(latchPin, LOW);
}
}