I used the PB9 and PB10 of the S32K146 as SCL and SDA to simulate the I2C. It involves the SDA pin needing to switch between the input edge interrupt mode and the output mode. What API functions are needed? What should I pay attention to when switching?
Hi,
pin interrupt and function is selected using PORT.PCRn register. The pin direction is then set by GPIO PDDR register. See more in chapters 12 Port Control and Interrupts (PORT) and 13
General-Purpose Input/Output (GPIO) of teh device Reference Manual.
Anyway I2C pins should be bidirectional with open-drain output, which is not possible to set on normal GPIO pins of this MCU.
BR, Petr