Go Down

Topic: ROM-Reader for Super Nintendo / Super Famicom Game Cartridges (Read 416748 times) previous topic - next topic

kreeblah

Is there any documentation anywhere for setting up a build environment from scratch?  I put together some code to lookup PRG and CHR CRC32s against values for known games from the nes20db project (after transforming the relevant data to a flat file) in order to write NES 2.0 headers with files for recognized games.  However, now that I'm at the point of being ready to test on my reader (instead of just testing what I can on my computer), I'm having some trouble.

Specifically, I'm seeing errors about missing headers and such, so I obviously need to get some additional libraries and set them up in the Arduino IDE.  I'm hoping to avoid trial and error to get the IDE going (especially since, while I'm familiar with C, I'm not terribly familiar with the Arduino environment), and since I don't use Windows, I can't use the portable setup in the V5.5 release archive.

So, yeah.  Is there any chance there's some info somewhere about getting going with a build environment so I can start testing my work?

sanni

You can download the V5.5_Portable.zip and extract the libs from the "V5.5_Portable.zip\V5.5_Portable\Arduino IDE Portable\portable\sketchbook\libraries" folder to your Arduino installation.

Quote
The correct location for the user's libraries is the libraries sub-folder of the sketchbook folder.
The sketchbook folder location is set in the Arduino IDE at File > Preferences > Sketchbook location.
Source: https://forum.arduino.cc/index.php?topic=514414.msg3505780#msg3505780

Not for lack of trying, but I haven't understood the pinout spreadsheet's format enough to trace the clockgen yet.  More likely I just don't know all the names for the pertinent connections.
Just download Eagle PCB and open the cartreader.brd and .sch files. Much easier to understand the wiring this way. https://github.com/sanni/cartreader/tree/master/pcb/eagle%20design%20files

silverfox0786

Hi.

Mt RGB LED is not working yet the cart reader works fine.

Can you confirm the LED I need is Common Anode or Cathode?

Thanks


backlot

I'm working on building this myself but I've run into some confusing errors dumping SNES carts. I tested it with SA-1 and non-SA1 carts last night and both dumps worked. I fiddled around with the cartridge dumper this morning to try and fit it in a case and now all SNES carts are giving me checksum errors after dumping. It looks like the games are recognized before dumping but I just get a checksum error every time. It seems to dump cartridges for other systems fine though.

Anybody have any idea what might be going on or how to troubleshoot checksum errors?

Edit: I've figured it out. I soldered in the LED after I did my first round of testing. After removing the LED I can now dump SNES games again without issues. Is it possible the power draw from the LED was too high?

sanni

Anyway, I'd appreciate it, and try again, if you're willing to point out a card slot with the correct pinout.
LCSC part number C116683 or eBay 252043494286 or 182716529038 should fit. It's often describes as "MMC / SD Long" on eBay.


silverfox0786

I wrote a little Sketch to calibrate the Clock Generator for the snesCIC.



https://www.dropbox.com/s/uyhpnng9zgfl2ja/clkcal.zip?dl=1

Usage: Upload Sketch, then connect SNES Pin 56(CIC Clock/CLK2) to SNES Pin 43(A18/Arduino D47) using some sort of wire.
The correction factor can then be put into SNES.ino and/or NP.ino: clockgen.init(SI5351_CRYSTAL_LOAD_8PF, 0, -16000);
i am a little confused. is there a better write up on how to do this. i cant seem to read SA1 carts.

jaffa225man

#1372
Jan 30, 2021, 08:48 pm Last Edit: Jan 30, 2021, 10:23 pm by jaffa225man
i am a little confused. is there a better write up on how to do this. i cant seem to read SA1 carts.
Although my OLED doesn't show text unless I have the clockgen module unplugged, here's what I had intended trying:

