XMC 2Go

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
User13817
Level 3
Level 3
Hello,

I've been trying to use an I2C sensor on XMC 2Go board but I'm having difficult to do it. It stucks on a while that means nothing happened (no end of transmission, receive, nack or some error).
2807.attach

The I2C App is configured as the following (I'm using DAVE 4):
2809.attach
2808.attach

The main code can be seen below:


Does anybody have idea of what's happening?
Thanks in advance,
Best regards.
0 Likes
3 Replies
lock attach
Attachments are accessible only for community members.
User13817
Level 3
Level 3
Heres the full project that I've been developing and trying to run.
The I2C pins doesn't even change the level. I had sucess coding it into DAVE 3, but I can't do it on DAVE 4.
0 Likes
User13817
Level 3
Level 3
I'm pretty sure that I have discovered the problem but I still don't know how to solve it.

I was checking with an oscilloscope and noticed that the I2C stop working when it receives a Nack. The fact is when it receives a nack or some error it does nothing, but it should call the respective handler configured on the App.
I also checked on debug and the I2C handlers were configured.

2812.attach

If i don't received a nack or some error the I2C works, at the moment it receives a nack or an error I2C get stucked in a infinite loop.
0 Likes
User13817
Level 3
Level 3
Hello guys,

I deleted the all project and created again and I2C now is kind of "working". I noticed a bug that it is necessary to force a re-initialization everytime that a communication is necessary as shown in the picture:

2814.attach

That's bad because it tooks arround 9ms to init the peripheral, so it's a big waste of processing time. Since the code is to read a sensor periodically, it means that the uc loose 9ms everytime that it needs to read data, which means a maximum reading frequency of 110Hz (if it's only reading and don't doing anything else).

I hope I can get some help from Infineon team because it seems to be a bug on DAvE 4 (since on DAvE 3 works well). I also read all the I2C documentation and examples and didn't find the answer of this problem.
0 Likes