Skip to content

Programming RT685EVK

Jeff Glaum edited this page Mar 29, 2025 · 11 revisions

Introduction

This guide illustrates the steps of how to connect to the RT685EVK and program the device through probe-rs.

Required Tools

probe-rs

Used for flashing and debugging. Installed via cargo:

$ cargo install probe-rs-tools --git https://github.com/probe-rs/probe-rs --locked --force

Segger JLink Tools

Download an installer from Segger Downloads website and follow the installer steps.

Flashing The EVK

There are 2 options here (please, use only one of them). We can either use the embedded LINK2 probe on the EVK (USB port J5 labeled LINK USB), or use the header J5 with an external probe, such as Segger JLink.

Using Embedded LINK2 Probe

We start by making the sure the board oriented with the SD Card Cage facing the user and no cables are connected, like so:

IMG_6002

Connect Micro-USB cable to port J5 and the other end of the cable to a USB port on your development machine:

IMG_6004

Open a terminal and verify that you have probe-rs installed correctly and it can detect your LINK2 probe:

$ probe-rs list
  The following debug probes were found:
  [0]: LPC-LINK2 CMSIS-DAP V5.460 -- 1fc9:0090:BTA2BQHR (CMSIS-DAP)

After verifying, we can finally run an example on our RT685s EVK:

