SWD protocol communication issue

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.
Anonymous
Not applicable

Hello,

We are trying to program a PSOC4 with our chip by using the SWD protocol, similar to this:

http://www.cypress.com/documentation/application-notes/an84858-psoc-4-and-psoc-analog-coprocessor-pr...

We are reusing the same code as AN84858.zip . We just modified the gpio related code as per our environment.

We are getting a wrong acknowledgement 0x7 from the PSOC. Attached is the waveform of the start condition. Can you please let us know what is wrong ?

Thanks,

Chaitanya

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

Which Host programmer do you have?

You need to modify the values of the timeout parameters defined in the Timeout.h file according to the host programmer used as mentioned at page#10 of the AN84858

0 Likes
Anonymous
Not applicable

Hi anks,

Thanks for your answer. We are using an external micro-controller( its actually a SOM from some other vendor) to program the PSOC4. The other micro controller is interfaced to PSOC4 and wants to program the PSOC4.

I referred page 10. Can you elaborate how should I relate the timeout values on that page with the SOM that I have ? Because I see only PSOC chips mentioned there.

Please explain.

Thanks,

Chaitanya

0 Likes

Host programmer can be other than PSoC and that is what mentioned at page#10:

A separate test project, “C_Hssp_TimeoutCalc,” is provided with the application note. This project illustrates the procedure to calculate the timeout parameters for a PSoC 5LP host programmer. Create a similar test project for any other host programmer to calculate those timeout values.

0 Likes
Anonymous
Not applicable

Hi anks,

Thank you anks. I will have a look at this specific test project and get back to you on this.

Thanks,

Chaitanya

0 Likes
Anonymous
Not applicable

hi anks,

During the test also I was getting the wrong acknowledgement 0x7.

Apart from that I obtained the values as per the comments mentioned. The timeouts which we had by default were more than the one's that were calculated. I changed those, but the issue still remains the same. Do we have any specific pin configuration requirements on the data and the clock gpio pins for SWD protocol ?

Thanks,

Chaitanya

0 Likes
Anonymous
Not applicable

From our analysis till now we see that, we are sending 0xA5 but getting a wrong acknowledgement in 0x7 !

0 Likes

What GPIO related code have you changed.Please mention

0 Likes
Anonymous
Not applicable

Hi anks,

We have Linux running on the external controller. The document mentions that you have to change the gpio code as per your host controller software. Therefore we have changed the gpio code similar to this:

Your code:                                                  Linux equivalent

SetSwdioCmosOutput ()                              Code for writing "out" to /sys/class/gpio/<gpio_number>/direction

SetSwdioHiZInput ()                                     Code for writing "in" to  /sys/class/gpio/<gpio_number>/direction

SetSwdckHigh()                                           Code for writing "1" to  /sys/class/gpio/<gpio_number>/value

And so on !!!

Let me know if you want to know more !

Thanks,

Chaitanya

0 Likes

This appears as a issue in conversion of program for Linux running on the external controller.But, presently I am not familiar with Linux based coding, so can't help in that.

For eg: please check the definition of these function SetSwdioCmosOutput ()  & SetSwdckHigh() , they are writing to the bits of register.

0 Likes
Anonymous
Not applicable

Hi anks,

Thanks. Can you tell me the exact reset condition ? That is the pin transitions and timing requirements during reset ?

Thanks,

Chaitanya

0 Likes

Hello,

Please check the Programming Spec given at this link:

http://www.cypress.com/file/409516/download

Please check the topic "Hardware Access Commands" at page#11

0 Likes
Anonymous
Not applicable

Hi Anks,

Thank you for your reply. We have bought the PCOS4 Pioneer dev kit. We want to view the SWD data and clock signals on the devkit. What is the best way to view them ? Do you at Cypress have a code example which will help us in capturing successful SWD communication on the PSOC4 Pioneer dev kit ?

Looing forward for your reply.

Thanks,

Chaitanya

0 Likes

Hello Chaitanya,

I think you need to probe the SWD lines while programming in order to view the SWD data and clock signals.

0 Likes
Anonymous
Not applicable

Hi Anks,

Thanks I did probe the SWD lines.

The chip we are programming is CY8C20496A . Can you confirm that if we sent the command 0xA5 to this controller, we can read the chip id correctly ? Or we have to send something else ?

Thanks,

Chaitanya

0 Likes

Hi Chaitanya,

CY8C20496A is a PSoC1 device as evident from product landing page at this link:

http://www.cypress.com/part/cy8c20496a-24lqxi

And as mentioned in this Programming spec for PSoC1, PSoC1 can be programmed in-system using the in-system serial programming protocol (ISSP):

http://www.cypress.com/documentation/programming-specifications/psoc-1-issp-programming-specificatio...

AN84858 is meant for programming PSoC4 and PSoC Analog Coprocessor, not for PSoC1

0 Likes
Anonymous
Not applicable

Hi Anks,

Thanks for your reply. We sorted out the confusion.

We are also trying to flash the device using I2C using our custom controller as a host.

Currently we are getting a NACK on writes when we try to write a command in CyBtldr_CreateEnterBootLoaderCmd()

Are there any pre conditions required to do this ?

Thanks,
Chaitanya

0 Likes

Hi Chaitanya,

The preconditions are that the connection must be successfully open after g_comm->OpenConnection() call.

Do kindly let me know if you are trying to program PSoC4 using your custom controller. If you can let me know the full part number, it would be better.

Thanks,

Sampath

0 Likes