Urgent Help about I2C communication

Discussion of the PSoC Designer integrated development environment for PSoC1 devices.

Moderators: ericb, dcooper, jonp, dpfunston

Urgent Help about I2C communication

Postby cJo » Mon Jun 10, 2013 11:39 am

Hi

I am using a master and a slave (CYC824123) in my project. Master writes data to the slave and read back from the slave. While master is trying to write to the slave, i observe it on ossiloscop and i see that 8 clock cycles (7 bit slave adress + R/W bit) occurs instead of 9 clock cycles (7 bit slave adress + R/W bit + ACK/NACK bit). So i can not see 9th clock cycle, so ACK/NACK bit neither, and communication doesnt happen.

WHO CAN HELP ME? I have to solve this problem as soon as possible.

Thank you
cJo
Newbie
Newbie
 
Posts: 7
Joined: Tue Apr 30, 2013 1:46 pm

Re: Urgent Help about I2C communication

Postby bobmarlowe » Mon Jun 10, 2013 1:20 pm

Is it possible for you to post both master and slave complete projects here so that we all can have a look at? To do so use the function "Archive Project" of Designer and upload the resulting files here.

Bob
User avatar
bobmarlowe
The Big Cheese
The Big Cheese
 
Posts: 1490
Joined: Thu Oct 06, 2011 2:03 am
Location: Germany

Re: Urgent Help about I2C communication

Postby cJo » Mon Jun 10, 2013 1:51 pm

Here is the complete projects of master and slave. Master should send data to slave and read data from the slave.

PD1Project is for master.
Slave is for slave.

Waiting for the response as soon as possible.
Attachments
Project.zip
(690.59 KiB) Downloaded 105 times
cJo
Newbie
Newbie
 
Posts: 7
Joined: Tue Apr 30, 2013 1:46 pm

Re: Urgent Help about I2C communication

Postby danadak » Mon Jun 10, 2013 4:42 pm

You should update Designer to 5.4.

I see in Global Resources your CPU clck set to 3 Mhz, SysClk/8, it should be
SysClk/1 for 50K speed. Per datasheet -

I2C_Clock
Specifies the desired clock speed at which to run the I2C interface. There are three possible clock rates available:



50K Standard
100K Standard
400K Fast
Note:
The I2C clock is based off a SysClk of 24 MHz. If SysClk is less than 24 MHz the I2C clocks will scale down. For example, if SysClk is 6 MHz the possible clock speeds are 12.5K, 25K, and 100K. SysClk is separate from the CPU clock.


Regards, Dana.
Field Application Engineer
KB1RHB Mostly listen :)
Semi Retired
User avatar
danadak
The Big Cheese
The Big Cheese
 
Posts: 2008
Joined: Thu Dec 27, 2007 8:42 am
Location: New Hampshire

Re: Urgent Help about I2C communication

Postby cJo » Sat Jun 15, 2013 7:49 pm

Hi

I used SysClck/1 for 400k speed. However nothing has changed. You can check the ossiloscop pics are in the attachements.

"With_Sensor" is the picture shows SDA (blue) and SCL (yellow) on the ossiloscop when slave is connected to master. [There is only 8 clock cylcles]

"Without_Sensor" is the picture shows SDA (blue) and SCL (yellow) on the ossiloscop when slave is not connected to master. [There is 9 clock cycles but no data bits]

So what is still problem?
Attachments
Without_Sensor.JPG
With_Sensor.JPG
cJo
Newbie
Newbie
 
Posts: 7
Joined: Tue Apr 30, 2013 1:46 pm

Re: Urgent Help about I2C communication

Postby bobmarlowe » Sun Jun 16, 2013 1:18 am

The only answer coming to my mind is "Clock stretching" which is performed by the slave to get some time to perform its job. Can you please reduce the resolution of the time-axis to see if the clock goes high again after some more time.

Also I would recommend to reduce the frequency to 100k during the test - phase and increase it later on.

Bob
User avatar
bobmarlowe
The Big Cheese
The Big Cheese
 
Posts: 1490
Joined: Thu Oct 06, 2011 2:03 am
Location: Germany

Re: Urgent Help about I2C communication

Postby cJo » Sun Jun 16, 2013 2:33 pm

Hi

The problem was that i had chosen I2C Communication service type as "poll" on the I2C Slave parametres. I ve chosen it as "interrupt" and I finally fixed the problem.

So, I obtain this picture. I also used SysClck/1 for 400k I2C speed.

How do you interpret about clock streching in this picture? Is it good communication or not?
Attachments
I2C.JPG
cJo
Newbie
Newbie
 
Posts: 7
Joined: Tue Apr 30, 2013 1:46 pm

Re: Urgent Help about I2C communication

Postby bobmarlowe » Sun Jun 16, 2013 11:44 pm

There IS clock stretching from slave side and so far everything looks ok.
I do not like those guys making ads here, but I had some I2C problems as well and by accident I stumbled over a VERY helpful device. It is a logic analyzer that is able to interpret some protocolls and I2C is one of them. So you can see all ACKs NAKs and databytes transferred. The manufacturer resides in France, but there might be comparable devices on the market in your area. have a look at http://www.ikalogic.com/ even the smallest and cheapest device will work (I started with that one) and it really saved me hours.


Bob
User avatar
bobmarlowe
The Big Cheese
The Big Cheese
 
Posts: 1490
Joined: Thu Oct 06, 2011 2:03 am
Location: Germany


Return to “%s” PSoC Designer (PSoC1 IDE)

Who is online

Users browsing this forum: No registered users and 1 guest

cron