Author Topic: Writing to Winbond W29C020  (Read 1219 times)

0 Members and 1 Guest are viewing this topic.

Offline gmcTopic starter

  • Regular Contributor
  • *
  • Posts: 136
  • Country: gb
Writing to Winbond W29C020
« on: May 22, 2020, 12:54:46 pm »
I'm using these Winbond 256K × 8 CMOS FLASH MEMORY chips in a project and first need to build a Arduino based programmer.

Not finding much on the internet or on the forums for this chip so doesn't look like its widely used for some reason.

http://pdf.datasheetcatalog.com/datasheets2/27/274053_1.pdf

Looking at the datasheet I've got a few queries on the method of programming. I'm  a bit confused as to how to write data.

The chip  needs to be programmed  in page write mode.

Quote
The W29C020 is written (erased/programmed) on a page basis. Every page contains 128 bytes of
data. If a byte of data within a page is to be changed, data for the entire page must be loaded into the
device. Any byte that is not loaded will be erased to "FF hex" during the write operation of the page.

The write operation is initiated by forcing CE and WE low and OE high. The write procedure
consists of two steps. Step 1 is the byte-load cycle, in which the host writes to the page buffer of the
device.

Step 2 is an internal write (erase/program) cycle, during which the data in the page buffers are
simultaneously written into the memory array for non-volatile storage.

But then it goes on to says software data protection is enabled by default so I need to  perform the three-byte command cycle at the beginning of a page load cycle

Looking at the timing waveforms is not making anything clearer   ???
Why are there 3 ways to write to the chip, CE controlled, WE controlled, and page write

Taking a wild guess here but  to program 256Kb would the sequence be:

- Write 3 byte sequence
- set address and data lines
- CE low, OE, high, WE high
-  Increment address, set data lines
- CE low, OE, high, WE high
- Repeat until 256Kb written

If its any clearer to someone who has used these I would appreciate a flow on how to program these.


« Last Edit: May 22, 2020, 12:59:45 pm by gmc »
 

Offline chriva

  • Regular Contributor
  • *
  • Posts: 102
  • Country: se
Re: Writing to Winbond W29C020
« Reply #1 on: May 22, 2020, 02:28:04 pm »
Let me start with: I _HATE_ these! (and Atmel's version).
Had to write a target resident driver for them on a CPU32 target a couple of years ago. Proper PIA. :)
Have you looked at 39sf020?

Writing data or a command should not behave differently in terms of pin and address behaviour so start by writing functions for read and write.

keep chip enable at all times (just tie it to ground)
Also: You can take quite many liberties. Just make sure hold and data direction times are met

Very ugly "psuedo code":
Code: [Select]
initialize()
{
    Set data pins as input
    set address pins as output, address doesn't really matter right now
    set OE and WE high, data direction output
}


writeByte(address, byte)
{
    Set address pins
    Make sure (Toes) is met
    Set data pins to output and set data byte
    Set WE low
    Make sure (Twp) is met
    Set WE high
    Make sure (Twph) is met
    _Set data pins to input_(!!!)
}


readByte(address)
{
    Set address pins
    Set OE low
    Wait (Trc). (Toe) is likely enough but let's be paranoid
    Read data byte
    _Set OE high_(!!!)
    Return data byte
}


writePage(address, *data)
{
    writeByte(5555,aa)
    writeByte(2aaa,55)
    writeByte(5555,a0)

    for number of pagebytes:
        writeByte(address++, data[pagebyte++])

    Make sure (Twc) is met (this is where the chip actually writes the data after you've filled the page buffer
}

You can optimize this quite significantly but it's better to take it safe and slow.
« Last Edit: May 22, 2020, 02:36:30 pm by chriva »
 

Offline gmcTopic starter

  • Regular Contributor
  • *
  • Posts: 136
  • Country: gb
Re: Writing to Winbond W29C020
« Reply #2 on: May 22, 2020, 03:39:28 pm »
Thanks  very much, that gives me something to work on.

I think I've been reading the datasheet for too long and getting more and more confused. Spent hours scouring the net for  examples.

 Beginning to see why you hate them  |O
 

Offline chriva

  • Regular Contributor
  • *
  • Posts: 102
  • Country: se
Re: Writing to Winbond W29C020
« Reply #3 on: May 22, 2020, 03:53:16 pm »
Just reading and writing a whole image is not too bad (it's pretty much standard procedure).
They become annoying once you want to write to other than page offsets since a read-modify-write must be performed :)

 

Offline gmcTopic starter

  • Regular Contributor
  • *
  • Posts: 136
  • Country: gb
Re: Writing to Winbond W29C020
« Reply #4 on: May 22, 2020, 04:22:09 pm »
Ok, doesn't sound too bad. I'm only interesting in reading/writing a full image.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf