how to set s32k144 sdas/scls pin(PTA0 PTA1) in a I2C slave mode
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I get a hw board use PTA3 and PTA2 as the I2C pins. In my application, i need s32k144 to perfom a I2C master role when boot up, and then, after commuticate with another i2c slave device, it should be change to i2c slave mode. i have configed those pins to flexiomode(ALT4), and the i2c master mode work fine. Now, i don't know whether those pins can be used in lpi2c slave mode, and how to set that.
i have tried :
1. init pin in flexio mode, call api flexio_i2c_drv_masterinit
2. after i2c master mode work fine, call api flxio_i2c_drv_masterdeinit, and flxio_drv_deinitdevice, reconfig PA0 and PA1 to PORT_MUX_ALT3 in pin_mux_initconfigarr0 and call api pins_DRV_Init() again
3. init a lpi2c slave item.
What else do I need to do

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @logly
Changing from I2C Master to I2C Slave at runtime is possible, but not recommended due to:
- Complex reconfiguration: You need to disable the current mode and enable the other, which may interrupt ongoing communication.
- Pin and interrupt conflicts: These need to be managed carefully to avoid issues.
If you decide to do this, make sure to wait for active communication to finish, disable one mode before enabling the other, and properly manage interrupts.
It is recommended operate in one mode at a time to avoid complications. For reference, check the example lpi2c_slave_s32k144 included in the SDK, which demonstrates how to configure I2C in slave mode.
BR, VaneB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Finally, as a supplement, there was an error in my first question,the pin i'm using is PTA0 and PTA1, not PTA2 and PTA3.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @logly
The use of secondary I2C lines as master or slave is only available for 4-wire mode. I recommend checking the following threads, where this topic is discussed in more detail.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear:
I can ensure that the communication has ended before i2c change to slave mode and i know how to init a i2c slave by referring to the lpi2c slave example code.
Now my only question is how to configure the PTA0 PTA1 pin as i2c slave pins.All the examples i have found are always using PTA2 and PTA3 as i2c pins because they can be configured to lpi2c pins easily.But PTA0 PTA1 can only be configured to sdas and scls pin, and there's no examples show how to use this pin config(PTA0-ALT3 PTA1-ALT3) in i2c slave mode.
By the way , according to this link, https://community.nxp.com/t5/S32-SDK/On-S32K144-PTA0-and-PTA1-port-can-not-be-used-as-I2C-SCL-and-SD... it seems that PTA0 PTA1 can't be used as i2c slave pins in lpi2c mode, what else can i do if it's true?