$ cd path\to\embassy-imxrt\examples\rt685s-evk
$ cargo run --bin adc
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.19s
     Running `probe-rs run --chip MIMXRT685SFVKB target\thumbv8m.main-none-eabihf\debug\adc`
      Erasing ✔ [00:00:01] [##################################################]      0 B/     0 B @      0 B/s (eta 0s )
  Programming ✔ [00:00:03] [################################################] 29.00 KiB/29.00 KiB @ 9.52 KiB/s (eta 0s )
Finished in 3.786269s
INFO  I am the ADC example
└─ adc::____embassy_main_task::{async_fn#0} @ src\bin\adc.rs:65
INFO  I am the ADC example
└─ adc::____embassy_main_task::{async_fn#0} @ src\bin\adc.rs:65

Press Ctrl-C to quit the example.

(Optionally) Upgrade LINK2 Probe

If probe-rs does not detect your probe or if you want to run the latest CMSIS-DAP FW, download LinkServer for Microcontrollers which contains the LPCScrypt tool to upgrade the FW. After running the installer, open a terminal and carefully follow the steps below:

  1. Disconnect all cables from your RT685s EVK
  2. Short the jumper JP1 (this places the probe in programming mode, see image below)
  3. From your terminal navigate to C:\NXP\LPCScrypt_2.1.3_83\scripts
  4. Run the script .\program_CMSIS.cmd

IMG_6005

You should see the messages below:

LPCScrypt - CMSIS-DAP firmware programming script v2.1.2 Nov 2020.

Connect an LPC-Link2 or LPCXpresso V2/V3 Board via USB then press Space.

Press any key to continue . . .

Press ENTER. When the process is completed, it will show these messages:

Booting LPCScrypt target with "LPCScrypt_240.bin.hdr"
LPCScrypt target booted
.
Programming LPCXpresso V2/V3 with "LPC432x_IAP_CMSIS_DAP_V5_361.bin"

- LPCXpresso V2/V3 programmed successfully and has the unique ID: OQA4BQCQ
- To use: remove DFU link and reboot.

Connect Next Board then press Space (or CTRL-C to Quit)

Press any key to continue . . .

Press Ctrl-C to quit. Unplug the cable and disconnect jumper JP1 (see image below). Replug the cable and your probe should be detected by probe-rs.

IMG_6002

Using Segger JLink (or other external probe)

probe-rs also supports the Segger JLink probes out of the box. All we have to do here is connect our Segger JLink probe to J2 and a second Micro-USB cable to J6 (USB port labeled EXT PWR)

IMG_6007

Finally proceed with:

$ cargo run --bin adc
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.19s
     Running `probe-rs run --chip MIMXRT685SFVKB target\thumbv8m.main-none-eabihf\debug\adc`
      Erasing ✔ [00:00:01] [##################################################]      0 B/     0 B @      0 B/s (eta 0s )
  Programming ✔ [00:00:05] [################################################] 29.00 KiB/29.00 KiB @ 4.91 KiB/s (eta 0s )
Finished in 7.0723596s
INFO  I am the ADC example
└─ adc::____embassy_main_task::{async_fn#0} @ src\bin\adc.rs:65
INFO  I am the ADC example
└─ adc::____embassy_main_task::{async_fn#0} @ src\bin\adc.rs:65
INFO  I am the ADC example
└─ adc::____embassy_main_task::{async_fn#0} @ src\bin\adc.rs:65

Common Issues

  • If Segger JLink debug probe is not set up correctly, then you might run into JLink errors

Verify that you have installed the WINUSB driver, and are not using the standard SEGGER J-Link driver bundled with SEGGER's tools. If you are using SEGGER's driver, you will see a complaint from probe-rs that communication could not be established, and to check https://zadig.akeo.ie/ for the correct USB driver. Follow this link, and run the Zadig 2.9 executable provided in the zip archive. From there, select Options -> View All Devices, navigate the drop down menu to J-Link, and press the replace driver button. After the installation has completed, probe-rs should be able to connect and work with your J-Link.

  • If the latest probe-rs is not installed from GitHub directly, you will get a unknown target error.

  • If you're unable to flash with a J-link through probe-rs try using Segger's J-Flash utility to erase the chip first.

Recovery

If, for some reason, you are unable to attach to the EVK via SWD/JTAG, then it's likely that the currently flashed FW has misconfigured the HW enough that the Coresight Debug Subsystem isn't running correctly which ends up preventing any SWD/JTAG communication from being successful.

In order to sort this out, we will temporarily change the boot mode such that the offending code in flash doesn't get to run.

Failure Symptoms

If you see a message like below, you probably need to recover the image in the flash:

Error: Connecting to the chip was unsuccessful.

Caused by:
    0: An ARM specific error occurred.
    1: A timeout occurred during an operation.
error: process didn't exit successfully: `probe-rs run --chip MIMXRT685SFVKB target\thumbv8m.main-none-eabihf\debug\IMAGE_NAME` (exit code: 1)

Setting it up

Boot mode is selected by SW2, close to the SD Card Cage.

ON-OFF-ON

By default, it should be set to ON-OFF-ON, which translates to FlexSPI Port B. We want to negate all bits, getting to OFF-ON-OFF.

OFF-ON-OFF

The MCU is now in DFU Boot, meaning it will run off of some internal ROM that contains a DFU FW implementation. We don't really need DFU, just need to prevent our bogus image from running. At this moment, SWD should be functional. Plug your USB cable to J5 (if using LINK2 probe) or J6 (if using external Probe through J2) and download a working binary to the flash:

$ probe-rs download --chip MIMXRT685SFVKB target\thumbv8m.main-none-eabihf\debug\blinky
 WARN probe_rs::vendor::nxp::sequences::nxp_armv8m: FlexSPI0 NOR flash config block starts with 0x00000001 (valid blocks start with 0x42464346)
 WARN probe_rs::vendor::nxp::sequences::nxp_armv8m: FlexSPI0 NOR flash config block starts with 0x00000001 (valid blocks start with 0x42464346)
      Erasing ✔ [00:00:00] [###############################################] 24.00 KiB/24.00 KiB @ 24.23 KiB/s (eta 0s )
  Programming ✔ [00:00:03] [################################################] 21.75 KiB/21.75 KiB @ 6.63 KiB/s (eta 0s )
    Finished in 3.3088844s

In the example above, we're using a blinky application from the RT685S PAC Examples repository, but any known-working binary would suffice.

One this process completes, detach all cables from the board, make sure it's trully powered down, negate SW2 pins again so they read ON-OFF-ON,

ON-OFF-ON

plug a micro-USB cable to J5 and verify that the LED blinks again.

Clone this wiki locally