It is currently Sat Jan 20, 2018 5:59 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Tue Oct 20, 2015 4:52 pm 
Offline

Joined: Sun Jun 12, 2011 12:06 pm
Posts: 293
Location: Poland
I would like to connect 4Mbit flash memory (29f040) to famicom so that famicom would be able to erase and program it, but I encountered a problem. The source of problem is that 6502 has only one R/!W signal instead of two !RD and !WR (as Z80 does, for example).

If I would like to connect SRAM to 6502, I would just connect:
!CS to some kind of decoder
!OE tied to GND
!WE to R/!W from CPU.

This will work, because when !OE and !WE are both active, SRAM is in write mode, according to datasheet:
Image Image

Doing the same trick on 29f040 flash memory does not work. That is becase when both !WE and !OE are active in 29f040 flash, the memory is in unknown state.

So I have two solutions:
1. Create W/!R by inverting R/!W and connect:
- !CE to out from address decoder
- !OE to W/!R
- !WE to R/!W
This works well but need extra logic for generating W/!R (extra output if using CPLD/FPGA for example)

2.
- tie !CE to GND
- tie !OE to out from address decoder (address decoder generates 0 when reading $8000-$FFFF and 1 in any other circumstance)
- tie !R/!W to R/!W
This also works well (and does not need any extra outputs, because we still need to have address decoder, just slightly modified) but writing to any other adress than $8000 still makes the memory to interpret this write cycle. Luckily, 29f040 need special 4 cycle write command to program one byte: 5555H/AAH, 2AAAH/55H, 5555H/A0H, PA/PD and 6 cycle command to erase whole memory, so it would be very improbable to inattentionally overwrite any bytes.

Do you have any other ideas?


Top
 Profile  
 
PostPosted: Tue Oct 20, 2015 5:44 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6642
Location: Seattle
Unfortunately, those are approximately your only options. It's hard to get simpler/cleaner than a single inverter.


Top
 Profile  
 
PostPosted: Tue Oct 20, 2015 6:32 pm 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3500
Location: Indianapolis
I've done the first method on like 3 different board designs, and it works fine. Like lidnariq said, an inverter is about as simple as it gets. If you have no use for the other gates on a quad or triple gate 74HC, and wanted to get fancy, you could use a 74HC1G04. On my very first board I tried making an inverter out of a transistor and 2 resistors, but failed miserably (luckily I left a space for a 74HC04 on the board in case it didn't work, hehe).

The 2nd method is certainly clever, but I'd have to say it seems a little yucky. Technically you can send the commands and have it work fine, but there is a bit more to it, and that's the polling required to check if the programming is done. Admittedly, I've put near zero effort into optimizing my flash writing routines (I'd just rather have it be 'safe'), but I'm pretty sure when I get to the polling part I've always ended up using some temporary RAM values. In reality, with the 39SF040 I've found that I can actually just wait a fixed amount of time instead of polling. By the time the NES runs all that code, it's supposed to be finished (datasheet lists the timing). The AM29F040B however, it's been years since I used that chip, but I remember it took wildly different amounts of time for the erase to finish, and it's probably the same for programming too. If you can write code comfortably that doesn't need to write to RAM during the program/erase operations, this method might be OK though.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group