i2c data not transmitting properly on s32k144

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

i2c data not transmitting properly on s32k144

Jump to solution
694 Views
bhanu_p
Contributor I

Hi,
Im using s32k144 EVB  for i2c implementation. when i try to verify the data which im sending through the controller  using logic analyzer im not getting the proper data through SDA line .
im using PA2 and PA3 for SCL & SDA im attaching my code and snap shot of the SCL & SDA signals  please look into it and let mw know where i have did wrong.

#include "Cpu.h"

  volatile int exit_code = 0;
const uint8_t txbuff[8]={0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18};
  lpi2c_master_state_t lpi2c1MasterState;

const lpi2c_master_user_config_t lpi2c1_MasterConfig0 = {
  .slaveAddress = 60U,
  .is10bitAddr = false,
  .operatingMode = LPI2C_STANDARD_MODE,
  .baudRate = 0,
  .transferType = LPI2C_USING_INTERRUPTS,
  .dmaChannel = 0U,
  .masterCallback = NULL,
  .callbackParam = NULL,
};

int main(void)
{
/* Write your local variable definition here */

/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
#ifdef PEX_RTOS_INIT
PEX_RTOS_INIT(); /* Initialization of the selected RTOS. Macro is defined by the RTOS component. */
#endif
/*** End of Processor Expert internal initialization. ***/

/* Write your code here */
CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT,g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
LPI2C_DRV_MasterInit(INST_LPI2C1, &lpi2c1_MasterConfig0,&lpi2c1MasterState);
for(uint8_t data=0x00;data<0xFF;data++)
{
LPI2C_DRV_MasterSendDataBlocking(INST_LPI2C1,txbuff,sizeof(txbuff),1,1000);
}
}

bhanu_p_0-1725273184437.png

 

0 Kudos
Reply
1 Solution
466 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@bhanu_p

Also please try set the slave address to 0x3C and try again.

View solution in original post

0 Kudos
Reply
13 Replies
492 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@bhanu_p

There is no problem with your code. The reason for these phenomena is that your slave device does not respond.

This may be because your slave device does not work properly, or the timing of the transmission is incorrect, or the address sent is incorrect.

I don't have "GME12864-49 0.96" display, and this is beyond our support range.

0 Kudos
Reply
484 Views
bhanu_p
Contributor I

Hi @Senlent 

same display i have used with stm32f407 evb board with 100khz clock  and 0x78 is slave id  and its working fine and i can see the display data which i'm writing data,

the problem i'm facing with only nxps32144 evb board only

0 Kudos
Reply
467 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@bhanu_p

Also please try set the slave address to 0x3C and try again.

0 Kudos
Reply
463 Views
bhanu_p
Contributor I

Hi @Senlent ,

i have observed 2 things when i use 0x78 as slave id in stm32 its working and when i observed the logic analyzer signals slave id is converted to 0x3C(0x78>>1)  based on this i have changed my slave id 0x78 to 0x3C in NXPs32   then its working fine now.

Thanks.

0 Kudos
Reply
476 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@bhanu_p

Then please provide me with the results of the logic analysis sampling, and I can help you compare whether the data sent by S32K144EVB is consistent with the data implemented by STM32

0 Kudos
Reply
634 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@bhanu_p

There should be no problem with the code. Try it again by connecting a slave device.
Below is the result of my test using S32K144EVB

Senlent_0-1725425449357.png

 

0 Kudos
Reply
570 Views
bhanu_p
Contributor I

Hi @Senlent ,

i have connected my slave and verified but still I'm not getting proper output.

while im checking my slave id is correct or not. im getting "STATUS_TIMEOUT" status.

int main(void)
{
    CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT,
                   g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
    CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);

    PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
    for(uint8_t data=0;data<255;data++)
    {
    	int ret;
    	  const lpi2c_master_user_config_t lpi2c1_MasterConfig0 = {
    	    .slaveAddress = data,
    	    .is10bitAddr = false,
    	    .operatingMode = LPI2C_STANDARD_MODE,
    	    .baudRate = 1000000U,
    	    .transferType = LPI2C_USING_INTERRUPTS,
    	    .dmaChannel = 0U,
    	    .masterCallback = NULL,
    	    .callbackParam = NULL,
    	  };
    	LPI2C_DRV_MasterInit(INST_LPI2C1,&lpi2c1_MasterConfig0,&lpi2c1MasterState);
     ret=LPI2C_DRV_MasterSendDataBlocking(INST_LPI2C1,txbuff,sizeof(txbuff),1,1000);

      if(ret == STATUS_SUCCESS)
      {
    	  break;
      }
    }
  for(;;) {
    if(exit_code != 0) {
      break;
    }
  }
  return exit_code;
}

 please let me know what i have missed to in this code

im trying to implement GME12864-49 0.96" display, if possible please share any i2c_exmaple it would help me out to solve this issue

0 Kudos
Reply
566 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@bhanu_p

" if possible please share any i2c_exmaple it would help me out to solve this issue"

Actually, you can find below example in S32 DS, and the test result i have already send to you before.

Senlent_0-1725864582149.png

Senlent_1-1725864648158.png

 

0 Kudos
Reply
549 Views
bhanu_p
Contributor I

hi @Senlent ,

i have tried the example which you have mention in previous post but still my signals are not coming properly please look into it.

Screenshot 2024-09-09 125830.png

0 Kudos
Reply
543 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@bhanu_p

I have given a screenshot of the test results, so there is no problem with this routine. Have you used two S32K144EVBs to test this routine?
Try to find your hardware problems, whether the connection is correct, whether the power supply is normal, whether the external pull-up is performed, etc.

0 Kudos
Reply
528 Views
bhanu_p
Contributor I

Hi @Senlent ,

while working i have observed  two things when i use ".baudRate = 10000U,"  im getting response as below  means my slave id is coming properly but after that the TXbuffer data  no reflecting and clock is also generating properly but when i use  ".baudRate = 100000U,"  or above im not getting properly signals also below are the 2 different signals.

my slave id is 0x78  data which im sending is 

uint8_t data[2];
data[0] = 0x00; // Co=1, D/C#=0 (Command)
data[1] = cmd; // Command to send (0xAE/0xDF/...............)
LPI2C_DRV_MasterSendDataBlocking(INST_LPI2C1, data, 2, true, OSIF_WAIT_FOREVER);

baudrate  with 10000U(10khz)

bhanu_p_0-1725958275675.png

baudrate with 100000(100khz)

bhanu_p_1-1725958355100.png

 

 

0 Kudos
Reply
655 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@bhanu_p

Please set a larger timeout value and then try again.

For example, modificate timeout value to "0x00ff_ffff" or more larger

LPI2C_DRV_MasterSendDataBlocking(INST_LPI2C1,txbuff,sizeof(txbuff),1,1000);

 

0 Kudos
Reply
638 Views
bhanu_p
Contributor I

Hi @Senlent ,

 

i have alredy given the large timeout  still im getting the same response im not getting the data buffer which i have given  im only getting the slave id 0x3c  as output.

for example i have given timeout "1000" & "5000" still same nothing has been changed. please look in to the code i have share  and let me know if any ting wrong 

0 Kudos
Reply