swv

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

cross mob
Anonymous
Not applicable

  I have a Psoc5lp kit. I want to know how I can use the function of swv.

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

Welcome in the forum.

   

You will probably need some JTAG hardware to interface your board when you want to use SWV.

   

On your kit already is an interface for debugging which is quite sufficient for setting breakpoints and inspecting/setting variables. This debug interface runs using the same USB connection that is used for programming your PSoC5.

   

BTW: Which PSoC5 kit have you got, the -050 or the -059?

   

 

   

Bob

0 Likes
Anonymous
Not applicable

My kit is -50. Now, I can debug the Psoc5LP by uvision4 keil , but the trace window cannot be opened。 In other words ,I can just use SWD. I do not know how to use SWV. In the picture,you can see the trace window is valid.

   

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

Is there a reason you do not use Creator for debugging your PSoC?

   

 

   

Bob

0 Likes
Anonymous
Not applicable

In my view ,the creator does not have trace(swv) function. Do you have any way to use swv by creator?

   

Pengcheng Hao

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

Afaik you need special JTAG hardware for tracing.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

For what it is worth I have managed to get SWV up-and-running in IAR Embedded Workbench using a SEGGER J-Link debugger. Admittedly on a proprietary board but IIRC the kit has a SWV trace line connected on a standard 10-pin Cortex SWD programming header.

   

The main stumbling block was to correctly configure the MCU for SWV output. Below is my present set-up, more or less, as massaged from a Cypress sample which should be floating around somewhere. Here DIVIDER divides the bus clock to yield the UART-mode trace frequency:

   

*(volatile uint32_t *) CYREG_CORE_DBG_EXC_MON_CTL = 0x01000000;
*(volatile uint8_t *) CYREG_MLOGIC_DEBUG = 0x0C;
*(volatile uint32_t *) CYREG_ITM_LOCK_ACCESS = 0xC5ACCE55;
*(volatile uint32_t *) CYREG_ITM_TRACE_CTRL = 0x15;
*(volatile uint32_t *) CYREG_TPIU_ASYNC_CLK_PRESCALER = DIVIDER / 2 - 1;
*(volatile uint8_t *) CYREG_TPIU_PROTOCOL = 0x02;
*(volatile uint32_t *) CYREG_ITM_TRACE_EN = 0xFFFFFFFF;
*(volatile uint16_t *) CYREG_ETM_SYNC_FREQ = 0x0100;
*(volatile uint32_t *) CYREG_TPIU_FORM_FLUSH_CTRL = 0x00000000;

   

...

   

void SWV_PutChar(char ch) {
    while(!*(const volatile uint8_t *) CYDEV_ITM_BASE));
    *(volatile uint8_t *) CYDEV_ITM_BASE = ch;
}

   

After that configuring IAR to receive SWV traces on correct channel and frequency yielded the expected results. Admittedly only at moderate frequencies up to 7 MHz or so and not for fast unintrusive manchester-encoded ones as yet. Beyond that I also had some initial issues with a damaged PSoC mostly working but hard-faulting soon after enabling SWV.

0 Likes
Anonymous
Not applicable

It is really helpful. Do you have a complete project about SWV ? Also,I want to know whether I can use SWV just  via a driver like miniprog/kit driver. 

0 Likes
Anonymous
Not applicable

Nothing which is directly compatible with the development kit or which I can readily share I'm afraid.

   

The Miniprog may certainly support SWV but wouldn't really know. To be honest IAR+SEGGER is our usual toolchain for ARM development and so I haven't really bothered to investigate the proprietary Cypress environment after getting things up-and-running.

   

Sorry.

0 Likes