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

\$\endgroup\$
0
7
\$\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.

\$\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\$ May 20 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\$
    – Justme
    May 20 at 20:03
  • \$\begingroup\$ I haven't read this one, but in most datasheets 'alternate' means 'apart from GPIO'. \$\endgroup\$ May 21 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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