S32K314 Simulate IIC using GPIO

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K314 Simulate IIC using GPIO

267 Views
Joker_Y
Contributor II

Hi,

我在使用S32K314,172管脚封装,这三个管脚做模拟IIC的时候,PTD13用作SDA数据管脚,发现MCU无法将SDA配置成开漏输入,导致IIC设备无法拉低SDA。请问应该怎么解决?

Joker_Y_0-1780480319081.png

Joker_Y_1-1780480548110.png

Joker_Y_2-1780480652479.png

 

Joker_Y_3-1780480658189.png

Joker_Y_4-1780480838753.png

在绿色波形箭头位置,我将蓝色的SDA设置为了输入模式,此时应该由外部设备拉低SDA,但实际上并没有被拉低,请问这是为什么?

 

 

0 Kudos
Reply
5 Replies

215 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @Joker_Y 

There is no dedicated open-drain configuration available in the SIUL2 module. However, when a pin is configured (muxed) to a peripheral that supports open-drain behavior like LPI2C the pin will behave accordingly and can be used in open-drain mode with other devices.

In these situations, the actual behavior comes from how the peripheral (e.g., LPI2C) is configured rather than SIUL2 itself.

VaneB_0-1780518215080.png

You can configure the following options in the Pins Tool and Siul2 Port driver:

  • Enable/disable the input buffer
  • Enable/disable the output buffer
  • Configure internal pull-up or pull-down
Please note that S32K3 devices already include a native LPI2C designed to handle I2C communication. While it is technically possible to emulate I2C via GPIO using custom software, this approach falls outside the scope of our support. As a result, we are unable to guarantee its functionality or performance.

 

BR, VaneB

0 Kudos
Reply

205 Views
Joker_Y
Contributor II

Hi,VaneB

请问在使用过程中(程序允许过程中),Enable/disable the input bufferEnable/disable the output bufferConfigure internal pull-up or pull-down这些应该怎么操作?你们有没有GPIO模拟软件IIC的demo,可以发一下吗?谢谢

Tags (1)
0 Kudos
Reply

145 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @Joker_Y 

When adding a pin in the Pin tool within the configuration tools, several parameters become available, such as Direction, Safe Mode Control, and Pull Select, among others. These parameters are presented as drop-down lists, allowing you to select the appropriate configuration for each pin.

VaneB_0-1780680202789.png

All selected configurations are applied to the pins during initialization when calling Port_Init() or Siul2_Port_Ip_Init().

Regarding a demo for emulating I2C via GPIO, we currently do not provide such an example. As mentioned previously, S32K3 devices include a native LPI2C peripheral, which is specifically designed to handle I2C communication

If emulation is required, examples using FlexIO for I2C emulation are available as an alternative approach.

0 Kudos
Reply

115 Views
Joker_Y
Contributor II

Hi,VaneB

我在使用IO模拟IIC过程中发现,当配置为Input模式的时候,发现外部芯片的SDA管脚无法拉低NXP芯片的管脚。您说的FlexIO for I2C的demo麻烦提供一下谢谢。

0 Kudos
Reply

20 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @Joker_Y 

The RTD package provides two examples: "I2c_Example_S32K3xx" and "I2c_Ip_Example_S32K3xx" (where xx corresponds to the specific S32K3 derivative). Both examples implement communication between an LPI2C instance and an emulated I2C interface using FlexIO.

Currently, there are no examples specifically available for the S32K314 device. However, the example provided for the S32K344 can be used as a good reference for your application.

For guidance on how to create a project based on these examples, please refer to:
HOWTO: S32 Design Studio - Create a New S32DS Project from Example

0 Kudos
Reply