Skip to content

Getting started guide for RTL87x2J

Zhiyuan edited this page Nov 11, 2026 · 21 revisions

RTL87x2J Getting Started Guide

Prerequisites

Follow the official Zephyr getting started guide to set up your development environment:

  1. Install dependencies: See Install dependencies
  2. Install Zephyr SDK v1.0: RTL87x2J is currently being developed on the Zephyr v4.4 downstream, which requires Zephyr SDK v1.0. See Install the Zephyr SDK

Hardware

  • RTL87x2J EVB Mother Board
  • RTL87x2J Daughter Board
  • USB cables
  • Jumper wires (for UART RX/TX connection)
  • Dupont wires (for RTS/DTR automatic download mode wiring)

Note: The hardware EVB documentation (including detailed pin assignments, wiring diagrams, and board power supply connections) has not been released. Please stay tuned for updates on RealMCU.

Get Realtek Zephyr Package

Most steps in the Get Zephyr and install Python dependencies section of the official guide can be followed as-is, except the step Get the Zephyr source code.

Instead of fetching the upstream Zephyr source code directly, initialize the workspace with the Realtek manifest. Choose one of the following, depending on whether you want the latest development state or a fixed release.

[Recommended] Latest development (rtk-v4.4-branch)

west init -m https://github.com/rtkconnectivity/realtek-zephyr-project.git --mr rtk-v4.4-branch ws
cd ws
west update

rtk-v4.4-branch is the downstream development branch of Zephyr v4.4. Its west.yml tracks the development branches of the Realtek repositories (see Code Base), so west update fetches the latest commit of each of them. Use it to get the most recent updates. The result changes over time.

Fixed release (v4.4.0-rtk-01.01.00)

west init -m https://github.com/rtkconnectivity/realtek-zephyr-project.git --mr v4.4.0-rtk-01.01.00 ws
cd ws
west update

A release tag pins every Realtek repository to a fixed commit, so the workspace is the same every time. Use it for development that needs a stable, reproducible base. See the v4.4.0-rtk-01.01.00 release note for the content of the release.

You may replace ws with any directory name you prefer.

Code Base

The RTL87x2J project is built on the following repositories. The branches are the ones tracked by rtk-v4.4-branch; a release tag pins them to fixed commits.

Component Repository Branch
Zephyr rtkconnectivity/zephyr realtek-main-v4.4
hal_realtek rtkconnectivity/hal_realtek hal_realtek_v4.4
mcuboot rtkconnectivity/zephyr-mcuboot v4.4-bee
tf-psa-crypto rtkconnectivity/zephyr-tf-psa-crypto v4.4.0-bee-psa-accelerators

Build a Zephyr Sample

After completing the setup above, build the hello_world sample to verify the environment:

west build -b rtl87x2j_evb/rtl8762jth zephyr/samples/hello_world

After a successful build, the generated images are located at:

  • build/zephyr/zephyr.bin
  • build/zephyr/zephyr.hex

Build with MCUboot

To build the sample together with the MCUboot bootloader, use sysbuild and enable MCUboot:

west build -b rtl87x2j_evb/rtl8762jth --sysbuild zephyr/samples/hello_world -- -DSB_CONFIG_BOOTLOADER_MCUBOOT=y

With sysbuild, the images of each project are placed in their own directory:

Project Images
MCUboot bootloader build/mcuboot/zephyr/zephyr.bin, build/mcuboot/zephyr/zephyr.hex
Application (signed for MCUboot) build/hello_world/zephyr/zephyr.signed.bin, build/hello_world/zephyr/zephyr.signed.hex

west flash flashes the mcuboot project first and the application second.

Note: MCUboot is supported on RTL87x2J only. The application image built with MCUboot is placed in the image-0 flash partition and does not carry the Realtek image header. west flash automatically uses the signed image (zephyr.signed.bin).

Flashing Tools

Two flashing tools are supported for RTL87x2J. Both are integrated into west flash as runners:

Tool Runner Capabilities
mpcli mpcli (default) Flash Zephyr images with west flash; flash the Realtek essential images with west flash --mp-json.
rtkprog rtkprog Flash Zephyr images with west flash --runner rtkprog; flash the Realtek essential images by invoking rtkprog write directly; view the device log with rtkprog terminal.

Note: The mpcli version linked in the official Zephyr documentation does not support RTL87x2J yet. Please use the mpcli version provided in this guide (see Install mpcli Tool).

Please install the tool(s) you plan to use before continuing.

Install mpcli Tool

Before flashing the Zephyr image, install the mpcli tool developed by Realtek.

  1. Download mpcli v1.0.4.31
  2. Extract the archive
  3. Add the mpcli tool directory to your system PATH

