Adafruit-nrfutil issues

Hi,

I’m trying to convert a RAK4631-R to RAK4631 (i could only order the -R at some stage here in the UK).

Now, i’ve seen a few guides that all use adafruit-nrfutil and for me (under linux) they don’t seem to work.
I’ve now also noticed that i can’t use adafruit-nrfutil to flash normal firmware onto the RAK4631 that i already had.

Here’s the output from adafruit-nrfutil:

$ adafruit-nrfutil --verbose dfu serial -p /dev/ttyACM0  -fc -sb  -pkg ~/dev/RAKTracker/.pio/build/RAK4631/firmware.zip
Upgrading target on /dev/ttyACM0 with DFU package /home/cyclops/dev/RAKTracker/.pio/build/RAK4631/firmware.zip. Flow control is enabled, Single bank, Touch disabled
Opened serial port /dev/ttyACM0
Starting DFU upgrade of type 4, SoftDevice size: 0, bootloader size: 0, application size: 346056
Sending DFU start packet
Timed out waiting for acknowledgement from device.

Failed to upgrade target. Error is: No data received on serial port. Not able to proceed.
Traceback (most recent call last):
  File "/home/cyclops/dev/adafruit-nrfutil/lib/python3.13/site-packages/nordicsemi/__main__.py", line 296, in serial
    dfu.dfu_send_images()
    ~~~~~~~~~~~~~~~~~~~^^
  File "/home/cyclops/dev/adafruit-nrfutil/lib/python3.13/site-packages/nordicsemi/dfu/dfu.py", line 235, in dfu_send_images
    self._dfu_send_image(HexType.APPLICATION, self.manifest.application)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cyclops/dev/adafruit-nrfutil/lib/python3.13/site-packages/nordicsemi/dfu/dfu.py", line 199, in _dfu_send_image
    self.dfu_transport.send_start_dfu(program_mode, softdevice_size, bootloader_size,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                      application_size)
                                      ^^^^^^^^^^^^^^^^^
  File "/home/cyclops/dev/adafruit-nrfutil/lib/python3.13/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 179, in send_start_dfu
    self.send_packet(packet)
    ~~~~~~~~~~~~~~~~^^^^^^^^
  File "/home/cyclops/dev/adafruit-nrfutil/lib/python3.13/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 243, in send_packet
    ack = self.get_ack_nr()
  File "/home/cyclops/dev/adafruit-nrfutil/lib/python3.13/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 282, in get_ack_nr
    raise NordicSemiException("No data received on serial port. Not able to proceed.")
nordicsemi.exceptions.NordicSemiException: No data received on serial port. Not able to proceed.

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.

From platformio, i can flash the device, and the output looks like this:

Building in release mode
MethodWrapper(["checkprogsize"], [".pio/build/RAK4631/firmware.elf"])
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]  10.9% (used 27100 bytes from 248832 bytes)
Flash: [====      ]  42.5% (used 346056 bytes from 815104 bytes)
.pio/build/RAK4631/firmware.elf  :
section             size        addr
.text             344488      155648
.ARM.exidx             8      500136
.data               1560   536895488
.bss               25540   536897048
.heap             208420   536922588
.ARM.attributes       50           0
.comment             126           0
.debug_frame       84148           0
.stab                180           0
.stabstr             439           0
Total             664959
<lambda>(["upload"], [".pio/build/RAK4631/firmware.zip"])
AVAILABLE: jlink, nrfjprog, nrfutil, stlink
CURRENT: upload_protocol = nrfutil
BeforeUpload(["upload"], [".pio/build/RAK4631/firmware.zip"])
Auto-detected: /dev/ttyACM0
Forcing reset using 1200bps open/close on port /dev/ttyACM0
Waiting for the new upload port...
"/home/cyclops/.platformio/penv/bin/python" "/home/cyclops/.platformio/packages/tool-adafruit-nrfutil/adafruit-nrfutil.py" dfu serial -p /dev/ttyACM0 -b 115200 --singlebank -pkg .pio/build/RAK4631/firmware.zip
Upgrading target on /dev/ttyACM0 with DFU package /home/cyclops/dev/RAKTracker/.pio/build/RAK4631/firmware.zip. Flow control is disabled, Single bank, Touch disabled
########################################
########################################
########################################
########################################
########################################
########################################
########################################
########################################
########################################
########################################
########################################
########################################
########################################
########################################
########################################
########################################
####################################
Activating new firmware
Device programmed.
================================================================================== [SUCCESS] Took 23.25 seconds ==================================================================================

