i2C issue on MKE17Z

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

i2C issue on MKE17Z

1,035 次查看
afcec
Contributor I

Hi, I have two devices communicating via i2C. Both of them are based on MKE17Z MCUs and I am using SDK version 2.12 and fsl_lpi2c. 

I used lpi2c_transfer as a reference for my development and the data exchange is correct, but my master device is resetting randomly after several seconds.When I check the reset reason I can see a kRCM_SourceLockup but I am stuck there as I do not know where this reset comes from...

I have been reading many different posts on i2C communication with NXP and trying several things, but so far, I have not found a solution...

Could you please shed some light in this?

0 项奖励
回复
5 回复数

1,004 次查看
afcec
Contributor I

Hello Pavel and thanks for your help. Let me try to explain a little bit better my scenario:

1. I am communicating via i2C two custom boards, both of them integrating MKE17Z

2. The behaviour is the same with and without a debug session

3. The master calls LPI2C_MasterTransferNonBlocking every 20 ms, alternating kLPI2C_Write and kLPI2C_Read operations 

4. Format and length of the messages sent by each of the devices is always the same

5. Everything seems to be working fine but after several seconds (10,20, 30...) the master board resets and the reset reason reported is kRCM_SourceLockup

6. If I disable read transactions in the master, there are no resets. However, if I enable read and disable write transactions, the resets are there again.

7. I am using IEC 60730 Class B safety library in my project, which is in fact the base pillar of our code

If you need anything else, just ask. Thanks again! 

0 项奖励
回复

996 次查看
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

Hello, could you tell me what example you are based on? and I have a doubt, are the messages is sending and received right in those 20ms? I suggest reducing the charge of the bus.

Best regards,
Pavel

0 项奖励
回复

973 次查看
afcec
Contributor I

Hi, I used interrupt_b2b_transfer from lpi2c driver examples (SDK FRDM-KE17 2.12) for both, slave and master although customised for my needs:

  • I call LPI2C_MasterTransferNonBlocking for read/write transactions every 20 ms (read, write, read, write...) using an ISR timer interrupt function (1ms)
  • I use a flag as in the example, to control whether previous transfer completed or not before starting a new transaction. If the callback has not been called (nor success neither nack) I just skip next transfer. There is no while loop as in your example.
  • The messages exchanged between master and slave have a length of 12 and 10 bytes so I guess there should be no problem with sending and receiving in 20 ms, am I right? However, I have tried changing to 40 or 80 ms with the same results.
  • There is another change I forgot to mention: I am not using subaddress, so I am just setting masterXfer.subaddress=0 and masterXfer.subaddressSize = 0 when calling LPI2C_MasterTransferNonBlocking. 
0 项奖励
回复

896 次查看
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

Hello, thanks for your information I´m afraid is not enough, could you attach an image from a sniffer of your communication? I want to review if the I2C receiver device has not halted the bus.

Best regards,
Pavel

0 项奖励
回复

1,015 次查看
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

Hello, my name is Pavel, and I will be supporting your case, I need more details about the behavior, only to understand when you say reset randomly is the board powered off on process? Do you have a FRDM board, or it is a custom board? I have the idea you are in a debug session because you notice that kRCM_SourceLockup, if you test it without a debug session is the behavior the same? 

Best regards,
Pavel

0 项奖励
回复