Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FF's for output #2

Open
HighMans opened this issue Feb 16, 2023 · 3 comments
Open

FF's for output #2

HighMans opened this issue Feb 16, 2023 · 3 comments

Comments

@HighMans
Copy link

Hello,

I'm not sure if this is the right place to reach out but I need a bit of help trying to dump save files.

I have a ds cartridge hooked up with all the pins (I've also swapped MISO and MOSI around just in case), and using both your dsaver app and a simple SPI app I wrote (code below) all the output I'm getting is FF from the cartridge.

I've verified that the cartridge does indeed have data in it, and I've also checked with a signal analyzer to verify that the communications are all correct and they seem to be.

Do you've any idea where I could start or what else I could check?

Code:

#include <SPI.h>
void setup() {
  Serial.begin(9600);
  pinMode(SS, OUTPUT);
  digitalWrite(SS, HIGH);
  SPI.begin();
  SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE0));
  digitalWrite(SS, LOW);
  SPI.transfer(0x03);
  SPI.transfer(0x00);
  SPI.transfer(0x00);
  SPI.transfer(0x00);
  SPI.transfer(0xFF);
  SPI.transfer(0xFF);
  SPI.transfer(0xFF);
  SPI.transfer(0xFF);
  SPI.transfer(0xFF);
  SPI.transfer(0xFF);
  SPI.transfer(0xFF);
  SPI.transfer(0xFF);
  SPI.transfer(0xFF);
  SPI.transfer(0xFF);
  SPI.transfer(0xFF);
  SPI.transfer(0xFF);
  SPI.transfer(0xFF);
  SPI.transfer(0xFF);
  SPI.transfer(0xFF);
  SPI.transfer(0xFF);
  SPI.transfer(0xFF);
  SPI.transfer(0xFF);
  SPI.transfer(0xFF);
  SPI.transfer(0xFF);

  digitalWrite(SS, HIGH);
  SPI.endTransaction();
}

void loop() {
}

2023-02-16 15_11_04-Window
LogicCapture.zip

@pedro-javierf
Copy link
Owner

pedro-javierf commented Feb 16, 2023

Hi @HighMans
Always happy to help anyone trying to learn :)

What game cartridge are you trying to use? Have you checked the EEPROM's part number? If you have reviewed your electrical setup, and tried with the logic analyzer (which looks good) my only guess is that the eeprom of the cartridge you are using might work with one of the other possible SPI configurations, rather than SPI_MODE0.

Mode 0 (the default) - clock is normally low (CPOL = 0), and the data is sampled on the transition from low to high (leading edge) (CPHA = 0)
  Mode 1 - clock is normally low (CPOL = 0), and the data is sampled on the transition from high to low (trailing edge) (CPHA = 1)
  Mode 2 - clock is normally high (CPOL = 1), and the data is sampled on the transition from high to low (leading edge) (CPHA = 0)
  Mode 3 - clock is normally high (CPOL = 1), and the data is sampled on the transition from low to high (trailing edge) (CPHA = 1)

Let me know if you've already tried this

@pedro-javierf
Copy link
Owner

Also, you are sending a 24 bits (3 bytes) address to the EEPROM. I assume your game's EEPROM is bigger than 64Kb? That's why I was using 16bit addresses (2^16 is 65536 bytes exactly 64Kb). If your EEPROM does not use 24bit addresses, it might be getting confused when it receives the extra 0x00 of the address

@HighMans
Copy link
Author

I think I might've figured out what the issue is, I think it's a combination of my crappy breadboard and the loose connections on top of swapping MISO and MOSI around.

I did try your suggestions, and tried swapping MISO and MOSI again but in testing them out I noticed I was getting random data at times which didn't make sense. I did more testing, and I realized that the loose connections might've been the culprit and causing all the problems.

I'll update once I get a genuine/higher quality breadboard in. Ty!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants