Announcements

Robots are revolutionizing our lives in many ways. Join our webinar to learn about Infineon’s broad portfolio of robot building blocks.
Click here to register.

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

PSoC™ 5, 3 & 1 Forum Discussions

user_3716231
Level 4
Level 4
10 sign-ins 5 sign-ins 10 questions asked

Project description:

1.CY8CKIT-059 is Master and ESP8266 mini d1 is Slave.

2.Master communicate with Slave via SPI per 2 seconds and each time the value increases 1.

Question:

I don't know why my slave device always receive "Master : 0".The value doesn't increase in each time.

But when I apply esp8266 as Master instead of CY8CKIT-059 which means both Master and Slave are esp8266,the slave device will receive data and the value will increase in each time.

 

 

0 Likes
6 Replies
Sidramesh
Moderator
Moderator
Moderator
50 replies posted 100 sign-ins 10 solutions authored

Hi @user_3716231 ,

I tried programming with your project. But I can see the value updating in the tera term for data:

Sidramesh_0-1678188346535.png

While sniffing the SPI lines, I could see the string value is increasing every iteration:

Sidramesh_2-1678188861987.png

 

Sidramesh_1-1678188847038.png

So, could you please point out where you are facing the issue of value not incrementing?

Warm regards

Sidramesh

0 Likes

When Master is  CY8CKIT-059  and Slave is ESP8266, the value printed to terminal is from Slave device show below:slave_1.JPG

When Master is  ESP8266 and Slave is also ESP8266, the value printed to terminal is from Slave device show below:slave_2.JPG

logic analyzer for SPI:logic analyzer.JPG

0 Likes

Hello.

ESP8266 code initializes SPI with a certain clock polarity and phase.  And that detail is not provided in the code.

I suspect KIT-059 SPI Master clock polarity and phase is not configured to the same as ESP8266.

Since you have a logic analyzer, capture the SPI transfer with ESP8266 Master and then capture the KIT-059 Master SPI transfer.  Now, compare the clock polarity and phase in these captures.  When you configure KIT-059 SPI Master component, make this clock match the ESP8622 Master clock polarity and phase.

Since there are only 4 combinations of SPI clock polarity and phase, you could just try each one until it works.

Also, ESP8266 is not 5V tolerant.  Do not connect KIT-059 with 5V to ESP8266 directly unless you have a logic level voltage translator chip in between them.  Or, you could also use the KIT-059 SIO pins when programed for 3.3V even when the rest of KIT-059 is powered from 5V.  You can refer to this link for a solution using SIO by user LEN:
Solved: CY8C5888LTI-LP097 with lmx2592 - Infineon Developer Community

 

0 Likes

I tried all SPI mode and also tried to change shift direction with each mode and applied a level shifter between CY8CKIT-059 and ESP8266, all of the results are not what I expected.

0 Likes

@BiBi_1928986 and @user_3716231 

Besides the 4 combinations of clock phase and polarity there is also MSB or LSB first.

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

I  tried it, but the results still had no changes.

0 Likes
This widget could not be displayed.