psoc4/IIC data error

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

cross mob
Leo_liu1
Level 4
Level 4
50 replies posted 25 replies posted 10 replies posted

Hi all,


When I use iic to make psoc4(slave) communicate with main chip(stm32f072)main chip receive iic buffer from psoc4

When I touch button(such as 7),received data is rightbut when I release my finger the received data (version number is 2 but received 1 ) is wrong

Could you please  give me some suggestionthanks

My iic buffer received data as below

pastedImage_0.pngpastedImage_1.pngpastedImage_2.png

0 Likes
1 Solution
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi,

If sleep mode is the issue, then you can send dummy bytes to the slave and wake up the device and send a read command only when the device is awake, ie the slave has acked your last transaction. Try this and post your results.

Regards,

Bragadeesh

Regards,
Bragadeesh

View solution in original post

0 Likes
11 Replies
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi,

Could you please let me know what data you are trying to read from the PSoC device?

Is it possible for you to share your project file focusing on the issue?

Regards,

Bragadeesh

Regards,
Bragadeesh
0 Likes
lock attach
Attachments are accessible only for community members.

Hi Bragadeesh,

As you can see in this project attached,3 bytes of iic buffer are the data that master want to read.

pastedImage_1.png

Thank you for your focus.

Best regards,

Leo

0 Likes
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi Leo,

I ran your code in our PSoC 4000 kit and the code is working as expected. I used the BCP as the master to read the I2C buffer and below is the screenshot from BCP

pastedImage_0.png

Could you please give me more information on when you see this happening so that I will try to reproduce it from my side.

Also, there is no assignment to MyI2C_Regs.Version=0x01 in your code. Just check if you have written 1 to this version element in the buffer from the master by mistake.

Let me know the master command you are using to read from our slave.

Regards,

Bragadeesh

Regards,
Bragadeesh
0 Likes

Hi Bragadeesh,

I used the BCP as the master to read the I2C buffer ,the data aslo is right.

But the main chip(stm32f072) as the master to read the I2C buffer,There are two kinds of outcomes:

1.When I touch button,received data is right;

2.When I release my finger ,the received data version in most cases is 2,sometimes is 1。

In my code,i have not written 1 to this version element .

My i2c read command is standard i2c read functions.

pastedImage_3.png

I guess if low power mode cause it?When I read i2c data, do I need to wake up the chip by reading it empty twice?

Best Regards,

Leo

0 Likes
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi Leo,

Can you please send scope shots of the bus so that we can find out what's actually happening in the transactions?

Regards

Bragadeesh

Regards,
Bragadeesh
0 Likes

Hi,

The sensor status will be 1 only if the Difference Count is greater than Finger Threshold + Hysteresis. What is the hysteresis parameter you have set?

What is the proximity distance you're expecting? Place your hand at the distance you are expecting and make sure you get the difference count of at least 50 ( and SNR of 5:1). Now set your thresholds as given in the table below:

pastedImage_0.png

Regards,
Bragadeesh

Regards,
Bragadeesh
0 Likes
lock attach
Attachments are accessible only for community members.

Hi Bragadeesh,

Scope shots attached,Please help to analyze them。

Thanks,

Leo !

0 Likes
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi Leo,

Upon analyzing your waveform I can find the following:

1. In the no touch image, I find that the slave has nacked the data byte which might be due to the device waking up from deep sleep.

2. Also the next byte sent by the slave (Version - 0x02) is right. Please check that in your no touch image. So this is not the issue with the PSoC slave. It might be due to the master sampling this data at the wrong places. Maybe this is due to the high data rate. Can you make your data rate as low as possible (say 50) and check if you see this issue

3. Also you mentioned you see this issue rarely and not often, then increase your data rate as high as possible and let me know if you see this issue more often than before.

4. Could you please let me know the rise time, fall time , data hold time, low period of SCL Clock and high period of SCL clock

Regards,

Bragadeesh

Regards,
Bragadeesh
0 Likes

Hi Bragadeesh,

I'm sorry to reply you so late,because I have been busy recently。

When I deleted sleep mode,the version number from I2C buffer is always right。

But I need sleep mode,so what can I do for it?

0 Likes
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi,

If sleep mode is the issue, then you can send dummy bytes to the slave and wake up the device and send a read command only when the device is awake, ie the slave has acked your last transaction. Try this and post your results.

Regards,

Bragadeesh

Regards,
Bragadeesh
0 Likes

Hi Bragadeesh ,

Also,when I use debug mode in psoc creator ide,I set a breakpoint as below.

pastedImage_0.png

The program can still go here without fingers close to.

But I have debug to the appropriate sensitivity in tuner mode.

pastedImage_3.png

I have a question :The Proximity threshold is set to 90,but status is still not 1 when my finger close to it,only touch it the status is 1.

So how to judge validity of approaching.

Thanks,

Leo

0 Likes