Electronic – slew rate for I2C


I'm configuring I2C on a PIC18 using the built-in functions of the C18 compiler as described in section 2.4 of the documentation:

void OpenI2C2( unsigned char sync_mode,
    unsigned char slew );

I'm not sure what I should do with slew. I can choose from two options, defined in i2c.h:

  • SLEW_OFF: Slew rate disabled for 100 kHz mode
  • SLEW_ON: Slew rate enabled for 400 kHz mode

In the datasheet in register 15-1, page 257, the two options are explained in a bit more detail:

  • 1 = Slew rate control disabled for standard speed mode (100 kHz and 1 MHz)
  • 0 = Slew rate control enabled for high speed mode (400 kHz)

I don't understand it though – I have a couple of questions:

  1. What is slew rate?

  2. For me, the two options don't make sense – what if I'd want to disable the slew rate for 400kHz and enable it for 100kHz? Why is this?

  3. When should I choose SLEW_OFF and when SLEW_ON?

Best Answer

Slew rate is how fast the signal changes from low to high, or vice versa. By limiting this abrupt transition, you can reduce ringing from signal reflections, and limit crosstalk between signal lines.

The way it works out, though, is that at 100kHz, the signal rates are so slow that the slew rate doesn't really matter; at 400kHz you may be able to fix an otherwise problematic circuit by limiting it; but then when you get to 1MHz you really need all the transition speed you can get, and so you just have to do good signal matching and route your lines more carefully.

The bit in question does nothing more than enable or disable the feature. The rest is simply advice. The speeds are in parentheses, as it is just a suggestion.