Even if i just run "/home/cyclops/.platformio/penv/bin/python" "/home/cyclops/.platformio/packages/tool-adafruit-nrfutil/adafruit-nrfutil.py" dfu serial -p /dev/ttyACM0 -b 115200 --singlebank -pkg .pio/build/RAK4631/firmware.zip outside of platformio, this doesn’t work (same output as first code block in this post).

The key difference seems to be: Forcing reset using 1200bps open/close on port /dev/ttyACM0

This makes a lot of sense to me, as the device wouldn’t be waiting for firmware or be in DFU mode, although adafruit-nrfutil seems to try to do that too.

Is there a way to ‘forcing reset using 1200bps open/close on port /dev/ttyACM0’ via a different command?

If your RAK4631 has at the moment a RUI3 bootloader (That’s standard with RAK4631-R), adafruit-nrfutil does not work.
You need to use the nrfutil application. You can download Linux, MacOS and Windows version from Nordics Github

Did you try to follow our guide Converting RAK4631-R to RAK4631

Just to clarify - even if i have a normal RAK4631 than it has that bootloader? Or only the -R version?

One of the devices responds to AT+VER=? and the other doesn’t.

RAK4631-R needs nrfutil application
RAK4631 needs adafruit-nrfutil application

AT+VER=? works
a) with RUI3 bootloader AND RUI3 firmware
b) with Arduino bootloader AND a working application that implements AT command support, e.g. applications that use the WisBlock-API library.
c) does not work on “simple” Arduino applications

What do you get as response on AT+VER=?

I’ve got two devices:

  1. responds to AT+VER=? with the version number (and this is the RAK4631-R, so that makes sense)
  2. A RAK4631 purchased which has a simple arduino application an does not respond to AT commands.

I understand that nr 1 will require nrfutil to replace the bootloader, but should nr 2 work with the adafruit-nrfutil outside of platformio?

The RAK4631-R’s response to AT+VER=?:

AT+VER=RUI_4.0.6_RAK4631
OK

I understand that nr 1 will require nrfutil to replace the bootloader, but should nr 2 work with the adafruit-nrfutil outside of platformio?

Correct, if they have a working bootloader.

If the bootloader is messed up, which happens occasionally when using the wrong tools, the only way to recover the device is JLink or a DAPLink tool and flash it over the SWD interface.

I’ve managed to flash RAK4631_latest_dfu_package.zip onto the RAK4631-R and now it’s showing up as a storage device.
none of the tools now work :slight_smile:
i’m used to the RP2040 doing this, so do i need to start the device in a special way?

I either need to spend more time reading RAK4631-R WisBlock LoRaWAN Module DFU | Firmware & Bootloader Update or the instructions are not 100% great :slight_smile:

How is the latest_dfu_package.zip different from the 3 files mentioned here: RAK4631-R WisBlock LoRaWAN Module DFU | Firmware & Bootloader Update

And, next to the bootloader (which i’m assuming is what boots the RAK4630), what does the softdevice do?

Just to be clear, this is the info_uf2.txt that’s now on the mass storage device:

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

so it feels like i’m on the right bootloader and softdevice, but i can’t use adafruit-nrfutil or platformio to flash the things.

OK, so i tried another one and that conversion from RAK4631-R to RAK4631 worked and i’m up and running.

I’m not sure what failed with the other device. ALso wondering how important the SoftDevice version is?

The other one that didn’t work - i tried some other things and now it’s bricked :frowning:
There’s no way to get that back using a FT232H is there?

The Softdevice is some closed code from Nordic, mainly for Bluetooth, but without it, the device does simply not work.

If bricked, the only way to recover the device is JLink or a DAPLink tool and flash it over the SWD interface.