4
\$\begingroup\$

Both I2C and SWD are two-wire protocols. I wonder what are the main differences of the hardware layer of these protocols and what are the pros/cons of each one?

It's also interesting that the maximum claimed speed for i2c is 5MHz (version 4, ultra-fast mode) and 50MHz for SWD. Why is the difference so big? Is it possible to achieve the same speed for I2C if same hardware components are used in theory?

\$\endgroup\$
1
  • 1
    \$\begingroup\$ well, one reason why the I2C physical layer is slower is because they are open collector inputs, and are very much affected by the pull up resistors used, and bus capacitance for rise and fall times respectively. The JTAG interface pins for SWD are some other form of newer higher speed technology, with less impedance issues due to different driver/receiver format. I2C is quite an old system, so it uses older methods which are obviously for lower bandwidth. \$\endgroup\$
    – KyranF
    Apr 24, 2014 at 9:04

1 Answer 1

6
\$\begingroup\$

I2C spec: http://www.nxp.com/documents/user_manual/UM10204.pdf

The main difference is in the handling of multiple devices on the same pair of wires. I2C allows this, SWD does not. As a result, I2C was designed to use open-collector logic with pull-up resistors: this is robust (no way one device can damage another by fighting over whether the line is 1 or 0) but it drastically limits the speed. SWD is single-master: the debug host is always controlling the bus, and occasionally reading data up from the slave. I2C is multi-master: any device can start talking at any time.

In fact, the 5MHz "ultra-fast" version (see section 3.2 of the spec) gives up multi-master and bi-directionality in order to achieve that speed.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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