S32K344 I2C driver issue

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

S32K344 I2C driver issue

3,835 Views
kRekha
Contributor II

Hi ,

i am working on S32K344 board. i am trying to run Example code given for I2C

[example code: I2c_S32K344_HLD_DS]

as soon as master is enabled , Bus Busy Flag is set to 1 by driver. due to which master is always in Idle state waiting for BBF to clear. but BBF never gets cleared. master transactions are not started. 

master enable happens inside this function - LpI2c_Ip_MasterSetBaudRateInit() .

tried with both pull up and down set. but no luck.

kRekha_0-1621837983256.png

 

i don't have oscilloscope, somehow i am unable to confirm if SCLK is available or not.

Please let me know if i have to take care of any extra configurations.

 

Thanks,

Rekha

Tags (2)
0 Kudos
Reply
10 Replies

3,222 Views
zhiguoguo
Contributor I

I have the same question with you. Have you solved the problem now? 

zgguo@iflytek.com
0 Kudos
Reply

3,814 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @kRekha,

According to the RM, "whenever the LPI2C is enabled, it monitors the I2C bus to detect when the I2C bus is idle (MSR[BBF]). The I2C bus is no longer considered idle if either SCL or SDA are low ..."

The bus (SDA & SCL) must read HIGH.

The example does not use the internal pull-ups on the pins.

You said you enabled it, but is it really pulled up?

Do you have a volt-meter at least?

Or you can disable the internal pull-ups and use external ones.

It is really necessary to make sure the bus is pulled up.

 

Thanks,

BR, Daniel

 

0 Kudos
Reply

3,809 Views
kRekha
Contributor II

@danielmartynek  thank you for your response.

We have external pull ups for I2C lines. So I have disabled internal pull up later on..

I have multimeter. Should I need to check voltage at I2C pins?

Also, is it valid to consider BBF to be in busy state, if we are receiving timeout during block transfer?

 

Transactions never started, inside block transfer control is waiting for particular timeout and timeout happens every time.. I have set timeout to maximum for testing purpose.. even then we are receiving timeout condition..

Does this means slave is not responding?

I am providing 7 bit adress as input 

 

 

Thanks,

Rekha

0 Kudos
Reply

3,792 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @kRekha,

You can try with the multimeter just to see if the I2C lines are really pulled up.

I would recommend using an oscilloscope or an logic analyzer though.

Can you find which operation within the transfer returns TIMEOUT status?

Do you have NXP EVB or your own board?

Have you modified the example?

 

Thanks,

Daniel

 

0 Kudos
Reply

3,788 Views
kRekha
Contributor II

Hi Daniel,

I have NXP s32k344 integrated to my board. Not the EVB.

very first issue what I observe is : I2C Bus Busy flag is set as soon as master is enabled during I2C initialization(In baudrate init function). I am not understanding why is the bus busy flag set during initialization and it never gets cleared.

This results in Timeout .

So if we resolve bus busy issue then timeout issue will get resolved.

Can you please direct me to the solution side. 

Thanks,

Rekha

0 Kudos
Reply

3,768 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi Rekha,

The BBF operation is specified in the RM.

"Whenever the LPI2C is enabled, it monitors the I2C bus to detect when the I2C bus is idle (MSR[BBF]). The I2C bus is no longer considered idle if either SCL or SDA are low ..."

If you see both lines HIGH with the multimeter before the LPI2C module is enabled, then I guess the ports are not correctly muxed to the LPI2C module.

Can you check the Multiplexed Signal Configuration Registers (MSCR) just before the LPI2C module get enabled?

 

Regards,

Daniel

0 Kudos
Reply

3,739 Views
kRekha
Contributor II

Hi Daniel,

Both lines are showing 0volts before I2C module is enabled. even after i2c Init these lines voltage level is 0V.

i have configured PTC8, PTC9 for I2C0. before i2C init is done we are initializing the port pins , hence MSCR{72] memory block - 0x40290360 shows value 1, MSCR[73],  mem block - 0x40290364 is also 1. below are the configurations done on my target.

0000_0001LPI2C0_SCLLPI2C0LPI2C Clock I/OO
0000_0001LPI2C0_SDALPI2C0LPI2C Data I/OO

 

Thanks,

Rekha

 

0 Kudos
Reply

3,734 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi Rekha,

The I2C lines must not read 0V before the I2C module is enabled.

You said you had external pullups on the lines.

Please double check that and make sure the lines read HIGH before the module is enabled.

 

Thank you,

BR, Daniel

0 Kudos
Reply

2,512 Views
kprzygoda
Contributor I

Dear All,

 

I have similar problem with s32k358 custom board and lpi2c0 channel driver. I have external pullups and whenever MCR->DEBUG bit is not enable the transmisstion even not start. If the MCR->DEBUG pin is enabled the master start sending start condition (see attachment) but then afterwards it is comming back to idle state. I have debugged this inside the code and there is an error event check and sometimes bus arbitration lost error event is called, sometimes fifo tx error event or both one by one. I was trying the same pins as flexio flexio_i2c and all is working fine. Master is sending correct datas. I have also tried to toggle those pins as simple dio and also working fine. What is the problem with lpi2c driver then there?

0 Kudos
Reply

2,413 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @kprzygoda,

Can you post it in a new thread?

 

Thanks,

Daniel

0 Kudos
Reply