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
Hi Ravi,
Have you tried a SDK example code?
Regards,
Daniel
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
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.
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
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
Hi Daniel,
Thank you so much for your support. It was really very helpful for me.
Regards,
Ravi Ranjan.