I2C_RTOS_Transfer() does not report I2C NAK result

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

I2C_RTOS_Transfer() does not report I2C NAK result

1,791 次查看
davepfaltzgraff
Senior Contributor I

I am expanding a program that uses the I2C bus fairly heavily. In adding some new devices, I discovered that I had specified and incorrect address. In debugging it, I found that the I2C_Transfer() routine in FreeRTOS does not return any information indicating an error. The return value was merely 0.

 

The only clue that I had that something was wrong was that a read transfer did not change the value in memeory before the call.

 

Since failures of the bus are important in this case, how can the program determine that something went wrong on the bus?

标签 (1)
0 项奖励
回复
3 回复数

1,463 次查看
ryanbryngelson
Contributor I

xiangjun, David,

I've also ran into this issue.  I posted a similar question and solution before I came across this post.

Ryan

0 项奖励
回复

1,463 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, David,

Can you tell us the part number you are using, where the IIC example is in SDK, the version of SDK, whether the IIC module is set up in slave mode or master mode?

Thank you

BR

Xiangjun Rong

0 项奖励
回复

1,463 次查看
davepfaltzgraff
Senior Contributor I

I am running this on a FRDM-K22F board wired as per the readme.txt file found under:

C:\KSDK2\boards\frdmk22f\rtos_examples\freertos_i2c

With the wires connected as described it works. Remove either of the wires causing the I2C bus to fail and rather than reporting a failure, bogus values (0x00 or 0xFF) are reported.

I my situation, I was bringing up new hardware on my design. I knew the bus worked as I had several devices already operational. I was adding a new device and just happened to use the wrong address. That was when I found out that I didn't get an error code indicating a NAK condition as I had expected.

0 项奖励
回复