Unable to flash RAK4631

I bought the RAK4631 WisMesh combo from my local supplier as it was cheaper than the RAK4631 + Base Board separately, but I don’t wish to use Meshtastic, so I’m trying to upload my own code.

I double clicked the base board button and the drive popped up in file explorer. I built a .uf2 file using PlatformIO following the guide. I then dragged this file into the drive and it uploaded, but it didn’t run as expected on the board (it was a blink example). Instead, the green LED started fading in and out, and the blue LED flashes every ~500ms.

Right now, the board has three distinct states.

  1. Upon turning on, the red LED is on, and no others. No COM device is detected.
  2. When the base board button is clicked once, the green LED fades in and out, and the blue LED flashes every ~500ms. No COM device is detected.
  3. When clicking the button again, the blue LED stops flashing, but the green LED still fades. The drive shows up in file explorer and it shows up as a COM device.

I’ve tried following the guide for reverting the RAK4631-R to the Arduino BSP, but because I can’t send AT commands to the board, I can’t get it into boot mode.

I’ve also tried using OpenOCD with an STLink. I think I’m able to connect to it, but I can’t really get anything to work.

C:\Users\liamb>openocd -f "interface/stlink-dap.cfg" -c "transport select dapdirect_swd; source [find target/nrf52.cfg]; init"
xPack Open On-Chip Debugger 0.12.0+dev-02228-ge5888bda3-dirty (2025-10-04-22:44)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
WARNING: interface/stlink-dap.cfg is deprecated, please switch to interface/stlink.cfg
Warn : DEPRECATED! use 'transport select swd', not 'transport select dapdirect_swd'
WARNING: 'target/nrf52.cfg' is deprecated, use 'target/nordic/nrf52.cfg' instead
Info : STLINK V3J16M9 (API v3) VID:PID 0483:3754
Info : Target voltage: 3.309018
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x2ba01477
Error: [nrf52.cpu] Examination failed
Warn : target nrf52.cpu examination failed
Info : [nrf52.cpu] starting gdb server on 3333
Info : Listening on port 3333 for gdb connections
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : accepting 'telnet' connection on tcp/4444

> nrf52_recover
C:/OpenOCD/bin/../openocd/scripts/target/nordic/nrf52.cfg:86: Error:
Traceback (most recent call last):
  File "C:/OpenOCD/bin/../openocd/scripts/target/nordic/nrf52.cfg", line 86, in nrf52_recover
    {nrf52.dap apreg} 1 4 0

> init
> reset_config srst_only srst_nogate connect_assert_srst
> nrf5 mass_erase
Error: Target not examined yet
Error: Target not examined yet
Error: Target not examined yet
Error: Target not examined yet
Error: Couldn't read FICR CONFIGID register
Error: auto_probe failed

> init
> reset halt
> nrf5 mass_erase
Error: [nrf52.cpu] Examination failed
Info : [nrf52.cpu] AP write error, reset will not halt
TARGET: nrf52.cpu - Not examined
Info : dropped 'telnet' connection

Thanks :slight_smile:

Welcome to the forum @Liam827

What exact RAK4631 did you buy? There are two variants:

  1. RAK4631 with Arduino Bootloader
  2. RAK4631-R with RUI3 Bootloader

If double-reset to get into UF2/DFU mode worked, then you have the first one, RAK4631.

Converting to RUI3 bootloader requires that after the conversion, you have to use a different Arduino BSP, which is different from the “normal” Arduino nRF52 BSP and it will not work with PlatformIO.

STLink might not work with Nordic MCU’s, but I never tried that. Usually I use a DAPLink or (safer) a JLink adapter and JFlash (expensive).
Why didn’t you try to flash through the USB, as this is supported by PlatformIO?

Is your device still in a state where a double push puts it into DUF/UF2 mode?
If yes, keep it in that state, then flash your firmware through USB directly from PlatformIO.

If double push doesn’t work anymore, you have most likely messed up the bootloader and/or the softdevice part. Then recovery will be not so easy.

