how long does it take (I2C write)?

I'm trying to avoid Arduino layer overhead and interrupts on an Uno or Nano by using direct register access and I'd like to replace a pair of 8-bit latches in an EEPROM/Flash ROM programmer project with an MCP23017 IC to drive 16 address lines.

It seems I can't drive the I2C bus much faster than 400-kHz on an Uno or Nano and I'm wondering if anyone can tell me how long it will take to perform two I2C write operations (after I've sent the I2C 'start' and I2C 'address' packets)?

TIA. Cheerful regards, Mike

MCP23017_Test.ino (11.8 KB)

Have you tried to look up I2C buss seed?

You might find a reference to:

The I 2 C reference design has a 7-bit address space, with a rarely used 10-bit extension. Common I 2 C bus speeds are the 100 kbit/s standard mode and the 400 kbit/s Fast mode.

It is 9 clock pulses (8 for the byte, 1 for ACK/NACK), and there is some overhead, so calculate with 10 clockpulses.

400 kHz = 2.5 µs
Two bytes is about 20 of those, that makes 50 µs.

800 kHz will be 25 µs.
The MCP23017 can even go faster.

Do you know the MultiSpeedI2CScanner ?
Have you seen the pictures with different pullup resistors ?
With a 5V I2C bus, the lowest value for the pullup resistor is 1667 Ω, for a sink current of 3mA.

Let us know how far you can push the speed of the I2C bus :stuck_out_tongue:

I already figured 2.5-uS per bit with a 400-kHz I2C bus and I estimated ~45-uS to perform two consecutive I2C writes. It's the "overhead" I'm concerned about. I can write a byte to flash memory between incoming serial characters at 115200 baud (~86 uS intervals) with my current programmer shield (see below) and I'd like to be able to do that after replacing the two latch ICs with an MCP23017 in a new design.

Cheerful regards, Mike

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.