7 Replies Latest reply on Aug 23, 2016 4:23 AM by user_431614858

    swv

    863347718_1445601

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

        • 1. Re: swv
          user_1377889

          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

          • 2. Re: swv
            863347718_1445601

            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.

               

            • 3. Re: swv
              user_1377889

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

                 

               

                 

              Bob

              • 4. Re: swv
                863347718_1445601

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

                   

                Pengcheng Hao

                • 5. Re: swv
                  user_1377889

                  Afaik you need special JTAG hardware for tracing.

                     

                   

                     

                  Bob

                  • 6. Re: swv
                    user_431614858

                    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.

                    • 7. Re: swv
                      863347718_1445601

                      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. 

                      • 8. Re: swv
                        user_431614858

                        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.