-
Notifications
You must be signed in to change notification settings - Fork 37
Programming RT685EVK
This guide illustrates the steps of how to connect to the RT685EVK and program the device through probe-rs.
Used for flashing and debugging. Installed via cargo:
$ cargo install probe-rs-tools --git https://github.com/probe-rs/probe-rs --locked --forceDownload an installer from Segger Downloads website and follow the installer steps.
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.
We start by making the sure the board oriented with the SD Card Cage facing the user and no cables are connected, like so:

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

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:65Press Ctrl-C to quit the example.
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:
- Disconnect all cables from your RT685s EVK
- Short the jumper JP1 (this places the probe in programming mode, see image below)
- From your terminal navigate to
C:\NXP\LPCScrypt_2.1.3_83\scripts - Run the script
.\program_CMSIS.cmd

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.

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)

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- 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-rstry using Segger's J-Flash utility to erase the chip first.
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.
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)Boot mode is selected by SW2, close to the SD Card Cage.

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.

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.3088844sIn 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,

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