Difference between 24LC32 and 24LC32A using PIC 16F877A's I2C protocol?

Apr 22, 2005 4 Replies

Hello all,



Are there any architectural differences between Microchips 24LC32A and



24LC32? I use a code which works fine for 24LC32A (I was able to write to it correctly and read the exact contents from the universal programmer); and doesnt produce any results on 24LC32... I am stuck with 24LC32 though and must get that to work (which is arriving in a bulk order). Any ideas on top of anyone's mind, I'd appreciate it...

Thnx in advance



Mak


The only real difference I see from the datasheets is that the 24LC32 uses some kind of chaching when writing data.

Maybe you can provide more details... Is "read" working correctly (ACK'd)? Does a write issue an ACK?

HTH Wolfgang

From-address is Spam trap Use: wolfgang (dot) mahringer (at) sbg (dot) at

Check the datasheet regarding write buffer size (the number of bytes you can write in one operation)

- this is the most common difference between eeprom parts with different suffixes.

Also check on a digital scope that your I2C waveforms are correct and all the timings are right- different parts may have differing tolerences to out-of-spec protocol - there are many ways in which I2C can be 'not quite' right, e.g. some devices will tolerate not NAKing on the last byte of a read, some will have problems.

As a quick test, try running the product at a much slower clock - if it then works there is an I2C timing issue somewhere.

Hello all,

I think I need to follow up with source code here, can some one spot some potential timing issues with this code which may cause the write operation to fail.

The code would select the device using ADDRSW for write operation, RomAddrsW:2 provides the address, data is provided by RomDataW. The observation is that after writing the first byte it gets stuck somewhere. And if you notice in the code, I shouldnt have timing problems since the clock frequency is 333khz (4MHZ crystal and BRG value = 2). This code works fine with 24LC32A but doesnt work with

24LC32... any ideas ?

WrtStart: banksel SSPCON2 bsf SSPCON2, SEN ; initiate start condition btfsc SSPCON2, SEN ; hardware reset to 0? goto $ - 1 ; if not, poll again

WrtAddrs: banksel SSPBUF ; select device movlw ADDRSW ; apply device address to write to movwf SSPBUF banksel SSPSTAT btfsc SSPSTAT, R_W ; poll until reset to indicate xmit complete goto $ - 1 banksel SSPCON2 btfsc SSPCON2, ACKSTAT ; if ACKSTAT is cleared by slave, then continue goto WrtStop ; if not set, then slave sends not acknowledge

banksel SSPBUF movf HIGH ( RomAddrsW ), w ; apply device address to write to movwf SSPBUF banksel SSPSTAT btfsc SSPSTAT, R_W ; poll until reset to indicate xmit complete goto $ - 1 banksel SSPCON2 btfsc SSPCON2, ACKSTAT ; if ACKSTAT is cleared by slave, then continue goto WrtStop ; if not set, then slave sends not acknowledge

banksel SSPBUF movf LOW ( RomAddrsW ), w ; apply device address low to write to movwf SSPBUF banksel SSPSTAT btfsc SSPSTAT, R_W ; poll until reset to indicate xmit complete goto $ - 1 banksel SSPCON2 btfsc SSPCON2, ACKSTAT ; if ACKSTAT is cleared by slave, then continue goto WrtStop ; if not set, then slave sends not acknowledge

WrtByte: banksel SSPBUF movf RomDataW, w ; apply device address to write to movwf SSPBUF banksel SSPSTAT btfsc SSPSTAT, R_W ; poll until reset to indicate xmit complete goto $ - 1 banksel SSPCON2 btfsc SSPCON2, ACKSTAT ; if ACKSTAT is cleared by slave, then continue goto WrtStop ; if not set, then slave sends not acknowledge

WrtStop: banksel SSPCON2 bsf SSPCON2, PEN ; generate stop condition btfsc SSPCON2, PEN ; is PEN bit reset? goto $ - 1 ; if yes, exit

exit_wrt: return ;-------------------------------------------------------------

Any help...

Thnx in advance

Mak

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required