SPI_Design01 Example hangs on while loop

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.
JeCo_264681
Level 5
Level 5
100 replies posted 50 replies posted 25 replies posted

I am using a CY8CKIT-050 PSoC5 with PSoC Creator 4.0 Update 1. I downloaded the example design SPI_Design01. In Device Selector I changed the device from CY8C38 series (PSoC3) to my CY8C5868AXI-LP035 chip.
No output displayed on the LCD.

   

For diagnosis, I added the board's two LEDs to the design. In main.c I turn one LED on just before the while loop and the other LED just after the while loop. The first LED lights but the second does not. This shows that the hang is in the while loop. I temporarily changed the & in the while loop to && and displayed garbage output, of course. With && ANY bit in the Status could satisfy the condition. This shows that SPIS_STS_SPI_DONE bit is never set.
I set a breakpoint at the while loop and stepped through. The last code executed was in SPIS.c lines 416 to 433. Control returned to the while loop.
I have jumper wires connecting:
m_miso to s_miso ( P0[2] to P0[3] )
m_mosi to s_mosi ( P0[0] to P0[1] )
m_sclk to s_sclk ( P0[4] to P0[5] )
m_ss to s_ss  ( P0[6] to P0[7] )

   

Does anyone have suggestions or time to try my build? I have attached the Archive complete file.

0 Likes
7 Replies
lock attach
Attachments are accessible only for community members.
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

I changed your project to use it with a CY8CKIT-059, a PSoC 5888 and it works flawlessly. Some error in your cable setting?

   

 

   

Bob

0 Likes
JeCo_264681
Level 5
Level 5
100 replies posted 50 replies posted 25 replies posted

Thanks, Bob. Very strange. I removed the wires and replaced them with other wires and carefully checked. No change. So I moved the project to the CY8CKIT-059 and I still have the same problem. Very strange. I will try to post a picture of my board with wiring in the morning. I am in -7 Universal Time.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Start with my project and step-by-step replace the internal wires with external pins and cable.

   

 

   

Bob

0 Likes
lock attach
Attachments are accessible only for community members.
JeCo_264681
Level 5
Level 5
100 replies posted 50 replies posted 25 replies posted

I am sure I made some simple dumb mistake I am not seeing. Bob, I took your project and removed each internal wire and replaced each with a I/O pin. Then I added physical wires to the board. I attached a jpg file showing: Photo of my 059 board with the little 0.1" (2.5mm) jumpers on the female headers of P0; Also, the board diagram from the Quick Start Guide; And the cydwr diagram. I used an Ohm meter to check continuity of the pin connections on the bottom of the board. They look good.

   

I added a LED after the while loop but we never arrive there. If I turn on the LED before the while statement, it lights. I have the same problem on the CY8CKIT-050 board so the problem must be in my PSoC Creator configuration. If anyone sees my mistake, please let me know. Otherwise I could open a case with Cypress.

0 Likes
AnkitaS_51
Employee
Employee
100 likes received 50 likes received 25 likes received

I checked your project on PSoC Creator4.0 Update1 on CY8CKIT-050.

   

I only changed the port pin no. of Pin_LED_1 signal according to kit to P6_3.

   

The LED glowed as expected,I then even debugged the code and found everything is working as expected.When i debugged the code removing the sclk connection between master and slave ,the LED is not glowing(LED_write API is placed after the while loop in this case)

   

Thus,this appears as a hardware issue.

0 Likes

Thank you ANKS. Interesting. Two things I will try. When I unlock the SPI pins, Creator likes to place them on banks P3 and P12. I will try to use those pins. Second, I have a second 059 board to try.

0 Likes
JeCo_264681
Level 5
Level 5
100 replies posted 50 replies posted 25 replies posted

I resolved the problem by unlocking the SPI pins from bank P0. I let Creator place them where it liked. It works now. The external wiring is messier but it works.

   

I connected :
m_mosi P3.7 to s_mosi P15.0
m_miso P12.1 to s_miso P12.3
m_sclk P3.5 to s_sclk P12.2
m_ss P15.3 to s_ss P15.1

0 Likes