Hi,
this is the link for the exact product I bought. It says it comes pre flashed with Meshtastic firmware, so I’m not sure if it aligns with the Arduino BSP or the RUI3 version.

I am still able to get the device into UF2 mode, which as I said before is the only of the 3 states that shows a COM device. When I try to flash anything to this COM using PlatformIO or Arduino IDE it errors. This is the error when trying PlatformIO:

Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   3.3% (used 8220 bytes from 248832 bytes)
Flash: [=         ]   5.7% (used 46640 bytes from 815104 bytes)
Building Generated\WisBlock_SENS_V1.0.11_2026.04.10.20.47.29.zip
Zip created at Generated\WisBlock_SENS_V1.0.11_2026.04.10.20.47.29.zip
Configuring upload protocol...
AVAILABLE: jlink, nrfjprog, nrfutil, stlink
CURRENT: upload_protocol = nrfutil
Looking for upload port...
Using manually specified: COM8
Forcing reset using 1200bps open/close on port COM8
Waiting for the new upload port...
Uploading Generated\WisBlock_SENS_V1.0.11_2026.04.10.20.47.29.zip
Upgrading target on COM8 with DFU package C:\Users\liamb\CLionProjects\BreezeSensor\Generated\WisBlock_SENS_V1.0.11_2026.04.10.20.47.29.zip. Flow control is disabled, Single bank, Touch disabled

Failed to upgrade target. Error is: ClearCommError failed (PermissionError(13, 'The device does not recognize the command.', None, 22))
Traceback (most recent call last):
  File "C:\Users\liamb\.platformio\packages\tool-adafruit-nrfutil\site-packages\nordicsemi\__main__.py", line 296, in serial
    dfu.dfu_send_images()
    ~~~~~~~~~~~~~~~~~~~^^
  File "C:\Users\liamb\.platformio\packages\tool-adafruit-nrfutil\site-packages\nordicsemi\dfu\dfu.py", line 235, in dfu_send_images
    self._dfu_send_image(HexType.APPLICATION, self.manifest.application)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\liamb\.platformio\packages\tool-adafruit-nrfutil\site-packages\nordicsemi\dfu\dfu.py", line 203, in _dfu_send_image
    self.dfu_transport.send_init_packet(init_packet)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "C:\Users\liamb\.platformio\packages\tool-adafruit-nrfutil\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 155, in send_init_packet
    self.send_packet(packet)
    ~~~~~~~~~~~~~~~~^^^^^^^^
  File "C:\Users\liamb\.platformio\packages\tool-adafruit-nrfutil\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 243, in send_packet
    ack = self.get_ack_nr()
  File "C:\Users\liamb\.platformio\packages\tool-adafruit-nrfutil\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 264, in get_ack_nr
    temp = [x for x in self.serial_port.read(6)]
                       ~~~~~~~~~~~~~~~~~~~~~^^^
  File "C:\Users\liamb\.platformio\packages\tool-adafruit-nrfutil\site-packages\serial\serialwin32.py", line 275, in read
    raise SerialException("ClearCommError failed ({!r})".format(ctypes.WinError()))
serial.serialutil.SerialException: ClearCommError failed (PermissionError(13, 'The device does not recognize the command.', None, 22))

Possible causes:
- Selected Bootloader version does not match the one on Bluefruit device.
    Please upgrade the Bootloader or select correct version in Tools->Bootloader.
- Baud rate must be 115200, Flow control must be off.
- Target is not in DFU mode. Ground DFU pin and RESET and release both to enter DFU mode.
======================================================================================================================================== [SUCCESS] Took 24.27 seconds ========================================================================================================================================

Environment    Status    Duration
-------------  --------  ------------
rak4630        SUCCESS   00:00:24.267
======================================================================================================================================== 1 succeeded in 00:00:24.267 ========================================================================================================================================

Again, this is the only time a COM port shows, and when I try to send AT commands to it (using CoolTerm or RakSerialPortTool) I get nothing back.

Appreciate the quick response Bernd :slight_smile:

