I2C through FlexIO doesn't work right

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

I2C through FlexIO doesn't work right

跳至解决方案
2,310 次查看
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.

标签 (1)
1 解答
1,962 次查看
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

在原帖中查看解决方案

4 回复数
1,962 次查看
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 项奖励
回复
1,962 次查看
freddy_ben-zeev
Contributor IV

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

0 项奖励
回复
1,963 次查看
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,962 次查看
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 项奖励
回复