Shop OBEX P1 Docs P2 Docs Learn Events
Basic stamp and eeprom interface- how many times can the stamp be programmed? — Parallax Forums

Basic stamp and eeprom interface- how many times can the stamp be programmed?

i2c_confusedi2c_confused Posts: 10
edited 2006-03-31 06:53 in General Discussion
My project involves I2C communication of the bs2 with an eeprom chip (24fc515). I am using bit blasting, so thats basically an algortihm that manually sets the pins high and low for I2C communicaton.

I was testing it on a breadboard and it was working... for an entire month! Then, today it stopped working all of a sudden. I can write to eeprom, but I cant read. When I go in0, which is my sda pin, I get a high signal. All 1's. Why is this happening?

Does the stamp have a limit to ther number of times it can be programmed? Do the input line drivers die after a while?

I changed nothing in my circuit or program. I even put in new batteries!

The code that I based my stuff on is as·follows: My code is similar, with more functions as I have a couple of other chips on my board...

******************************************************************************************************
'{$STAMP BS2}
' {$PBASIC 2.5}
'I2C test program. 28/8/2002 Ben Lennard
'Bit Bashing I2C on a Parallax BS2
'Write some data to an I2C EEPROM and then read it back
'CONSTANTS
SCL CON 1
SDA CON 0
EEPROM_0_Write CON %10100000
EEPROM_0_Read CON %10100001
'VARIABLES
ack VAR Bit
I2C_data VAR Byte
shift_bits VAR Byte
MASK VAR Byte
i VAR Byte
datain VAR Byte
Memory_Address VAR Byte
DIRS = %1100001111111111
'MAIN CODE
Main:
FOR Memory_Address = 0 TO 38
GOSUB StartI2C
'READ EEPROM...
I2C_data = EEPROM_0_Write
GOSUB Write_data
I2C_data = Memory_Address
GOSUB Write_data
GOSUB StartI2C
I2C_data = EEPROM_0_Read
GOSUB Write_data
DIRS = %0100001111111111
'this for loop converts serial data to parallel data
FOR i = 1 TO 8
datain = datain << 1
datain = datain + IN0
'debug dec IN14
PULSOUT SCL,1
NEXT
DIRS = %1100001111111111
GOSUB StopI2C
DEBUG datain', 13
NEXT
STOP
END
'Check for Receiver Acknowledge - not really needed in this example...
RX_ACK:
HIGH SDA
DIRS = %1000001111111111
HIGH SCL
ack = IN0
LOW SCL
DIRS = %1100001111111111
IF ack = 1 THEN indicate_NO_ACK
'DEBUG "Acknowledged", 13
RETURN
indicate_NO_ACK:
'debug "NO Acknowledge", 13
RETURN
'Start Procedure. Set start condition on bus: SDA Hi-Lo while SCL Hi
StartI2C:
HIGH SDA
HIGH SCL
LOW SDA
LOW SCL
RETURN
'Stop Procedure. Set stop condition on bus: SDA Lo-Hi while SCL Hi
StopI2C:
LOW SDA
HIGH SCL
HIGH SDA
RETURN
'Write Address/Data Procedure
Write_data:
MASK = %10000000
LOW SCL
'this for loop converts parallel data to serial data
FOR shift_bits = 0 TO 7
'determine whether to put a 0 or 1 on to SDA
IF (I2C_data & MASK) > 0 THEN SDA_HIGH
LOW SDA
GOTO SKIP_SDA_HIGH
SDA_HIGH:
HIGH SDA
SKIP_SDA_HIGH:
'debug dec OUT14
PULSOUT SCL, 1 'Toggle the clock
MASK = MASK >> 1 'Shift MASK right 1 bit $80->$40->$20...$01
NEXT
'debug 13
GOSUB RX_ACK 'Check reciever has acknowledged
RETURN

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-03-29 20:52
    In theory you could re-program 10,000,000 times.· But it sounds like the external EEPROM is what's having trouble, not the BASIC Stamp.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2006-03-31 06:53
    Useful EEPROM life can be extended by spreading your Erase/Write cycle over an array.

    http://www.edn.com/contents/images/47235.pdf

    I came across the above article at another discussion group and I find the subject quite interesting. It took a lot to read through the article as he spends the first two of three pages on a convoluted introduction. Nonetheless, it does work.

    There are alternatives that I have found, but they require that the data be predicatably accending or decending [noparse][[/noparse]essentially self-indexing] or that an index be added on to the data. In these cases, a pointer can be simply established by seeking the highest or lowest value.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "When all think alike, no one is thinking very much.' - Walter Lippmann (1889-1974)

    ······································································ Warm regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
Sign In or Register to comment.