Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/29/07 09:38
Read: times


 
#139961 - Polling the 24C02 EEPROM for ready
Responding to: ???'s previous message
Philippe,

Your primitive functions look fine to me. No I have not run the code on a real chip.

However I would suggest that you actually use the return values from the primitive functions.

i.e. if !i2c_start() then the bus is NOT free.
and since a i2c_putbyte(c) is normally followed by looking for an ACK, why not combine with readACK() and make it:
bit i2c_putbyte(c) and use the result.

So after you have sent i2c_stop() to initiate a page-write on your EEPROM, the device will no longer acknowledge a i2c_putbyte(SLAVE_ADS) until it is ready.

Either just wait for 5 mS for the write to finish, or use a polling sequence of:
for (attempts = 10; attempts-- && !i2c_start() && !i2c_putbyte(0xAE); ) delay_ms(1);
return (attempts != 0);

In practice these EEPROMS have typical write times of about 3mS unless you are using a very low Vcc.

HTH David.

List of 21 messages in thread
TopicAuthorDate
I2C eeprom 24c02 byte write stuck in ack            01/01/70 00:00      
   timing            01/01/70 00:00      
      timing            01/01/70 00:00      
         what\'s the problem, exactly?            01/01/70 00:00      
            timing            01/01/70 00:00      
               how do you know that?            01/01/70 00:00      
                  How do you know that?            01/01/70 00:00      
                     do you have some other version of code?            01/01/70 00:00      
                        do you have some other version of code?            01/01/70 00:00      
               A work around For That            01/01/70 00:00      
                  work around For That            01/01/70 00:00      
   Well in my guess, you have same problem:-) as mine            01/01/70 00:00      
      Polling the 24C02 EEPROM for ready            01/01/70 00:00      
         OOPS wrong logic            01/01/70 00:00      
            I thought that I should try your code            01/01/70 00:00      
               Polling the 24C02 EEPROM for ready            01/01/70 00:00      
                  great, but do not forget to mention            01/01/70 00:00      
                     The Clock            01/01/70 00:00      
                     addition - show the full picture - 'edit' to above            01/01/70 00:00      
                  i2c function signatures            01/01/70 00:00      
   hello friend            01/01/70 00:00      

Back to Subject List