I2C Detecting Idel bus

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

I2C Detecting Idel bus

Jump to solution
949 Views
alex323qp
Contributor III


Hi, I'm working with a KL25Z MCU in an I2C multimaster configuration (yes, it's a nightmare but such is life) and sometimes the bus gets locked up when 2 masters are trying to initiate communication at the same time.

I'm trying to use the SHTF1 bit from the SMB register to determine if the I2C bus is idle but I've got mixed results (sometimes the bit is set sometimes it isn't). I have a custom hardware already produced and cannot use external pins to detect the state of the lines.

Have any of you worked with the SMBus register before? Any advice?

Cheers,

Alex.

0 Kudos
1 Solution
663 Views
Stano
NXP Employee
NXP Employee

Hello Alexander,

I suggest you to check the BUSY flag in Status register right before start of communication. Each master has to check it first and then generate START condition and continue with communication.

I think it will help you to solve your issue.

Best Regards,

Stano.

View solution in original post

2 Replies
664 Views
Stano
NXP Employee
NXP Employee

Hello Alexander,

I suggest you to check the BUSY flag in Status register right before start of communication. Each master has to check it first and then generate START condition and continue with communication.

I think it will help you to solve your issue.

Best Regards,

Stano.

663 Views
alex323qp
Contributor III

Hi Stano,

Thanks for the advice (and sorry for the delay in my response, I just had a chance to test your answer). You are right the BUSY flag is the way to go. My problem was that after detecting the BUSY state I was generating a repeated START condition instead of waiting for the line to be free.

Regards,

Alex.

0 Kudos