I2C through FlexIO doesn't work right

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

I2C through FlexIO doesn't work right

Jump to solution
2,273 Views
freddy_ben-zeev
Contributor IV

I've configured I2C through FlexIO, connected it to a logic analyzer, and I send slave address plus two bytes. No slave is connected so it always gets NAK. When I use LPI2C it stops after sending the slave address and getting the NAK on it - this correct behavior. When I use the FlexIO - it continues to send the data bytes too (which also get NAK). This is wrong. After getting NAK on the slave address it should not continue.

Labels (1)
1 Solution
1,925 Views
cristianzamfire
NXP Employee
NXP Employee

Hello,

Due to device limitations it is not possible to tell the difference between NACK and receiver overflow (the same flag asserts in both cases). The driver attempts to detect NACK by checking the Tx shifter flag, but this is not a bullet-proof method, any delays in processing the Flexio interrupt can lead to the NACK condition not being recognized. In these cases the driver will consider that there was an overflow and not abort the transfer, because aborting a transfer while there is an active slave on the line can lead to the I2C bus getting stuck. It is safer to let the transfer finish, this will just produce a little delay.

Please check the driver documentation, these limitations are described in the "Important Notes" section.

Best regards,

Cristian

View solution in original post

4 Replies
1,925 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

Unlike LPI2C which sends STOP condition upon NACK (MSR[NDF]), the FlexIO receive shift register will assert an error interrupt if a NACK is detected, but software is responsible for generating the STOP or repeated START condition (52.5.5 I2C Master, S32K1xx RM rev.9).

BR, Daniel

0 Kudos
1,925 Views
freddy_ben-zeev
Contributor IV

When you say "software is responsible" doesn't it mean that the driver should handle it?

0 Kudos
1,926 Views
cristianzamfire
NXP Employee
NXP Employee

Hello,

Due to device limitations it is not possible to tell the difference between NACK and receiver overflow (the same flag asserts in both cases). The driver attempts to detect NACK by checking the Tx shifter flag, but this is not a bullet-proof method, any delays in processing the Flexio interrupt can lead to the NACK condition not being recognized. In these cases the driver will consider that there was an overflow and not abort the transfer, because aborting a transfer while there is an active slave on the line can lead to the I2C bus getting stuck. It is safer to let the transfer finish, this will just produce a little delay.

Please check the driver documentation, these limitations are described in the "Important Notes" section.

Best regards,

Cristian

1,925 Views
freddy_ben-zeev
Contributor IV

Thanks for the detailed explanation! I was suspecting h/w limitations but didn't have time to hunt down the issue when functionality is fine.

0 Kudos