Electronic – Estimating EEPROM read time

eeprompic

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.

Best Answer

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.