UF2 Bootloader 0.4.3
Model: WisBlock RAK4631 Board
Board-ID: WisBlock-RAK4631-Board
Date: May 20 2023
Ver: 0.4.3
SoftDevice: not found

Also this is the INFO_UF2.TXT file if that means anything
Additionally, I bought 2 of these boards, and the other one I haven’t touched yet, if you need a reference

This is the problem. Somehow the SoftDevice was erased.

Please download the wiscore_rak4631_board_bootloader-0.4.3_s140_6.1.1.uf2 file from our WisBlock repo and flash it first.
Then try again to flash your firmware.

After downloading the .uf2 file and drag and dropping it into the drive, the INFO_UF2.TXT still shows SoftDevice: not found.

Would an nrf52 compatible probe be able to fix this - I’ve been contemplating buying one. If there isn’t anything else I can do, could you recommend me some?

wiscore_rak4631_board_bootloader-0.4.3_s140_6.1.1.uf2
does include the bootloader and the Softdevice. Not sure why it didn’t work.

I don’t know what you mean with “nrf52 compatible probe”.
I am using JLink or DAPLink to recover nRF52 based MCU’s.

Would the RAKDAP1 100% be able to be used to fix the issue, or should I invest in something pricier like a JLink?

DAPlink should work, it uses the same SWD interface that JLink uses.
Just not as reliable, I often get connection errors.
You can have a look for the setup and usage here

Okay. Thanks for the help Bernd

Hi, I received my RAKDAP1 and tried flashing wiscore_rak4631_board_bootloader-0.4.3.hex, and it successfully flashed, but the device doesn’t boot or anything. Pressing the core board button once or twice doesn’t enter UF2 mode and the device doesn’t show up in Device Manager even after disconnecting and reconnecting power.

C:\Users\liamb>pyocd list
  #   Probe/Board                Unique ID                                          Target
---------------------------------------------------------------------------------------------------
  0   ARM CMSIS-DAP-v1-MuseLab   07000001007700444e00000956304750a5a5a5a597969908   ✖︎ stm32f103rb
      NUCLEO-F103RB

C:\Users\liamb>pyocd erase --chip -t nrf52840
0000735 I Erasing chip... [eraser]
0001161 I Chip erase complete [eraser]

C:\Users\liamb>pyocd flash -t nrf52840 "C:\Users\liamb\Downloads\wiscore_rak4631_board_bootloader-0.4.3.hex"
0000748 I Loading C:\Users\liamb\Downloads\wiscore_rak4631_board_bootloader-0.4.3.hex [load_cmd]
0000763 I Erasing... [loader]
[==================================================] 100%
0001937 I Programming... [loader]
[==================================================] 100%
0003276 I Erased 37888 bytes (10 sectors), programmed 37888 bytes (10 pages), skipped 0 bytes (0 pages) at 14.73 kB/s [loader]

C:\Users\liamb>pyocd cmd -t nrf52840
Connected to NRF52840 [Lockup]: 07000001007700444e00000956304750a5a5a5a597969908
pyocd> reset
Resetting target
pyocd> halt
Successfully halted device
pyocd> reg
general registers:
      lr: 0xfffffff9                 r2: 0x00000000 (0)             r6: 0x00000000 (0)            r10: 0x00000000 (0)           xpsr: 0x01000003 (16777219)
      pc: 0xfffffffe                 r3: 0x00000000 (0)             r7: 0x00000000 (0)            r11: 0x00000000 (0)
      r0: 0x00000000 (0)             r4: 0x00000000 (0)             r8: 0x00000000 (0)            r12: 0x00000000 (0)
      r1: 0x00000000 (0)             r5: 0x00000000 (0)             r9: 0x00000000 (0)             sp: 0xffffffd8
pyocd> exit

You need to flash the bootloader and the softdevice to get a working USB port.
Try to flash the HEX file from the attached WisBlock-Backup.zip.
WisBlock-Backup.zip (742.0 KB)

I’m able to flash the board now. Thanks for the help Bernd, really appreciate it