cancel
Showing results for 
Search instead for 
Did you mean: 

WICED Studio Bluetooth

Anonymous
Not applicable

Hello,

I'm new to the Cypress MCU world... I purchased a couple of CYW920719Q40-B1 eval kits. I managed to build and download a few of the samples onto the board... Can anyone please tell me how I can now begin to step debug through code/firmware that I download to them in WICED v6.1?

Additionally, is there any additional equipment I need?

Thanks

Steve Tigher

0 Likes
1 Solution
RanjithK_41
Employee

Hi Steve,

Please follow the procedure below for JTAG-SWD debugging in CYW920719Q40EVB-01

Install

https://www.segger.com/downloads/jlink/JLink_Windows.exe

I have attached a sample application in this post.

Please remember not to use PUART and SWD at the same time if the lines are shorted in the schematics. In case of CYW920719Q40EVB-01, P33 and P34 are respectively used for SWDCK/PUART_TXD and SWDIO/PUART_RXD.

Comment the PUART part in your application and also remove the jumpers connecting PUART in the evaluation board.

Please change the include/20719/internal/gpiofunction.h to the example attached in this post (new_swd_gpio).

For wiced 6.1

Include the following snippet in your application. Make sure you use specify the pins correctly.

//The following also should work.

#include "wiced_hal_gpio.h"

#include "gpiofunction.h"

void _tx_v7m_set_int(unsigned int posture);

unsigned int _tx_v7m_get_int(void);

/// When debugging is enabled, sets up the HW for debugging.

#define SETUP_APP_FOR_DEBUG_IF_DEBUG_ENABLED() do{          \

wiced_hal_gpio_select_function(WICED_P10, SWDIO); \

wiced_hal_gpio_select_function(WICED_P11, SWDCK); \

wiced_hal_wdog_disable(); \

}while(0)

/// Optionally waits in a pseudo while(1) until the user allows the CPU to continue

#define BUSY_WAIT_TILL_MANUAL_CONTINUE_IF_DEBUG_ENABLED() do{    \

volatile UINT8 spar_debug_continue = 0;\

unsigned int interrupt_save = _tx_v7m_get_int();\

while(!spar_debug_continue)       \

; \

spar_debug_continue = 0; \

_tx_v7m_set_int(interrupt_save);        \

}while(0)

In application_start or button interrupt hanlder use this

SETUP_APP_FOR_DEBUG_IF_DEBUG_ENABLED();

BUSY_WAIT_TILL_MANUAL_CONTINUE_IF_DEBUG_ENABLED();

Download the code with DEBUG=1 ain the make target and in makfile.mk file use C_FLAGS += -DDEBUG

There are 10 pin and 20 pin JTAG/SWD interfaces available in the market.

Connect 4 pins.

Vref(1), SWDIO(2), SWDCK(4), GND(3)  in 10 pin adapter.

Vref(1), SWDIO(7), SWDCK(9), GND(20)  in 20 pin adapter.

concortex10pindesc.png20pin.png

And connect the jtag adapter to PC. Even if it is plugged in before, no worries.

Make sure you give the correct pins for SWDIO and SWDCK in the code above.

Start the jlink GDB server. The following window shows up.

jlink gdb server.png

Then Click ok.

waiting.png

It will display "waiting for GDB connection"

In wiced, go to Debug Configurations. Make sure you see the following configurations. You can see by default, it debugs last_built.elf from the build folder of wiced. Choose your respective chip(20719-B1) and OS.

Debug config.png

Click debug and then click yes to open debug perspective in wiced.

PERSPECTIVE.png

debugging.png

You need to change spar_debug_continue value in the variables window of wiced to be non-zero in memory to continue and debug further with breakpoints.

If you are facing any issues in Windows 10 or earlier causing driver issue. Please follow these links.

JTAG SWD Driver issue in windows 10 Follow this. Remember to check "confirm device drivers also" when uninstall device

https://gojimmypi.blogspot.in/2017/03/Segger-J-Link-STM32-with-VisualGDB.html

https://sysprogs.com/w/forums/topic/segger-j-link-no-emulators-connected-via-usb-after-configuring-f...

Thanks,

Ranjith.

View solution in original post

16 Replies