sanni / cartreader

A shield for the Arduino Mega that can back up video game cartridges.
GNU General Public License v3.0
2.23k stars 226 forks source link

26L6420 flashing settings #997

Open alx5962 opened 4 months ago

alx5962 commented 4 months ago

OSCR firmware version

14

OSCR hardware version

HW3

Attach OSCR_LOG.txt file here

No response

System used

Flashrom Programmer

Describe the issue.

I'd like to flash a 26L6420 (SOP44) eprom using this cart reader but I can't find infos about this topic.

I already own the 26L6420 PCB adapter to flash them from : https://github.com/sanni/cartreader/tree/bd3eaa106b6e4cbdffbfa89a3fb5fedf3e028b17/pcb/adapters. It's shaped as a SNES adapter and it's not mentioned in the wiki. I'm using the latest firmware on the reader and enabled FLASH16 in the firmware.

First, I'd like to know how to set the 4 switches and what options do I have to use in the Flashrom programmer menu. I guess it's the 16 bits Flash one (but when I select it, it only displays [+] 16 bit flash).

Many thanks for this great project! I'm creating my own Gameboy game and I use it a lot!

sanni commented 4 months ago

Seems like you found a bug. 😄 Please update to the latest Github code and try again: https://github.com/sanni/cartreader/archive/refs/heads/master.zip

Switches like this: image
And "16bit Flash" menu selection.

alx5962 commented 4 months ago

Thank you for the fast reply and for the very fast fix!

So I just flashed the new firmware and now I have this error: "Flash ID 1010 unknown flashrom". In the flash.ino file:

if (flashid == 0xC2FC) { println_Msg(F("MX26L6420 detected"));

So I added my own flashid, now let's try if all works well.

alx5962 commented 3 months ago

Some feedback: I used another eprom and now flashid is correctly detected as 0xC2FC. I tried to erase it, 20 mn later still erasing it. How long does it take to erase, usually? I will double check every pins as I use an adapter like this:

SOP44 adapter

So I had to wire myself every pins to the SNES/Eprom adapter.

alx5962 commented 3 months ago

I double checked and my wiring is fine. Flashid is 0xC2FC and blankcheck works fine but after 1 hour erasing still erasing (led off). Also tried to flash a blank eprom and after 1 hour I have the same result and no blinking (led always on).

I have a question about the 26l6420 adapter schematics found at: https://github.com/sanni/cartreader/blob/bd3eaa106b6e4cbdffbfa89a3fb5fedf3e028b17/pcb/adapters/26L6420_adapter_schematics.png

image

Somes pins have no direct link with the chip numbers: A21 is connected to WE, WE to BYTE, A20 to WP but some have the correct number: A18 is connected to A18, A17 to A17,... On the offical doc (below), A21 is an address input so it should be linked to A21.

Do these changes are linked to eprom flashing with this adapter? Or a issue with the schematic?

image

image

sanni commented 3 months ago

You can ignore the pin descriptions. Just have forgotten to change the symbol in KiCad.

352766262-d15e2ed4-753c-488b-a870-532a8270a84a

alx5962 commented 3 months ago

Thank you for the feedback. Any idea about why the led is not blinking while flashing? Or is it only in 8 bit mode?

sanni commented 3 months ago

One thing you could try is flashing V4.3 from the firmware archive, it should be the first version with 26l6420 support, to check if maybe over the past 5 years something got changed that broke 26l6420 support.

herzmx commented 3 months ago

I try this and works, but 16bit Flash adaptador need a mod to work. First cut trace on PH1 20240727_141727 And next join OE to PH3 20240727_141744

I don't remember if firmware need a mod, but i take a look in my old files.

This tested on HW5

alx5962 commented 3 months ago

I try this and works, but 16bit Flash adaptador need a mod to work. First cut trace on PH1 20240727_141727 And next join OE to PH3 20240727_141744

I don't remember if firmware need a mod, but i take a look in my old files.

This tested on HW5

A big thank you for your hardware update! I will fix my adapter later today. Does this mod update the flashid number or is it still C2FC ? And can you tell me what firmware version is flashed on your reader?

alx5962 commented 3 months ago

@herzmx I followed your instructions to mod my adapter:

my adapter

I reverted to the latest firmware and checked again my wiring. Now the detected flashid is 9090 and not C2FC. Don't know if it's ok or if my tests fried the eprom...

Also I noticed on your picture another wire on ground. Not related to this mod?

herzmx commented 3 months ago

I'm back, i lose my old files, but with rewind in my mind, so when 16-BIT adapter released PH1 is tracked to CPU CLK in SNES, now in HW5 PH1 don't tracked to SNES Slot, because use CICCLK instead. The change in adapter is to use PH3 to activate/deactivate OE and read words, this change works editing word readWord_Flash function

word readWord_Flash(unsigned long myAddress) {
  PORTF = myAddress & 0xFF;
  PORTK = (myAddress >> 8) & 0xFF;
  PORTL = (myAddress >> 16) & 0xFF;

  // Arduino running at 16Mhz -> one nop = 62.5ns
  __asm__("nop\n\t");

  // Setting OE(PH3) LOW
  PORTH &= ~(1 << 3);

  __asm__("nop\n\t"
          "nop\n\t"
          "nop\n\t"
          "nop\n\t"
          "nop\n\t"
          "nop\n\t");

  // Read
  word tempWord = ((PINA & 0xFF) << 8) | (PINC & 0xFF);

  __asm__("nop\n\t");

  // Setting OE(PH3) HIGH
  PORTH |= (1 << 3);
  __asm__("nop\n\t"
          "nop\n\t"
          "nop\n\t"
          "nop\n\t"
          "nop\n\t"
          "nop\n\t");

  return tempWord;
}

Please test... FLASH.zip

I don't know if this affect other flash memorys, so i don't make PR at this time, enjoy your GD-ROM conversion 👍

alx5962 commented 3 months ago

@herzmx thank you for your reply. I'm using HW3 so your update will work on it too or is it specific to HW5?

So you noticed my message on arcade projects forum 😁

herzmx commented 3 months ago

Sorry i didn't see HW version on issue description, so no HW mod it's need because CLK1 switch in HW3 activates PH1, but with HW mod you need use the FLASH.ini attached in previous message.

Please test, it should work on HW3 as well, in my previous test I had issues with the memory having a sticker with chinese characters.

alx5962 commented 3 months ago

Sorry i didn't see HW version on issue description, so no HW mod it's need because CLK1 switch in HW3 activates PH1, but with HW mod you need use the FLASH.ini attached in previous message.

Please test, it should work on HW3 as well, in my previous test I had issues with the memory having a sticker with chinese characters.

no problem at all!

I flashed the reader using the flash.ino file you provided. Now flashid is well detected (C2FC). But erasing doesn't seem to work (or takes more than 1 hour). I gonna try to find another 26l6420 eprom to check if the current one is not dead.