# What is 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?

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.

• Thanks! It seems to be a nice option - why wouldn't I use slew rate control? – user17592 Apr 13 '13 at 17:16
• @CamilStaps - My my understanding, it sounds like you might have misread the answer. Having sharp transitions (SLEW_ON) causes extra EMI noise and ringing. Having slow transitions (SLEW_OFF) reduces EMI but reduces the maximum useable frequency of the link. It's a trade-off. – Tim Apr 13 '13 at 17:58
• @gbarry: Ah, so with slew rate control off the signal is as close to square waves as the uC can make it. With slew rate control on the wave high/low transitions are more sloped (= less vertical) than they otherwise would be? – angelatlarge Apr 13 '13 at 19:09
• That's correct, although I'm not sure how dramatic it is on the PIC (I should check it). Historical note: The RS232 spec had a slew rate limitation, so someone came out with a driver chip that had nice slope-y output signals. And then we all started using faster and faster bps rates so we couldn't use that chip... – gbarry Apr 14 '13 at 7:15
• Three years later, and i had this same question, but I actually measured it. For future reference, on a PIC16F1454 with 4.7k pull-ups and a single slave on the bus, the fall-time is 2.9 ns without slew rate limiting (possibly limited by my 150 MHz probe), and 151 ns with slew rate limiting. It does not affect the rise-time. – pipe Sep 5 '16 at 17:27

## protected by W5VO♦Apr 13 '13 at 17:43

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?