1.  Flash the clkcal firmware (https://forum.arduino.cc/index.php?topic=158974.msg4518921#msg4518921, built with https://github.com/sanni/cartreader/releases/download/V4.6/V4.6_Portable.zip)

2.  Use a thin piece of flat plastic like a library or credit card to sandwich a wire to the correct pins.  Those should be pins 56 and 43 (both in the middle portion at the back of the SNES slot).  Ignoring the four pins separated on the end, Pin 56 is the third pin from the right.  Likewise ignoring the separated 4 pins on the end, pin 43 is 8 pins from the left.

I got this info from https://www.caitsith2.com/snes/flashcart/cart-chip-pinouts.html:

Code: [Select]

           21.477MHz Clock   01   32   /WRAM
                    EXPAND   02   33   REFRESH
                       PA6   03   34   PA7
                     /PARD   04   35   /PAWR

                       GND   05   36   GND
F                      A11   06   37   A12
r                      A10   07   38   A13
o                       A9   08   39   A14
n                       A8   09   40   A15
t                       A7   10   41   BA0
                        A6   11   42   BA1
o                       A5   12   43   BA2
f                       A4   13   44   BA3
                        A3   14   45   BA4
c                       A2   15   46   BA5
a                       A1   16   47   BA6
r                       A0   17   48   BA7
t                     /IRQ   18   49   /CART
                        D0   19   50   D4
                        D1   20   51   D5
                        D2   21   52   D6
                        D3   22   53   D7
                       /RD   23   54   /WR
         CIC out data (p1)   24   55   CIC out data (p2)
         CIC  in data (p7)   25   56   CIC in clock (p6)
                    /RESET   26   57   CPU_CLOCK
                       Vcc   27   58   Vcc

                       PA0   28   59   PA1
                       PA2   29   60   PA3
                       PA4   30   61   PA5
          Left Audio Input   31   62   Right Audio Input


3.  Turn your cartreader on.  The calibration screen text should show now, rather than random pixels (as in my case).

4.  Using the buttons to increase or lower the frequency, tune it as close as possible to 3.072 MHz (3072000 Hz).  I don't know if we also should try tuning to 21.477272 MHz (2147727.2 Hz) as that wasn't pictured by sanni, but was mentioned in skaman's helpful post here: https://forum.arduino.cc/index.php?topic=158974.msg2284960#msg2284960
Edit: skaman only needed one line to calibrate both his frequencies, so just the correction factor shown should be enough for both.

5.  Write down the correction factor, and replace the last value in this line with it, which needs to be added to SNES.ino and/or NP.ino in the normal cartreader firmware:
clockgen.init(SI5351_CRYSTAL_LOAD_8PF, 0, -16000);

6.  Build and upload that to the cartreader, and hopefully you can enjoy reading SA1 much more reliably.

If that doesn't work, and you haven't tried the known issues solutions yet, try (from https://github.com/sanni/cartreader/wiki/Known-issues):

Some cartridges like SA1 only dump correctly if you're using a high quality 5V/1A mobile phone charger instead of the USB port of a PC, they also need a 470uF capacitor soldered to the two wires coming from the Arduino.

For dumping SA1 carts sometimes it is helpful to set the CLK1 switch to off.


I hope my efforts trying to figure this out helps others, although I can't seem to calibrate mine yet,

  Lucas

P.S. Thanks, sanni, for the specifications on the SD card slot (I'm waiting for its arrival) and suggestion to use eagle.  I'll look into eagle if need be, but first I've decided to buy a frequency counter and try skaman's original manual calibration method to obtain the correction factor.

sanni

i am a little confused. is there a better write up on how to do this. i cant seem to read SA1 carts.
I have overhauled the clkcal tool. Also starting with Cart_Reader V5.6 the correction factor will be read from the SD card thanks to Kreeblah.

So all you have to do is:
- download V5.6_beta: https://www.dropbox.com/s/qt9dnsfn08sgjxn/V5.6_Portable_beta.zip?dl=1
- follow CLKCAL.txt to adjust the clock
- follow README.txt to flash V5.6

And as already mentioned you need a good power supply like an original Apple USB charger and you will also need the additional 470uF cap between GND and VCC on the Cart Reader.

Also worth noting is that currently in SNES.ino the clock gen gets initialized with 1Mhz/4Mhz instead of the correct clocks at first. For me that made unlocking SA1 easier but that might not be the case for everyone. So if nothing works try setting the clocks to the correct values there, which are the same as in line 416.

vendest

Hi,
I am greeted by "Cartridge Error" after choosing Game Boy Advance with or without cartridge inserted.
The game is Final Fantasy Tactics Advance (AGB-AFXP-EUR) which is set in the gba.txt as AFXP,16,4.
I went ahead with reading the cart but couple of bits in the dump does not match the original rom when comparing in a hex editor. The save file which I wanted to retrieve is a flash type and also seem to be corrupted.
Any other cart system work great so far. (SNES, GBC, N64)
Thanks,

sanni

There are still some bugs left in the GBA code. It could be that some games just don't work yet.

What you can try is cleaning the cart contacts with a cotton swab dipped in rubbing alcohol. Repeat until the cotton swap doesn't  turn grey anymore.
I only have 6 GBA games but I tested them all just now, 4 worked, 2 gave cart errors but worked fine after cleaning.
The Cart Reader is very sensitive to even slightly dirty contacts.

I do have Secret of Mana AGB-AVSJ-JPN with the AGB-E02-20 PCB and SST 39VF512 flash save chip. It should be very similar to Final Fantasy Tactics. Can you confirm that your game has the same PCB?

jaffa225man

#1376
Feb 01, 2021, 11:01 pm Last Edit: Feb 02, 2021, 03:28 am by jaffa225man
I have overhauled the clkcal tool. Also starting with Cart_Reader V5.6 the correction factor will be read from the SD card thanks to Kreeblah.

So all you have to do is:
- download V5.6_beta: https://www.dropbox.com/s/qt9dnsfn08sgjxn/V5.6_Portable_beta.zip?dl=1
- follow CLKCAL.txt to adjust the clock
- follow README.txt to flash V5.6

And as already mentioned you need a good power supply like an original Apple USB charger and you will also need the additional 470uF cap between GND and VCC on the Cart Reader.

Also worth noting is that currently in SNES.ino the clock gen gets initialized with 1Mhz/4Mhz instead of the correct clocks at first. For me that made unlocking SA1 easier but that might not be the case for everyone. So if nothing works try setting the clocks to the correct values there, which are the same as in line 416.

Wow, thanks for that!  Sadly, my issue hasn't been solved by it; instead of the prior random pixels, I get a frozen "Adjusting" screen with the clockgen module plugged in.  Unplugged, it boots fully. 

Trying the firmware meant I was stubborn enough to keep trying, so I used your eagle suggestion and traced the connections.  My multimeter revealed nothing unusual, except that both the VCC and GND had about 2-4 ohms between the clockgen module header and their respective other cartreader PCB points.  Other cartreader PCB VCC-to-VCC and GND-to-GND showed no resistance.  I reflowed the header's VCC and GND, without change to their resistances though.  Perhaps the cable pin I was measuring from was too thin to get a great contact in the header, but I really don't think it should have been.

Next, I decided to breakout the clockgen header and disconnect a pin at a time.  With either the SCL or SDA pin disconnected, the clkcal firmware gets to the running calibration screen, although the detected Hz is wrong.  As soon as I plug in the disconnected pin, it freezes, meaning the adjustment buttons don't work and the detected Hz doesn't change from the capacitance of my hand on the jumper wire in the SNES slot.

Since I planned on building the cartreader, I bought a few parts before DieKatzchen offered the kit, and one of them was the clockgen module.  I'd left my original clockgen unused since I had the one from the kit, but now that I was breaking out connections anyway, I connected to my original with "logic analyzer" clips (until I ran out and used an alligator clip to supplement them).  It froze in the same way with the clkcal firmware, but I decided to test the normal 5.6 beta with it anyway, without calibration.  Amazingly, it worked for SA1 perfectly on my first try with Super Mario RPG and Kirby Super Star, so I soldered the included pin header to it and plugged it into the cartreader directly. 

It's still working perfectly for everything except the clkcal firmware, so I'm ecstatic!  Now I've got all three (Super Mario RPG: Legend of the Seven Stars, Kirby Superstar Deluxe, and Kirby's Dreamland 3) of my SA1 games' roms dumping perfectly every try!  It even writes my original Super Mario RPG SRAM save (backed up manually by tweaking Super UFO Pro 8 settings) without errors (saying simply "Verified")!  The "Test SRAM" function with the two SA1 cartridges I tried still shows an error at addresses 0x00 and 0xFF but otherwise verifies.  With everything else working now, I think that must just be a firmware red-herring or something.  1 out of 2 clockgen modules being well calibrated as-is, seems amazingly lucky to me!

Thanks for everything sanni! :)

sanni

Be sure to check the CRC of the SA1 ROMs. The Cart Reader only calculates the internal checksum which only verifies a small portion of the ROM.

To calculate the CRC over the whole ROM you can use something like Hashtab

And compare the CRC to the one on the no-intro site.








jaffa225man

#1378
Feb 02, 2021, 11:18 pm Last Edit: Feb 02, 2021, 11:32 pm by jaffa225man
Be sure to check the CRC of the SA1 ROMs. The Cart Reader only calculates the internal checksum which only verifies a small portion of the ROM.

To calculate the CRC over the whole ROM you can use something like Hashtab

And compare the CRC to the one on the no-intro site.

I hadn't known of https://datomatic.no-intro.org, so thanks for that!  As I thought, all three of my SA1 games match exactly with byuu's references, since switching the clockgen module!

Being a GNU/Linux person meant that hashing the files through the command line with crc32 (which I wasn't aware of), md5sum, sha1sum, or sha256sum was easier for me than using a windows machine for hashtab.  It is nice to see windows users have access to data integrity testing, though.

Thanks again!  This working so well almost makes me want to buy more games! ;)

Pickle136

Sanni, do you think your eeprom flash code would work with 28C64 (aside from changing the size). I havnt dug too deep into the current code for the eeprom flashing.
I want to flash a 28C64 with the IDE XT bios for a old PC.

Edit: I checked the pinouts and they arnt even close, so i bit the bullet and just bought a TL866II

Go Up