Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions boards/microchip/pic32c/pic32cm_jh01_cpro/board.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright (c) 2025 Microchip Technology Inc.
# SPDX-License-Identifier: Apache-2.0

board_runner_args(pyocd "--target=pic32cm5164jh01100" "--frequency=4000")
board_runner_args(jlink "--device=PIC32CM5164JH" "--speed=4000")

include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
70 changes: 60 additions & 10 deletions boards/microchip/pic32c/pic32cm_jh01_cpro/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,60 @@ Programming & Debugging

.. zephyr:board-supported-runners::

Flash Using J-Link
==================
Setting Up the Debug Interface
==============================

PyOCD Setup
===========

1. Install Device Pack

Add support for the PIC32CM family devices using the following command:

.. code-block:: console

pyocd pack install pic32cm

2. Verify Device Support

Confirm that the target is recognized:

.. code-block:: console

pyocd list --targets

You should see an entry similar to:

.. code-block:: text

pic32cm5164jh01100 Microchip PIC32CM5164JH01100 PIC32CM-JH pack

To flash the board using the J-Link debugger, follow the steps below:

3. Connect the Board

Connect the DEBUG USB port on the board to your host machine to **power up the board**.


J-Link Setup
============

1. Install J-Link Software

- Download and install the `J-Link software`_ tools from Segger.
- Make sure the installed J-Link executables (e.g., ``JLink``, ``JLinkGDBServer``)
are available in your system's PATH.
Download and install the `J-Link software`_ tools from Segger.
Make sure the installed J-Link executables (e.g., ``JLink``, ``JLinkGDBServer``)
are available in your system's PATH.

2. Connect the Board

- Connect the `J32 Debug Probe`_ to the board's **CORTEX DEBUG** header.
- Connect the other end of the J32 Debug Probe to your **host machine (PC)** via USB.
- Connect the DEBUG USB port on the board to your host machine to **power up the board**.

3. Build the Application

Building and Flashing the Application
=====================================

1. Build the Application

You can build a sample Zephyr application, such as **Blinky**, using the ``west`` tool.
Run the following commands from your Zephyr workspace:
Expand All @@ -70,17 +106,31 @@ To flash the board using the J-Link debugger, follow the steps below:

This will build the Blinky application for the ``pic32cm_jh01_cpro`` board.

4. Flash the Device
2. Flash the Device

Once the build completes, flash the firmware using:

.. code-block:: console

west flash

This uses the default ``jlink`` runner to flash the application to the board.
By default, this command uses the PyOCD runner to program the device.

If both J-Link and PyOCD debuggers are connected, you can explicitly select the desired runner as shown below:

.. code-block:: console

west flash --runner jlink

or

.. code-block:: console

west flash --runner pyocd

This ensures the application is flashed using the respective connected interface.

5. Observe the Result
3. Observe the Result

After flashing, **LED0** on the board should start **blinking**, indicating that the
application is running successfully.
Expand Down
Loading