Linux:

export PATH=$PATH:/path/to/mpcli_tool

Windows: Add the mpcli tool directory to your system PATH in Environment Variables.

Install rtkprog Tool

rtkprog is an open source UART flashing tool for Realtek RTL87xxx SoCs (source). It requires Python 3.12 or later. Install it into the same Python environment that is used for west:

pip install rtkprog

Verify the installation:

rtkprog --help

Image Download

Flash the images with one of the tools introduced in Flashing Tools.

Wiring for Automatic Download Mode

To enable automatic flashing without toggling the download switch, wire the RST pin to RTS pin and the LOG pin to DTR pin on the EVB with Dupont wires. The mpcli and rtkprog tools will then control the RTS and DTR signals to make the SoC enter and exit download mode automatically — no need to toggle the switch manually.

Flash Realtek Essential Images

Before flashing the Zephyr application image, you must first flash the essential image provided by Realtek to make the SoC function properly.

Image Function Required for RTL87x2J
System Config Configures device parameters such as Bluetooth address, link count, and other system settings. Generated by the MCUConfig Tool. ✔️

Note: The essential Realtek image is pre-bundled at modules/hal/realtek/zephyr/blobs/bee/rtl87x2j/bin. You do not need to run west blobs fetch separately.

The essential image typically needs to be flashed at least once on a new or erased board. For normal application development, after it has been flashed successfully, you can flash only the Zephyr application image (see Flash Zephyr Images).

Using mpcli

The JSON configuration file for flashing the essential image is pre-bundled in the hal_realtek module at:

modules/hal/realtek/bee/tools/mpcli/configs/rtl87x2j_essential_images.json

From the directory where the build/ folder is located, run:

west flash --port <port_name> --mp-json <workspace>/modules/hal/realtek/bee/tools/mpcli/configs/rtl87x2j_essential_images.json

Using rtkprog

Invoke rtkprog write directly. The address 0x2200400 is the same one used in the mpcli JSON file above, and the offset 0x200 skips the 512-byte header at the beginning of the system image:

rtkprog --port <port_name> write -w 0x2200400,0x200,<workspace>/modules/hal/realtek/zephyr/blobs/bee/rtl87x2j/bin/sys_config_MP-333e3c3ee85d86ee0802e9405fe2cdae.bin

Flash Zephyr Images

After building Zephyr, flash the application image with either tool. The west flash command assumes you are running it from the directory where the build/ folder resides. If not, specify the build directory using the --build-dir (or -d) option.

Using mpcli

west flash --port <port_name>

Using rtkprog

west flash --runner rtkprog --port <port_name>

After flashing succeeds, the SoC resets automatically (if the RTS/DTR wiring is correctly connected).

Note: Before flashing, ensure the serial port is available and not occupied by other applications (e.g., a serial console).

Verify Runtime Output

There are two ways to view the log output of the EVB console UART.

Using a Serial Monitor

Important: If you wired the board for automatic download mode, you must disconnect the wires connected to the RTS and DTR pins before using a serial monitor, so that these two pins are not controlled. Otherwise the normal log cannot be seen. This is not required when viewing the log with rtkprog (see below): keep the automatic download wiring as is.

Open any common serial monitor (e.g., PuTTY, Tera Term, minicom) connected to the EVB console UART with the following settings:

Setting Value
Baud rate 115200
Data bits 8
Parity None
Stop bits 1
Flow control None

You should see output similar to:

Hello World! rtl87x2j_evb

Using rtkprog

rtkprog can also be used to view the log. It resets the chip and opens the serial port as a terminal:

rtkprog --port <port_name> --baud 115200 terminal

The output should be the same as shown above.

Troubleshooting

Serial Port Not Found

  • Check that the USB cable is properly connected.
  • Verify the correct COM port in Device Manager (Windows) or /dev/ttyUSB* (Linux).
  • Ensure no other application is using the port.

Flash Failed

  • Verify the board is in download mode (DIP switch ON, reset pressed), or that the RTS/DTR wiring is correctly connected.
  • Check that the mpcli tool (or rtkprog, if you use it) is properly installed and in your PATH.
  • Verify the JSON config file path is correct.

Build Errors

  • Ensure Zephyr SDK v1.0 is properly installed.
  • Verify all dependencies are installed per the Zephyr v4.4 documentation.
  • Run west update to ensure all modules are up to date.
  • Make sure you initialized the workspace using the rtk-v4.4-branch branch or a v4.4.0-rtk-* release tag of realtek-zephyr-project.

Clone this wiki locally