2
\$\begingroup\$

I'm using this Microcontroller S32K142 64 pin.

In the reference manual, I can see a lot of pins which I assume to be Output only are mentioned as Input / Output. For example, the Microcontroller is the master I2C Clock. So, in that case, the clock can only be output, right? But why is it given as I/O?

enter image description here

Mitu Raj
11k6 gold badges25 silver badges49 bronze badges
asked May 20, 2021 at 15:28
\$\endgroup\$
0

1 Answer 1

6
\$\begingroup\$

Most I2C devices allow clock stretching, by which the slave can 'slow down' a bit when it can't catch up with the speed of SCLK generated by the master.

The slave does that so by stretching the SCLK line low after receiving/sending a byte (the master relinquishes the control on SCLK at this time). The slave pulls the clock back to high when it's ready to process the next byte. The master detects this and takes the control of SCLK again, and the communication resumes.

In such I2C devices, SCLK also has to be a bidirectional line (open-drain/open-collector).

Also being I/O SCLK pin, this gives the flexibility of configuring the I2C device as either master/slave.

answered May 20, 2021 at 16:39
\$\endgroup\$
3
  • 2
    \$\begingroup\$ Additionally, I2C seems to be only one possible fucntion of this pin. For most chips, a pin that can do I2C can also be programmed as GPIO. \$\endgroup\$ Commented May 20, 2021 at 17:34
  • \$\begingroup\$ @WoutervanOoijen I don't think you are correct. That list looks like a list of what all functions are available as alternate functions for the PTA3 pin, and LPI2C0_SCL is only one of the alternate functions for this PTA3 pin. \$\endgroup\$ Commented May 20, 2021 at 20:03
  • \$\begingroup\$ I haven't read this one, but in most datasheets 'alternate' means 'apart from GPIO'. \$\endgroup\$ Commented May 21, 2021 at 16:28

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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