Take the 2-minute tour ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

This is a question in relation to USB transmissions crash my software GUI.

I posted this question separately so that I could clarify my question separate from the other one.

I have the same operating code here and I would like to ask: How can we estimate the EEPROM read time from I2C communication running at 100kHz?

main()
{
    usbinit(); // usb initialization
    while(1)
    {         
        x=do_eepromread();
        UsbTasks(); // does usb works
        yourtasks(); //sends the buffer
    }
}

I trust reading a chunk of data from EEPROM won't do any damage than doing adc_conversions and calculations.

I don't want a precise time duration. But I trust read will occur quite fast rather than write that will take 5ms minimum.

I could not find any EEPROM read time though is it because it depends upon baud rate of communication (I2C here @ 100kbps).

I would love to have your thoughts and information in regards to this problem.

share|improve this question
    
Start conditions, stop conditions, address bits, operation bits, data bits. Add those up and divide by the bit rate (since reads are essentially zero-latency at that frequency). –  Ignacio Vazquez-Abrams Feb 22 at 7:02

2 Answers 2

up vote 2 down vote accepted

You could calculate it by reading the EEPROM datasheet and adding up the time take to transfer all the bits as Ignacio Vazquez-Abrams suggested in a comment. Because you've already selected a device and have it working though you might find it easier just to measure it. Normally I'd do something like the following and use a scope to measure it:

// Take an I/O pin high
x=do_eepromread();
// Take the I/O pin low

If you don't have a scope you could enclose the reading in a loop and maybe turn a LED on and off with something like this:

uint32_t i;
// Turn on LED
for (i=0; i < 100000; i++)
    x=do_eepromread();
// Turn off LED

Depending on how many bits are transfers the second piece of code will probably take something like 30 seconds or so which you should be able to measure reasonably accurately with a stopwatch and then divide by 100,000.

Both those methods will introduce some error because of the time to toggle an I/O line and in the latter case the the loop delays, but I think for your purposes they should be near enough and you might find it easier than trying to calculate it exactly.

share|improve this answer

Actual read time on a SEEPROM is basically instantaneous (one clock cycle, like a serial RAM). You want to measure the data transfer time over the I2C bus, which is a different question, and you have an answer to that.

Write takes longer because a much slower process (Fowler-Nordheim tunneling) is used to erase and then write floating transistor gates at the the target location(s). The write time is milliseconds rather than nanoseconds.

That's why the data sheet doesn't spec read times separately.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.