You are here

Real Time Trace: SWV(Serial wire viewer) in PSoC3 | Cypress Semiconductor

Real Time Trace: SWV(Serial wire viewer) in PSoC3

Summary: 6 Replies, Latest post by CypressFan on 08 May 2015 10:45 PM PDT
Verified Answers: 0
Last post
Log in to post new comments.
KeerthiRocks's picture
Cypress Employee
77 posts


To start with SWV in PSoC3/5LP :-

Serial Wire Viewer (SWV):  Single Wire Viewer (SWV) interface, is used for program and data monitoring, where the firmware may output data in a method similar to “printf” debugging on PCs, using a single pin (P1[3]/SWO). MiniProg3 supports monitoring of PSoC 3 and PSoC 5LP firmware, using SWV, through the 10-pin connector (or SW0 and ground) and in conjunction with SWD only.


It is a run time debugger. You can print the values of the variables in run time like “printf” statement.

SWV Data trace is available via the SWO pin in two output formats:

  • UART style (1Mb/s) – Advantage is no need of RS232 connector and not using PSoC’s UART block. In a big project, where UART is needed and still needs to know the values of variables, SWV is the best approach.

  • Manchester Encoded (100Mb/s) – You can use this if high data rate is required.


How to use this application:

The attachment contains a project and application for SWV interface. Program the PSoC with this project. Then connect SWO pin /P1[3] and ground pin of PSoC to corresponding pins in MiniProg3 or connect MiniProg to PSoC via 10 pin connector(JTAG cable).

Pre Requisites:

1.      PSoC creator

2.      PSoC programmer 3.18.1

If you are using any other version of PSoC Programmer, then copy the PP_Com_Wrapper.dll from the installed location and paste where the application is present.

Open the application “MiniProg3_SWV” in the attached document.

Select the protocol that you have selected in the firmware. And start the operation.

 If the selected data is 1 byte and data is i=0,i++, then 01 00 01 01 01 02 01 03.. Here indicates the size of the received data and 07, 08.. indicates the data that has been sent.

Similarly, if  the selected data size is 2 bytes, then the received data will look like 02 01 00 02 02 00.. Here 02 is data size and 0001 is data ( LSB then MSB) .

Similarly, if the selected data size is 4 bytes, then the received data will look like 03 01 00 00 00 03 02 00 00 00.. Here 03 is data size and 00000001 is data ( LSB then MSB) .

Hence you can place this piece of code in any of your project and can monitor the variables.

We have tested this only in PSoC3.


Thank You,



KeerthiRocks's picture
Cypress Employee
77 posts


Ment to say, if the data is i=0 and i++ and i is 1 byte of data, the output would look like 01 00 01 01 01 02 01 03 01 04 ... if it is a infinite loop. Here 01 is size of data since it is 1 byte and 01, 02 ,03 ,04.. which are present alternatively are actual data.

Thank You,

user_460349's picture
1362 posts

Good stuff. Need something like this to debug some communication issues. Shall try it today :-)

user_11721473's picture
48 posts


MiniProg3_SWV.exe does not run under Windows 7 x64.

Any ideas?

kly's picture
Cypress Employee
13 posts

OK, I took the C# SWV app and modified it to make it more useful. I added buttons to connect/disconnect the Miniprog3 (and select voltage and connector). I also changed the app to just print ascii characters from the SWV stimulus port (not ascii hex representations).

I also created a PSoC Creator firmware example that redirects printf() to the SWV stimulus port 0. The firmware works both on PSoC3 and PSoC5. 

So what you get is a little app that lets you connect and view SWV printf() console output from the Miniprog3!

The app is usable, but can stand to have a lot more refinement. Because of this, I have put the code on github. I'm hoping some of you can try it out and perhaps even make some contributions.

(Oh, and this is my first use of github, and I'm relatively new to git in general, so please be gentle if I screwed something up!)


rcs's picture
1 post

Thanks for posting the app. Very useful for fast debug output. Is there a doc that describes the PP_ComLib_WrapperClass API? Also interested in the format of the data passed to pp_USB2IIC_ReceivedData. Timestamp etc.

CypressFan's picture
2 posts

Having this functionality will help greatly with debugging; however it isn't working for me.

I'm using the CY8CKIT-010 with the MiniProg3 connected from the Aux port to the PROG port... it appears that the _write function isn't getting called, but I know that the hardware is working because the following in main() works:

int debug_printf(const char *format, ...)


int i, len;

char output[200];

va_list args;


len = vsprintf(output, format, args);


char* ptr;

ptr = output;

for (i = 0; i < len; i++)


while (CY_GET_REG8(CYDEV_ITM_BASE) == 0);



return len;


int main(void)


uint32 i;


while (1)






Log in to post new comments.