Shop OBEX P1 Docs P2 Docs Learn Events
Propeller External EEPROM — Parallax Forums

Propeller External EEPROM

NewzedNewzed Posts: 2,503
edited 2006-07-18 16:13 in Propeller 1
I have just completed the preliminary design for a piggyback EEPROM for the Propeller, a screen shot of which is attached.· The EEPROM is an
AT45DB041, a 4MB EEPROM arranged as 2048 pages of 264 bytes each.· It is page-write only and operates on 3VDC which is taken from the Propeller power supply.· The attachment is shown with the EEPROM jumpered to Pins 0-4.· However, pads are provided for jumpering to Pins 11-15 and Pins 16-20.· I wouldn't have the foggiest about how to write a SPIN program for the EEPROM but I can supply a Stamp program than runs it, which a user should be able to convert to Spin.

The piggyback is plugged into the Prop socket underneath the Propeller.· I have made several of these piggybacks for the Stamp but none for the Propeller.· The boards are made on my SuperMill, single sided, so if anyone is interested I'll give it a shot.· If you have any questions about the AT45, please ask.

Sid
448 x 323 - 17K

Comments

  • NewzedNewzed Posts: 2,503
    edited 2006-07-18 15:01
    Well, I'm up to my glutinous maximus in aquatic reptiles again.· I have this piggyback EEPROM, which is just plugged into a breadboard at the moment, and I'm trying to figure out how to write and read it.

    With my Stamp, I first write to the 264-byte buffer:

    Write_DataBuffer:······ 'DO NOT modfiy shiftouts
    'IF d = "I" OR d = "i" THEN GOSUB cont6
    'IF d = "E" OR d = "e" THEN GOSUB cont7
    PAUSE 100
    b = b+ 1
    LOW CS
    SHIFTOUT Dout,Sclk,MSBFIRST,[noparse][[/noparse]Buffer_1_Write\8, dummy\15, BAddr\9]· 'Buffer_1_Write con $84
    SHIFTOUT Dout,Sclk,MSBFIRST,[noparse][[/noparse]v1.lowbyte,v1.highbyte,v2.lowbyte,v2.highbyte, v3.lowbyte,v3.highbyte,b.lowbyte, b.highbyte]
    HIGH CS
    DEBUG "Buffer:",· crsrx, 9, DEC v1/10, ".", DEC1 v1, crsrx, 18,DEC v2/10, ".", DEC1 v2,crsrx, 27, DEC v3/10, ".", DEC1 v3, crsrx, 37, DEC b, crsrx, 44, DEC baddr, cr
    LOW red
    PAUSE 500

    PAUSE 200
    IF baddr = 256 THEN
    baddr = 0
    GOSUB writemain
    Baddr = 0
    GOTO main
    ENDIF

    BAddr = BAddr + 8
    IF b = a THEN
    GOSUB writemain
    DEBUG cr, "Press any key to continue", cr
    DEBUGIN com
    GOTO start
    ENDIF
    PAUSE dly/60
    GOTO main

    If I stop writing to the buffer or if it is full, my program automatically writes the contents of the buffer to main memory:
    WriteMain1:

    LOW cs
    PAUSE 10
    SHIFTOUT Dout,Sclk,MSBFIRST,[noparse][[/noparse]Xferout\8]·· 'Xferout CON $83
    PAUSE 10
    SHIFTOUT Dout, Sclk, MSBFIRST, [noparse][[/noparse]0\4]
    PAUSE 10
    SHIFTOUT Dout, Sclk, MSBFIRST, [noparse][[/noparse]PAddr\11]
    PAUSE 10
    SHIFTOUT Dout, Sclk, MSBFIRST, [noparse][[/noparse]Dummy\9]
    PAUSE 10
    HIGH cs
    PAUSE 500
    DEBUG "Page ", DEC paddr, " written to main", cr, cr

    baddr = 0
    PAddr = Paddr + 1
    RETURN
    To read the main memory, I write:

    ReadMain:

    DEBUG cr, "Reading main", cr

    IF a = 0 THEN
    GOSUB atdata
    ENDIF

    cont1:
    paddr = 0
    DEBUG cr, "Reading page ", DEC PAddr, cr, cr
    b = 0
    byaddr = 0

    ReadMain1:
    b = b + 1

    IF b>a THEN
    GOTO start
    ENDIF

    LOW cs

    SHIFTOUT Dout,Sclk,MSBFIRST,[noparse][[/noparse]$D2\8]······· 'Xferin con $D2-$E8 cont. read
    SHIFTOUT Dout,Sclk,MSBFIRST,[noparse][[/noparse]0\4]········· 'reserved bits set to logical 0 per page 15
    SHIFTOUT Dout,Sclk,MSBFIRST,[noparse][[/noparse]paddr\11]····· 'page to read
    SHIFTOUT Dout,Sclk,MSBFIRST,[noparse][[/noparse]Byaddr\9]···· 'starting byte to read
    SHIFTOUT Dout,Sclk,MSBFIRST,[noparse][[/noparse]Dummy\16]···· 'don't care bits
    SHIFTOUT Dout,Sclk,MSBFIRST,[noparse][[/noparse]Dummy\16]···· 'don't care bits
    SHIFTIN Din ,Sclk,MSBpre,[noparse][[/noparse]v1.lowbyte,v1.highbyte,v2.lowbyte,v2.highbyte, v3.lowbyte,v3.highbyte, b.lowbyte, b.highbyte]
    HIGH cs

    DEBUG· "Data:· ", DEC v1/10, ".", DEC1 v1,"···· ",· DEC v2/10, ".", DEC1 v2, "···· ", DEC v3/10, ".", DEC1 v3,"······· ",DEC b, cr

    Byaddr = Byaddr + 8

    IF Byaddr >256 THEN
    DEBUG cr
    Byaddr = 0
    Paddr = Paddr + 1
    DEBUG "Reading Page ", DEC paddr, cr, cr
    GOTO readmain1
    ENDIF

    GOTO ReadMain1

    Anyone feel like helping?· Need more info?

    Sid
  • edited 2006-07-18 16:13
    While you are at it you might as well use the 16-Megabit version (4 Megabytes) AT45DB161

    Digikey PN AT45DB161D-SU-ND

    -Dan
Sign In or Register to comment.