Hey!
I've been trying to make the FRDM RW612 work. I was able to flash for a couple of times, until I've connected the Adafruit TFT 2.8 LCD screen on top of the Arduino Header presented in the board, and, after that, I was able to flash a few more times until something went wrong and I couldn't anymore.
I've tried everything at this points:
- Downloaded MCUExpresso, created a default build for the board and tried to flash: failed.
- Downloaded the LinkServer, change from JLink probe to CMSIS, tried to flash: failed.
- Played around with JLink console: I can read and write onto specific addresses, but I can't flash.
I've tried different builds, NXP examples and Zephyr samples (Blinky): does't work.
Here's an example of error message from JLink:
J-Link>loadfile /Users/nunoguterres/Downloads/zephyr.elf 0x18000000
'loadfile': Performing implicit reset & halt of MCU.
ResetTarget() start
Reset via SYSRESETREQ and reset pin + halt after bootloader
ROM entered ISP command handling loop. Re-enable the debug access.
MSPLIM cleared
ResetTarget() end - Took 113ms
Downloading file [/Users/nunoguterres/Downloads/zephyr.elf]...
J-Link: Flash download: Bank 1 @ 0x18000000: 1 range affected (65536 bytes)
J-Link: Flash download: Total: 0.648s (Prepare: 0.165s, Compare: 0.150s, Erase: 0.004s, Program: 0.145s, Verify: 0.107s, Restore: 0.075s)
J-Link: Flash download: Program speed: 440 KB/s
****** Error: Verification failed @ address 0x18000000
Error while programming flash: Verify failed.
And here is the example of a connection to JLink:
JLinkExe -Device RW612 -speed 4000 -if swd
SEGGER J-Link Commander V8.10 (Compiled Sep 25 2024 14:15:06)
DLL version V8.10, compiled Sep 25 2024 14:14:53
Connecting to J-Link via USB...O.K.
Firmware: J-Link MCU-Link V1 compiled Sep 24 2024 10:57:33
Hardware version: V1.00
J-Link uptime (since boot): 0d 00h 22m 48s
S/N: 1066319194
USB speed mode: High speed (480 MBit/s)
VTref=3.300V
Type "connect" to establish a target connection, '?' for help
J-Link>connect
Device "RW612" selected.
Connecting to target via SWD
InitTarget() start
SWD selected. Executing JTAG -> SWD switching sequence.
DAP initialized successfully.
DMAP_REG_ID: DM-AP IDCODE detected: 0x002A0000
DHCSR: 0x05100000
InitTarget() end - Took 2.71ms
Found SW-DP with ID 0x6BA02477
DPIDR: 0x6BA02477
CoreSight SoC-400 or earlier
Scanning AP map to find all available APs
AP[1]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x84770001, ADDR: 0x00000000)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410FD214. Implementer code: 0x41 (ARM)
Feature set: Mainline
Cache: No cache
Found Cortex-M33 r0p4, Little endian.
FPUnit: 8 code (BP) slots and 0 literal slots
Security extension: implemented
Secure debug: enabled
CoreSight components:
ROMTbl[0] @ E00FF000
[0][0]: E000E000 CID B105900D PID 000BBD21 DEVARCH 47702A04 DEVTYPE 00 Cortex-M33
[0][1]: E0001000 CID B105900D PID 000BBD21 DEVARCH 47701A02 DEVTYPE 00 DWT
[0][2]: E0002000 CID B105900D PID 000BBD21 DEVARCH 47701A03 DEVTYPE 00 FPB
[0][3]: E0000000 CID B105900D PID 000BBD21 DEVARCH 47701A01 DEVTYPE 43 ITM
[0][5]: E0041000 CID B105900D PID 002BBD21 DEVARCH 47724A13 DEVTYPE 13 ETM
[0][6]: E0042000 CID B105900D PID 000BBD21 DEVARCH 47701A14 DEVTYPE 14 CSS600-CTI
Memory zones:
Zone: "Default" Description: Default access mode
Cortex-M33 identified.
I've noticed this behavior has happened twice (in two boards). I really want to believe this has nothing to do with the LCD, since it would place the responsibility of this not working onto NXP/Adafruit hands and faulty design.
Has anyone experienced something like this?
Hi all,
For future reference, I solved this issue using the method showed in How to solve flashing problems in FRDM-RW612 (flash lock) - NXP Community.
I hope this helps.
Regards,
Daniel.
I ran into this same problem when working with FRDM-RW612 boards. I encountered this problem once and was able to reproduce it on another board. It seems that attempting to flash the 0x18000000-0x1FFFFFFF section using zephyr stops the board from being able to re-flashed.
Here are the steps I used to reproduce this problem:
west build -b frdm_rw612 "samples/hello_world"
west -v flash
Things I've tried to restore device to a usable state:
Hi,
I am having some dependency issues with the west flash command; I will try to solve them and test it.
Meanwhile, I tested using the J-Link command line to flash it, and the example is able to boot. Does this also happen on your side?
*** Booting Zephyr OS build v4.1.0-rc3-147-gfb4bb5d7688f ***
Hello World! frdm_rw612/rw612
Regards,
Daniel.
What commands did you use on the JLink command line? Essentially how Zephyr is trying to flash the board is by generating a JLink commander script file with the following contents (some path names removed).
Generated commander script file:
ExitOnError 1
r
LE
loadfile "<path_to_workspace>\build\zephyr\zephyr.bin" 0x18000000
r
g
writeDP 1 0
readDP 1
q
The command being run:
'C:\Program Files\SEGGER\JLink\JLink.exe' -nogui 1 -if swd -speed auto -device RW612 -CommanderScript '<the_commander_script_file>' -nogui 1
Hi,
For the J-Link CLI I used:
loadbin hello_world\build\zephyr\zephyr.bin 0x08000000
Hi,
Even on address 0x18000000 I didn't find any issue.
Please find my log down below.
PS C:\zephyrproject\zephyr\samples\hello_world> west build -bfrdm_rw612 --pristine
-- west build: making build dir C:\zephyrproject\zephyr\samples\hello_world\build pristine
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: C:/zephyrproject/zephyr/samples/hello_world
-- CMake version: 3.28.1
-- Found Python3: C:/Users/Daniel/AppData/Local/Programs/Python/Python311/python.exe (found suitable version "3.11.9", minimum required is "3.10") found components: Interpreter
-- Cache files will be written to: C:/zephyrproject/zephyr/.cache
-- Zephyr version: 4.1.0-rc3 (C:/zephyrproject/zephyr)
-- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
-- Board: frdm_rw612, qualifiers: rw612
-- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
-- Found host-tools: zephyr 0.17.0 (C:/Users/Daniel/zephyr-sdk-0.17.0)
-- Found toolchain: zephyr 0.17.0 (C:/Users/Daniel/zephyr-sdk-0.17.0)
-- Found Dtc: C:/Users/Daniel/.mcuxpressotools/dtc-msys2/tools/usr/bin/dtc.exe (found suitable version "1.6.1", minimum required is "1.4.6")
-- Found BOARD.dts: C:/zephyrproject/zephyr/boards/nxp/frdm_rw612/frdm_rw612.dts
-- Generated zephyr.dts: C:/zephyrproject/zephyr/samples/hello_world/build/zephyr/zephyr.dts
-- Generated pickled edt: C:/zephyrproject/zephyr/samples/hello_world/build/zephyr/edt.pickle
-- Generated devicetree_generated.h: C:/zephyrproject/zephyr/samples/hello_world/build/zephyr/include/generated/zephyr/devicetree_generated.h
-- Including generated dts.cmake file: C:/zephyrproject/zephyr/samples/hello_world/build/zephyr/dts.cmake
Parsing C:/zephyrproject/zephyr/Kconfig
Loaded configuration 'C:/zephyrproject/zephyr/boards/nxp/frdm_rw612/frdm_rw612_defconfig'
Merged configuration 'C:/zephyrproject/zephyr/samples/hello_world/prj.conf'
Configuration saved to 'C:/zephyrproject/zephyr/samples/hello_world/build/zephyr/.config'
Kconfig header saved to 'C:/zephyrproject/zephyr/samples/hello_world/build/zephyr/include/generated/zephyr/autoconf.h'
-- Found GnuLd: c:/users/Daniel/zephyr-sdk-0.17.0/arm-zephyr-eabi/arm-zephyr-eabi/bin/ld.bfd.exe (found version "2.38")
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/Users/Daniel/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
Load components for RW612:
driver_common component is included.
driver_reset component is included.
device_CMSIS component is included.
CMSIS_Include_core_cm component is included.
device_startup component is included.
driver_lpc_gpio component is included.
driver_pint component is included.
driver_inputmux component is included.
driver_inputmux_connections component is included.
driver_ostimer component is included.
driver_flexcomm component is included.
driver_flexcomm_usart component is included.
driver_cache_cache64 component is included.
component_osa_zephyr component is included from C:/zephyrproject/modules/hal/nxp/mcux/mcux-sdk/components/osa/set_component_osa.cmake.
-- Configuring done (14.4s)
-- Generating done (0.5s)
-- Build files have been written to: C:/zephyrproject/zephyr/samples/hello_world/build
-- west build: building application
[1/147] Generating include/generated/zephyr/version.h
-- Zephyr version: 4.1.0-rc3 (C:/zephyrproject/zephyr), build: v4.1.0-rc3-147-gfb4bb5d7688f
[147/147] Linking C executable zephyr\zephyr.elf
Memory region Used Size Region Size %age Used
FLASH: 27912 B 64 MB 0.04%
RAM: 6952 B 960 KB 0.71%
SMU1: 510 KB 510 KB 100.00%
SMU2: 140 KB 140 KB 100.00%
IDT_LIST: 0 GB 32 KB 0.00%
Generating files from C:/zephyrproject/zephyr/samples/hello_world/build/zephyr/zephyr.elf for board: frdm_rw612
PS C:\zephyrproject\zephyr\samples\hello_world>
PS C:\zephyrproject\zephyr\samples\hello_world> west -v flash
-- west flash: rebuilding
cmake version 3.28.1 is OK; minimum version is 3.13.1
Running CMake: 'C:\Users\Daniel\.mcuxpressotools\cmake-3.28.1-windows-x86_64\bin\cmake.EXE' --build 'C:\zephyrproject\zephyr\samples\hello_world\build'
ninja: no work to do.
-- west flash: using runner jlink
-- runners.jlink: reset after flashing requested
runners.jlink: JLINKARM_GetDLLVersion()=79603
-- runners.jlink: JLink version: 7.96c
runners.jlink: JLink commander script:
ExitOnError 1
r
LE
loadfile "C:\zephyrproject\zephyr\samples\hello_world\build\zephyr\zephyr.bin" 0x18000000
r
g
writeDP 1 0
readDP 1
q
-- runners.jlink: Flashing file: C:\zephyrproject\zephyr\samples\hello_world\build\zephyr\zephyr.bin
runners.jlink: 'C:\Program Files\SEGGER\JLink\JLink.exe' -nogui 1 -if swd -speed auto -device RW612 -CommanderScript 'C:\Users\Daniel\AppData\Local\Temp\tmp4uj63qihjlink\runner.jlink' -nogui 1
SEGGER J-Link Commander V7.96c (Compiled Apr 2 2024 12:35:23)
DLL version V7.96c, compiled Apr 2 2024 12:34:28
J-Link Command File read successfully.
Processing script file...
J-Link>ExitOnError 1
J-Link Commander will now exit on Error
J-Link>r
J-Link connection not established yet but required for command.
Connecting to J-Link via USB...O.K.
Firmware: J-Link MCU-Link V1 compiled Oct 9 2024 11:01:41
Hardware version: V1.00
J-Link uptime (since boot): 0d 00h 10m 38s
S/N: 1060061514
USB speed mode: High speed (480 MBit/s)
VTref=3.300V
Target connection not established yet but required for command.
Device "RW612" selected.
Connecting to target via SWD
InitTarget() start
SWD selected. Executing JTAG -> SWD switching sequence.
DAP initialized successfully.
DMAP_REG_ID: DM-AP IDCODE detected: 0x002A0000
DHCSR: 0xFFFFFFFF
ROM entered ISP command handling loop. Re-enable the debug access.
InitTarget() end - Took 22.1ms
Found SW-DP with ID 0x6BA02477
DPIDR: 0x6BA02477
CoreSight SoC-400 or earlier
Scanning AP map to find all available APs
AP[1]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x84770001)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410FD214. Implementer code: 0x41 (ARM)
Feature set: Mainline
Cache: No cache
Found Cortex-M33 r0p4, Little endian.
FPUnit: 8 code (BP) slots and 0 literal slots
Security extension: implemented
Secure debug: enabled
CoreSight components:
ROMTbl[0] @ E00FF000
[0][0]: E000E000 CID B105900D PID 000BBD21 DEVARCH 47702A04 DEVTYPE 00 Cortex-M33
[0][1]: E0001000 CID B105900D PID 000BBD21 DEVARCH 47701A02 DEVTYPE 00 DWT
[0][2]: E0002000 CID B105900D PID 000BBD21 DEVARCH 47701A03 DEVTYPE 00 FPB
[0][3]: E0000000 CID B105900D PID 000BBD21 DEVARCH 47701A01 DEVTYPE 43 ITM
[0][5]: E0041000 CID B105900D PID 002BBD21 DEVARCH 47724A13 DEVTYPE 13 ETM
[0][6]: E0042000 CID B105900D PID 000BBD21 DEVARCH 47701A14 DEVTYPE 14 CSS600-CTI
Memory zones:
Zone: "Default" Description: Default access mode
Cortex-M33 identified.
Reset delay: 0 ms
Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
ResetTarget() start
Reset via SYSRESETREQ and reset pin + halt after bootloader
ROM entered ISP command handling loop. Re-enable the debug access.
MSPLIM cleared
ResetTarget() end - Took 134ms
J-Link>LE
J-Link>loadfile "C:\zephyrproject\zephyr\samples\hello_world\build\zephyr\zephyr.bin" 0x18000000
'loadfile': Performing implicit reset & halt of MCU.
ResetTarget() start
Reset via SYSRESETREQ and reset pin + halt after bootloader
ROM entered ISP command handling loop. Re-enable the debug access.
MSPLIM cleared
ResetTarget() end - Took 123ms
Downloading file [C:\zephyrproject\zephyr\samples\hello_world\build\zephyr\zephyr.bin]...
Comparing flash [100%] Done.
Erasing flash [100%] Done.
Programming flash [100%] Done.
Verifying flash [100%] Done.
J-Link: Flash download: Bank 1 @ 0x18000000: 1 range affected (65536 bytes)
J-Link: Flash download: Total: 1.116s (Prepare: 0.280s, Compare: 0.106s, Erase: 0.268s, Program: 0.216s, Verify: 0.110s, Restore: 0.132s)
J-Link: Flash download: Program speed: 296 KB/s
O.K.
J-Link>r
Reset delay: 0 ms
Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
ResetTarget() start
Reset via SYSRESETREQ and reset pin + halt after bootloader
MSPLIM cleared
ResetTarget() end - Took 155ms
J-Link>g
Memory map 'after startup completion point' is active
J-Link>writeDP 1 0
Writing DP register 1 = 0x00000000 (0 write repetitions needed)
J-Link>readDP 1
Reading DP register 1 = 0x00000040 (0 read repetitions needed)
J-Link>q
Script processing completed.
PS C:\zephyrproject\zephyr\samples\hello_world>
Regards,
Danie
Weird, I don't know what is so different about my setup...
How is your board connected to your computer? Are you using USB/MCULink or an external JLink debugger? Also which jumpers are set?
I am plugged into the MCULink port via USB-C with jumpers JP4 and JP9 set.
Hi,
Only JP4 and JP9 are connected. I am using MCU-Link debugger.
By any chance, did you flash an RD-RW612-BGA binary to the FRDM-RW612 before?
Regards,
Daniel.
I do not believe so although it is possible since I do have RD-RW612-BGA projects on my computer.
If that were to be what happened, how would I go about recovering the device to get it re-flashable?
Hi,
I encountered with a similar problem when flashing an RD-RW612-BGA Zephyr example into the FRDM and then re-flashing a different FRDM-RW612 binary into the FRDM board.
****** Error: Verification failed @ address 0x18000000
Error while programming flash: Verify failed.
The board will no longer respond after this. Not even using MCUXpesso IDE.
I managed to bring up my board using MCUXpresso Secure Provisioning Tool.
I set my board in ISP mode and flashed an example app (C:\nxp\MCUX_Provi_v9\bin\_internal\data\sample_data\targets\RW612\source_images\frdmrw612_gpio_led_output.s19). After this, I was able to re-flash my board with the correct FRDM Zephyr example.
I hope this helps.
Regards.
Daniel.
UPDATE:
I just solve the dependency issues. I am able to flash using west flash without problem.
hello world.
hello world.
hello world.
hello world.
hello world.
hello world.
*** Booting Zephyr OS build v4.1.0-rc3-147-gfb4bb5d7688f ***
Hello World! frdm_rw612/rw612
Flash log:
C:\zephyrproject\zephyr\samples\hello_world>west flash
-- west flash: rebuilding
ninja: no work to do.
-- west flash: using runner jlink
-- runners.jlink: reset after flashing requested
-- runners.jlink: JLink version: 7.96c
-- runners.jlink: Flashing file: C:\zephyrproject\zephyr\samples\hello_world\build\zephyr\zephyr.bin
C:\zephyrproject\zephyr\samples\hello_world>
For those that can't use the west flash command, I did the following:
pip install -U -r scripts\requirements.txt
Regards,
Daniel.
Here is a list of all the boot registers/fuses
shadowregs -i jlink -f rw612 printregs
# Interface Id Description
-------------------------------------------------------
0 Jlink 1066319194 Segger J-Link MCU-Link
Register Name: LOCK_CFG0
Register value: 0x2000
Register raw value: 0x2000
Register Name: LOCK_CFG1
Register value: 0x0000
Register raw value: 0x0000
Register Name: LOCK_CFG2
Register value: 0x000B
Register raw value: 0x000B
Register Name: BOOT_CFG0
Register value: 0x00000000
Register raw value: 0x00000000
Register Name: BOOT_CFG1
Register value: 0x00000000
Register raw value: 0x00000000
Register Name: BOOT_CFG2
Register value: 0x00000000
Register raw value: 0x00000000
Register Name: BOOT_CFG3
Register value: 0x00000000
Register raw value: 0x00000000
Register Name: BOOT_CFG4
Register value: 0x00000000
Register raw value: 0x00000000
Register Name: BOOT_CFG5
Register value: 0x00000000
Register raw value: 0x00000000
Register Name: BOOT_CFG6
Register value: 0x00000000
Register raw value: 0x00000000
Register Name: SEC_BOOT_CFG0
Register value: 0x0000
Register raw value: 0x0000
Register Name: SEC_BOOT_CFG1
Register value: 0x0000
Register raw value: 0x0000
Register Name: SEC_BOOT_CFG2
Register value: 0x0000
Register raw value: 0x0000
Register Name: SEC_BOOT_CFG3
Register value: 0x0000
Register raw value: 0x0000
Register Name: SEC_BOOT_CFG4
Register value: 0x0000
Register raw value: 0x0000
Register Name: SEC_BOOT_CFG5
Register value: 0x00000000
Register raw value: 0x00000000
Register Name: SEC_BOOT_CFG6
Register value: 0x00000000
Register raw value: 0x00000000
Register Name: SEC_BOOT_CFG7
Register value: 0x00000000
Register raw value: 0x00000000
Register Name: SEC_BOOT_CFG8
Register value: 0x00000000
Register raw value: 0x00000000
Register Name: DCFG_CC_SOCU_NS
Register value: 0x00000000
Register raw value: 0x00000000
Register Name: DCFG_CC_SOCU
Register value: 0x00000000
Register raw value: 0x00000000
Register Name: LIFE_CYCLE_STATE
Register value: 0x0303
Register raw value: 0x0303
Register Name: CUST_SK_MK[31:0]
Register value: 0x00000000
Register raw value: 0x00000000
Register Name: CUST_SK_MK[63:32]
Register value: 0x00000000
Register raw value: 0x00000000
Register Name: CUST_SK_MK[95:64]
Register value: 0x00000000
Register raw value: 0x00000000
Register Name: CUST_SK_MK[127:96]
Register value: 0x00000000
Register raw value: 0x00000000
Register Name: CUST_SK_MK[159:128]
Register value: 0x00000000
Register raw value: 0x00000000
Register Name: CUST_SK_MK[191:160]
Register value: 0x00000000
Register raw value: 0x00000000
Register Name: CUST_SK_MK[223:192]
Register value: 0x00000000
Register raw value: 0x00000000
Register Name: CUST_SK_MK[255:224]
Register value: 0x00000000
Register raw value: 0x00000000
Register Name: CUST_SK_MK[287:256]
Register value: 0x00000000
Register raw value: 0x00000000
Register Name: CUST_SK_MK[319:288]
Register value: 0x00000000
Register raw value: 0x00000000
Register Name: CUST_SK_MK[351:320]
Register value: 0x00000000
Register raw value: 0x00000000
Register Name: CUST_SK_MK[383:352]
Register value: 0x00000000
Register raw value: 0x00000000
Register Name: RKTH
Register value: 0000000000000000000000000000000000000000000000000000000000000000
Register raw value: 0000000000000000000000000000000000000000000000000000000000000000
Hi,
I haven't seen a similar problem before.
Are you able to execute a mass erase?
Regards,
Daniel.
Hi, yes.
In theory, yes. Mass erase works, at least the command doesn't fail.
However, it doesn't seem to do anything.
Any other idea? We have a few more boards but are a bit afraid to test it out due to the instability state of this board.
Hi,
Are you able to execute a mass erase from MCUXpresso?
Regards,
Daniel.
Yes. The program finishes the mass erase process but doesn't change anything, I still can't flash.
Another update.
I built a binary and skipped the validation (L2, the one causing the error). The board flashes BUT, it still doesn't run properly.
So, I downloaded (through Jlink save bbin command) the flashed program inside the rw612. It matches the one I tried to flash sniping the verification. So, my guess now is that the Bootloader (boot ROM) is pointing to the secure area (0x1800_0000) instead of pointing to the non-secure area (0x0800_0000). This guess gains traction with the fact the the default zephyr configuration has the following options:
CONFIG_ARM_MPU=y
CONFIG_HW_STACK_PROTECTION=y
CONFIG_TRUSTED_EXECUTION_SECURE=y