NXP S32K312EVB I2C Example not working

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

NXP S32K312EVB I2C Example not working

Jump to solution
788 Views
beginner100
Contributor II

I am using an NXP S32K312 EVB with Simulink NXP MBDT Example - s32k3xx_i2c_async_s32ct.slx

beginner100_3-1753108784095.png

I made sure to follow instructions - these pins are connected

beginner100_0-1753108540123.png

beginner100_1-1753108599034.png

Looking at the last instruction, I checked the schematics of the EVB and it seems they have pullup resistors already, I was able to locate them on board as well. All jumpers are connected as mentioned in  S32K312EVB-Q172 - Hardware User Manual.

beginner100_2-1753108698764.png

 

Build and flash - no issues observed.

When I run FreeMASTER, I see no change on "slave_send" variable being changed at all. Does it something have to do with interrupt in this case, please confirm. I suspect this because, this is what increments the "slave_send" variable. Please let me know the steps to enable it. Attached is the .mex

 

beginner100_4-1753108864297.png

beginner100_5-1753108928674.png

#s32k3 #s32k312 #i2c #mbdt 

 

 

 

 

 

 

 

0 Kudos
Reply
1 Solution
573 Views
stefanvlad
NXP Employee
NXP Employee

Hi @beginner100 

 

Can you provide a picture of your setup with the S32K312EVB-Q172 and the connections?

Just to be sure, have you connected the Pull-up resistors for pins PTD14 and PTD13 as in the picture below? 

stefanvlad_0-1753776951488.png

Just in case I have attached the s32k311_i2c_async_s32ct.zip that I have tested and it works on my S32K312EVB-Q172.

 

Please test it and send me all details and pictures,

Stefan V.

 

View solution in original post

0 Kudos
Reply
6 Replies
500 Views
beginner100
Contributor II

Hello @stefanvlad

One more question on the same example and it's this event "I2C_SLAVE_EVENT_TX_REQ" within Hardware Interrupt Callback (MBDT_I2C_Callback)

Why is the Event output being compared to 5 ?  Is I2C_EVENT_TX_REQ_SLAVE defined as 5? Where can I find this configuration in the S32CT tool? What other events are available and can you please explain and help me understand this better, thank you!

 

beginner100_1-1753906127597.png

 

beginner100_0-1753906097035.png

beginner100_3-1753906178842.png

 

 

 

 

0 Kudos
Reply
194 Views
stefanvlad
NXP Employee
NXP Employee

Hi @beginner100 ,

 

There is a structure defined in the Lpi2c_Ip_Callbacks.h:

/**
* @brief Define the enum of the events which can trigger I2C slave callback
*
* This enum should include the events for all platforms
* implements Lpi2c_Ip_SlaveEventType_enum
*/
typedef enum
{
I2C_SLAVE_EVENT_ERROR_BIT = 0x00U,
I2C_SLAVE_EVENT_UNDERRUN = 0x01U,
I2C_SLAVE_EVENT_OVERRUN = 0x02U,
I2C_SLAVE_EVENT_RX_FULL = 0x03U,
I2C_SLAVE_EVENT_TX_EMPTY = 0x04U,
I2C_SLAVE_EVENT_TX_REQ = 0x05U,
I2C_SLAVE_EVENT_RX_REQ = 0x06U,
I2C_SLAVE_EVENT_STOP = 0x07U,
I2C_SLAVE_EVENT_DMA_TRANSFER_ERROR = 0x0EU
}Lpi2c_Ip_SlaveEventType;

 

To open the S32 Configuration Tools, you need to select an NXP block, and press Configure:

Screenshot 2025-08-27 183548.png

Then when S32CT is opened, you can go to Platform in the Interrupt Controller, to locate the LPI2C0_Master_Slave_IRQHandler:

Platform Configuration Interrupt Controller.png

 

Best regards,

Stefan V.

0 Kudos
Reply
568 Views
beginner100
Contributor II

I have used the model from the .zip shared, and now it seems to be working fine. Yes, I have also connected the resistors as you mentioned. 

0 Kudos
Reply
574 Views
stefanvlad
NXP Employee
NXP Employee

Hi @beginner100 

 

Can you provide a picture of your setup with the S32K312EVB-Q172 and the connections?

Just to be sure, have you connected the Pull-up resistors for pins PTD14 and PTD13 as in the picture below? 

stefanvlad_0-1753776951488.png

Just in case I have attached the s32k311_i2c_async_s32ct.zip that I have tested and it works on my S32K312EVB-Q172.

 

Please test it and send me all details and pictures,

Stefan V.

 

0 Kudos
Reply
697 Views
stefanvlad
NXP Employee
NXP Employee

Hi @beginner100 ,

 

Thank you for using MBDT for S32K3 with the S32K312EVB-Q172 evaluation board,

In the case of the s32k3xx_i2c_async_s32ct example, the table below describes the connections between the I2C instances on S32K312-Q172:

stefanvlad_0-1753361694612.png

But in that help file, there is also a Note below that reads:

  • Note: When running this model on S32K311EVB-Q100S32K312EVB-Q172 or S32K388EVB-Q289, please note that the signal lines used for the I2C transmission require external 2k Ohm pull-up resistors between SDA and VDD and SCL and VDD. For VDD, you can use the pin J40.9 for S32K311EVB-Q100, J39.13 for S32K312EVB-Q172 or J696.14 for S32K388EVB-Q289.

Because the other I2C Instance has pins PTD13, PTD14 with no pull-up resistors, you need to add those, and connect them, one example is in the picture below:

28517079-5330-4964-82fe-1140c4095f20.jpg

I have created a simplified version of the schematic showing only the I2C connections needed with pull-up resistors:

stefanvlad_0-1753365638245.png

 

After you make all the connections , then you can open FreeMASTER and take a look at variables:

stefanvlad_1-1753362044213.png

Both of them will increment accordingly and go up to 256 then roll back to 0.

 

Hope this helps you with the setup,

Best regards,

Stefan V.

 

0 Kudos
Reply
593 Views
beginner100
Contributor II
Thank you for the input, @stefanvlad.

I did make changes as suggested, on FreeMASTER i only see Slave_send as 0 and master_recv as 255. I do not see any ramp up or incrementing of values. Are there any other set of pins that can be chosen as the slave I2C Instance instead of PTD13, PTD14?
0 Kudos
Reply