Unlock Advanced Debugging: Configuring Your Segger J-Link with the CY8CKIT-062S2-43012
A step-by-step guide to seamlessly integrate the powerful Segger J-Link debugger with your Infineon PSoC 62S2 Wi-Fi BT Pioneer Kit.
The Infineon CY8CKIT-062S2-43012 PSoC 62S2 Wi-Fi BT Pioneer Kit is a versatile platform for developing cutting-edge IoT applications. While it includes an onboard KitProg3 debugger, many developers prefer the advanced capabilities and performance of a Segger J-Link debugger. This guide provides a comprehensive walkthrough for configuring your Segger J-Link to work effectively with this powerful kit.
Key Configuration Highlights
Hardware Connection is Crucial: Proper connection via the Serial Wire Debug (SWD) interface, including SWDIO, SWCLK, GND, and VTarget, is fundamental for successful debugger operation.
Software and IDE Synergy: Utilizing the latest Segger J-Link software and a compatible Integrated Development Environment (IDE) like ModusToolbox is essential for a smooth debugging experience.
Correct Device and Core Selection: Accurately specifying the PSoC 62 MCU (e.g., CY8C624ABZI-S2D44 or CY8C6xx7_CM4 for the Cortex-M4 core) within your IDE's debug configuration is vital for communication.
Understanding Your Tools: The Kit and the Debugger
The CY8CKIT-062S2-43012 Pioneer Kit
The CY8CKIT-062S2-43012 features the PSoC 62S2 MCU, which boasts a dual-core Arm architecture (Cortex-M4 and Cortex-M0+), 1MB of Flash memory, and extensive peripherals, including Wi-Fi and Bluetooth connectivity provided by the Murata 1LV Module (CYW43012). This makes it an ideal choice for complex embedded systems. The kit comes with an integrated KitProg3 programmer/debugger, but for enhanced debugging features, an external debugger like the Segger J-Link is often preferred.
The Infineon CY8CKIT-062S2-43012 Pioneer Kit.
The Segger J-Link Debugger
Segger J-Link debug probes are renowned for their high performance, extensive feature set, and broad MCU support. They typically connect to target devices via SWD or JTAG interfaces. For the PSoC 62S2 MCU, SWD is the standard. J-Link offers faster debugging speeds, an unlimited number of breakpoints in Flash memory (with J-Flash), and advanced features like Real-Time Transfer (RTT) for efficient data logging and visualization.
Conceptual representation: A Segger J-Link OB, similar to external J-Link probes, integrated on a Cypress development kit.
Prerequisites for Configuration
Before you begin, ensure you have the following hardware and software components ready:
Hardware Requirements
CY8CKIT-062S2-43012 PSoC 62S2 Wi-Fi BT Pioneer Kit: The target development board.
Segger J-Link Debugger: A compatible J-Link model (e.g., J-Link BASE, J-Link PLUS, J-Link ULTRA+, J-Link PRO, J-Link EDU Mini). Ensure its firmware is up-to-date, as older J-Link versions (like v8) might have limited or no support for the Cortex-M4 core in PSoC 6 MCUs.
USB Cable: To connect the J-Link debugger to your computer and to power the Pioneer Kit.
Appropriate Debug Cable/Adapter: Typically a 10-pin Cortex Debug connector or individual jumper wires for the SWD interface.
Software Requirements
Segger J-Link Software and Documentation Pack: Download the latest version from the Segger website. This package includes drivers, J-Link Commander, J-Flash, J-Link GDB Server, and other utilities.
Integrated Development Environment (IDE):
Infineon ModusToolbox™ Software: This is the recommended IDE for PSoC 6 development and offers excellent integration with Segger J-Link.
Other compatible IDEs: ARM Keil MDK (uVision), IAR Embedded Workbench for Arm (EW-ARM), or Eclipse-based IDEs with GNU Arm Embedded Toolchain and Segger J-Link plugins. Note that PSoC Creator primarily supports the onboard KitProg3 and MiniProg3, so exporting projects to one of these other IDEs is necessary when using an external J-Link.
Board Support Package (BSP) for CY8CKIT-062S2-43012: Usually obtained through ModusToolbox or from the Infineon website.
Step-by-Step Configuration Guide
Follow these steps to configure your Segger J-Link debugger for use with the CY8CKIT-062S2-43012 kit.
Step 1: Hardware Connection
Connecting J-Link to the Pioneer Kit
The CY8CKIT-062S2-43012 provides a debug connector for external debuggers. This is often a 10-pin Cortex Debug connector (0.05" pitch) typically labeled, for example, as J8 or P6 on similar PSoC 6 kits, or it might be accessible via specific SWD jumper headers. Consult your kit's user guide for the exact location and pinout of the SWD connector.
Connect the Segger J-Link to the SWD interface on the Pioneer Kit using the appropriate cable. The essential connections are:
SWDIO (Serial Wire Data Input/Output): Connect to the J-Link's SWDIO pin.
SWCLK (Serial Wire Clock): Connect to the J-Link's SWCLK pin.
GND (Ground): Connect to the J-Link's GND pin.
VTref / VTarget (Target Voltage Reference): Connect to the J-Link's VTref pin. This allows the J-Link to sense the target's operating voltage (typically 3.3V for this kit).
(Optional) SWO (Serial Wire Output): For trace capabilities, connect to J-Link's SWO pin if your J-Link model and application support it.
(Optional) nRESET (Target Reset): Connect to J-Link's nRESET pin for hardware reset control.
SWD Pinout Summary Table
The following table provides a general SWD pinout for a standard 10-pin Cortex-M debug connector. Always verify with your specific board's documentation.
Pin (10-pin Connector)
Signal Name
Description
1
VTref / VCC
Target Voltage Sense
2
SWDIO / TMS
Serial Wire Data / JTAG Test Mode Select
3
GND
Ground
4
SWCLK / TCK
Serial Wire Clock / JTAG Test Clock
5
GND
Ground
6
SWO / TDO
Serial Wire Output / JTAG Test Data Out
7
KEY / NC
Key (No Pin) / No Connect
8
NC / TDI
No Connect / JTAG Test Data In
9
GNDDetect
Ground Detect (optional)
10
nRESET / RTCK
Target Reset / JTAG Return Test Clock
Note: Ensure the JTAG/SWD selection on your J-Link (if applicable) is set to SWD mode.
Powering the Board
Connect the CY8CKIT-062S2-43012 kit to a power source using its USB connector or an external 3.3V supply as specified in the kit's documentation. The J-Link's VTref pin must detect the target voltage for proper operation.
In some cases, the onboard KitProg3 debugger might conflict with an external J-Link. If you encounter issues, you may need to disable or bypass the KitProg3. Refer to the CY8CKIT-062S2-43012 user manual for instructions on how to do this. This might involve changing jumper settings or physically removing certain components if you intend to permanently use an external debugger. For instance, on some kits, specific jumpers switch the debug lines between the onboard and an external debugger.
Step 2: Software Installation
Install Segger J-Link Software
If you haven't already, download the "J-Link Software and Documentation Pack" from the official Segger website (www.segger.com/downloads/jlink/). Install it on your development machine. This package includes the necessary drivers, J-Link Commander (a command-line utility for testing and configuration), J-Flash (for programming flash memory), and the J-Link GDB Server (for IDE integration).
Step 3: IDE Configuration
The process for configuring your IDE will vary slightly depending on the software you are using.
Using Infineon ModusToolbox™ Software (Recommended)
Create or Import Project: Open ModusToolbox and either create a new project for the CY8CKIT-062S2-43012 or import an existing one.
Open Debug Configurations: Navigate to the debug configuration settings. This is typically done by right-clicking your project and selecting "Debug As" -> "Debug Configurations..." or via a dedicated debug icon/menu.
Create a New J-Link Configuration:
Create a new debug configuration. Select "GDB SEGGER J-Link Debugging" or a similar option.
Main Tab: Ensure your project and C/C++ Application (e.g., the .elf file) are correctly specified.
Debugger Tab:
J-Link Device name: Select the specific PSoC 62 device. This might be listed as "CY8C624ABZI-S2D44" (the MCU on this board), a generic "CY8C62xx", or by its core, such as "CY8C6xx7_CM4" for the Cortex-M4 core. Accurate device selection is critical.
Interface: Set to "SWD".
Speed: Start with a moderate speed like 4000 kHz (4 MHz). You can adjust this later if you encounter stability issues (lower speed) or want faster performance (higher speed, if supported reliably).
Ensure the path to the J-Link GDB Server executable is correctly configured if required.
Startup Tab: Configure reset options, initial breakpoints (e.g., at `main`), and load behavior as needed.
Apply and Debug: Save the configuration and start a debug session.
A representative view of an IDE like ModusToolbox, where debug configurations are set up.
Using Other IDEs (e.g., Keil uVision, IAR EW-ARM, Eclipse)
Export Project (if from PSoC Creator): If your project was created in PSoC Creator, use the "Project -> Export to IDE" feature to generate project files for Keil, IAR, or a generic Makefile for Eclipse.
Keil MDK (uVision):
Open "Options for Target..." -> "Debug" tab.
Select "J-LINK / J-TRACE Cortex" from the dropdown list of debuggers.
Click "Settings" next to it. In the J-Link Target Driver Setup dialog, ensure SWD is selected and the correct PSoC 6 device is chosen or configured.
IAR Embedded Workbench for Arm:
Go to "Project" -> "Options..." -> "Debugger" category.
Select "J-Link/J-Trace" as the Driver.
Under "Setup" (or "Connection" tab for J-Link), configure the connection type (SWD) and select the appropriate device from the list or via a device description file.
Eclipse with GNU ARM Eclipse Plugins:
Install the Segger J-Link GDB server plugin if not already present.
Create a new debug configuration under "GDB SEGGER J-Link Debugging."
Configure the path to `JLinkGDBServerCL.exe`, the device name (e.g., `CY8C624ABZI-S2D44`), interface (SWD), and connection speed.
Step 4: Verifying Connection and Device Selection
Using J-Link Commander
Before diving into IDE debugging, you can use J-Link Commander to test the physical connection and J-Link's ability to communicate with the PSoC 6 MCU.
Open J-Link Commander from your Start Menu or by running `JLink.exe` from the installation directory.
Type `connect` when prompted.
You will be asked to specify the device. Enter the appropriate device name (e.g., `CY8C624ABZI-S2D44` or `PSoC 62 CY8C62...`). If unsure, you can type `?` to list supported devices or select from a GUI if it appears.
Select `S` for SWD interface.
Specify the target interface speed (e.g., `4000` for 4 MHz).
If successful, J-Link Commander will report information about the connected CPU (e.g., Arm Cortex-M4 core ID, DPIDR). You can then try commands like `r` (reset and halt), `mem32` (read memory), etc.
Example J-Link Commander session startup:
SEGGER J-Link Commander V7.xx (Compiled Apr xx 2025 xx:xx:xx)
DLL version V7.xx, compiled Apr xx 2025 xx:xx:xx
Connecting to J-Link via USB...O.K.
Firmware: J-Link V11 compiled Feb 28 2025 15:36:05
Hardware version: V11.00
S/N: XXXXXXXX
License(s): RDI, GDB
VTref=3.300V
Type "connect" to establish a target connection, '?' for help
J-Link>connect
Please specify target interface:
J) JTAG (Default)
S) SWD
TIF>S
Specify target interface speed [kHz]. <Default>: 4000 kHz>
Device>CY8C624ABZI-S2D44 // Or similar PSoC 6 device name
Connecting to target via SWD
InitTarget() start
Found SW-DP with ID 0x6BA02477
Scanning AP map to find all available APs
AP[2]: Stopped AP scan as AP IDR is 0x00000000
AP[0]: AHB-AP (IDR: 0x84770001)
AP[1]: APB-AP (IDR: 0x54770002)
Iterating through AP map to find AHB-AP to debug
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
Found Cortex-M4 r0p1, Little endian.
...
J-Link>
This confirms basic hardware and driver setup is working.
Handling Device Protection
PSoC devices can have various protection settings (e.g., eFuses) that might prevent debugging. If the device is locked, J-Link tools may offer an option to unprotect or erase it. This usually involves erasing the entire flash memory, so proceed with caution and ensure you have backups of any important data or firmware.
IDE Debugging Capabilities Comparison
When using a Segger J-Link with your PSoC 6 kit, different IDEs offer varying levels of integration and ease of use. The radar chart below provides a conceptual comparison of popular IDEs based on factors relevant to J-Link debugging with PSoC 6 devices. These are qualitative assessments based on general developer experiences.
This chart illustrates that ModusToolbox generally offers strong, dedicated support for PSoC 6 and good J-Link integration, while Keil and IAR are powerful alternatives with excellent debugging features, particularly well-regarded in the Arm ecosystem. Eclipse provides flexibility but might require more manual configuration.
Visualizing the Configuration Workflow
The following mindmap illustrates the key stages and considerations involved in configuring your Segger J-Link debugger for use with the CY8CKIT-062S2-43012.
This mindmap provides a high-level overview of the entire process, from initial preparations to active debugging and potential troubleshooting steps.
Programming and Debugging with ModusToolbox
ModusToolbox is Infineon's preferred development environment for PSoC MCUs, offering a comprehensive suite of tools for configuring hardware, developing firmware, and debugging applications. The video below provides an introduction to programming and debugging within the ModusToolbox ecosystem, which is highly relevant when using a Segger J-Link.
This video, "Welcome to Modus Toolbox: #4 Program & Debug," explains how to use various debugger hardware, including Segger J-LINK and Cypress KitProg, within ModusToolbox. It covers fundamental debugging functions like programming the device, running code, setting breakpoints, and stepping through execution. Understanding these basics within ModusToolbox will greatly aid your use of the Segger J-Link with the CY8CKIT-062S2-43012 kit.
Frequently Asked Questions (FAQ)
Q: Can I use Segger J-Link directly with PSoC Creator?
A: PSoC Creator primarily supports Infineon's MiniProg and KitProg programmers/debuggers. While you can develop your application in PSoC Creator, for debugging with a Segger J-Link, you typically need to export your project to a J-Link compatible IDE like ModusToolbox, Keil MDK, IAR Embedded Workbench, or an Eclipse-based environment. ModusToolbox is the recommended path for new PSoC 6 projects.
Q: What if my J-Link doesn't connect to the PSoC 6 target?
A: Connection issues can arise from several sources:
Incorrect Wiring: Double-check all SWD connections (SWDIO, SWCLK, GND, VTref).
Outdated J-Link Firmware/Software: Ensure you have the latest Segger J-Link Software and Documentation Pack installed, and that your J-Link's firmware is up to date. Older J-Link hardware (e.g., J-Link v8) might not fully support PSoC 6 (Cortex-M4).
Incorrect Device Selection: Verify that the correct PSoC 6 device is selected in your IDE's debug configuration or J-Link Commander.
Target Not Powered or Incorrect Voltage: Ensure the CY8CKIT-062S2-43012 is powered on and VTref is correctly sensed by the J-Link (should be ~3.3V).
Onboard Debugger Conflict: The onboard KitProg3 might be interfering. Check the kit's documentation for instructions on disabling it or selecting the external debug interface.
SWD Speed Too High: Try reducing the SWD clock speed in your debugger settings (e.g., to 1 MHz or lower).
Device Protection: The PSoC 6 MCU might be in a protected state. J-Link tools or your IDE might offer an "unlock" or "erase chip" feature, but use this with caution as it will erase existing firmware.
Q: Which core of the PSoC 62S2 (Cortex-M4 or Cortex-M0+) does the J-Link connect to?
A: The PSoC 62S2 has a dual-core architecture. When configuring your debugger, you typically specify the primary core you intend to debug, which is often the Cortex-M4 (CM4) as it's usually the main application processor. However, modern IDEs and J-Link drivers support debugging both cores, sometimes simultaneously or by switching context. Your IDE's debug configuration will usually have settings to target a specific core or manage multi-core debugging sessions.
Q: How can I get debug trace information using Segger J-Link?
A: Segger J-Link supports various tracing capabilities. For basic print-style debugging without halting the target, Segger's Real-Time Transfer (RTT) is highly effective and requires minimal target resources. You'll need to integrate the RTT library into your PSoC 6 application and use an RTT viewer (like J-Link RTT Viewer or integrated IDE views). For instruction trace, some J-Link models (like J-Trace) and PSoC 6 configurations support ETM (Embedded Trace Macrocell) trace via the SWO pin or a dedicated trace port, but this is more advanced and requires specific hardware and IDE support.