S32K144 I2C (POLLING METHOD)

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

S32K144 I2C (POLLING METHOD)

4,351 Views
raviranjankumar
Contributor III

Hi, 

   I am working on S32K144 I2C. I want to use it in polling method. I tried but I am unable to get correct data. I am communicating with an external EEPROM. Please help, if it will be through an example code, it will be better for me.

Thanks & Regards,

Ravi Ranjan

0 Kudos
Reply
7 Replies

3,270 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi Ravi,

Have you tried a SDK example code?

Regards,

Daniel

0 Kudos
Reply

3,270 Views
raviranjankumar
Contributor III

Hi Daniel,

       I tried with example code which is given in S32K Design Studio. It is working but It is in interrupt method I want to use in polling method.

Regards,

Ravi Ranjan

0 Kudos
Reply

2,627 Views
Joao_Roscoe
Contributor III

Curious,

I am looking for exactly that: an IRQ based I2C exemple, and I could find only a blocking exemple within SDK package (I'm using regular interface, not PAL, and S32SDK V.3.4.1).

Any pointers? Thank you in advance.

0 Kudos
Reply

3,270 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

You may check the attached code.

It's a very simple example which shows the configuration and some communication.

It uses interrupts to handle errors. It might help.

Regards,

Daniel

0 Kudos
Reply

3,270 Views
sureshjayagonda
Contributor II

Hi Daniel,

I am trying to use example code you provided in above reply. I am always in "LPI2C0_Master_IRQHandler" method and value of MSR is 0x2002001. I am not understanding why i am not able to read data.

My main file has just below instructions from your example file

run_mode_48Mhz();
SIRC_div_8MHz();
init_port();
I2C_init_clock();
LPI2C0_init();
LPI2C0_IRQs_init();
err = I2C_read_reg(SLAVE_ADDRESS, 0x0C, buffer);

Trying to see if i can read register with address 0x0C into buffer which is just one byte.

Can you please help me understand it. 

I am ok with even interrupt method, can you share similar sample code if you have. I am running it on S32K144EVB-Q100 Evaluation board

0 Kudos
Reply

3,270 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi Suresh,

Since MSR_PLTF flag is set, the slave is probably keeping SCL or SDA low for more than PINLOW cycles.

Have you tried monitoring the bus with a logic analyzer?

Please note that the I2C_read_reg function takes the read address of the slave as parameter.

We don't have any other example except for the SDK examples in S32DS.

Regards,

Daniel

0 Kudos
Reply

3,270 Views
raviranjankumar
Contributor III

Hi Daniel,

         Thank you so much for your support. It was really very helpful for me.

Regards,

Ravi Ranjan.

0 Kudos
Reply