Can't program RAK4630 with Arduino nor nrfutil

Hi,

I’m working on a project using RAK4630, supposed to be programmable via Arduino. I followed this guide getting started : RAK4630 WisDuo LPWAN+BLE Module | RAKwireless Documentation Center

Problem is I can’t program anything on it.

At first, I was able to configure it in Arduino IDE, found the package for the board, installed it, tried to compile some examples, etc. But i was not able to upload the program, it was always telling me “LIBUSB_ERROR_ACCESS: Unable to connect to trigger interface” and could not use.

I managed to communicate with the board, and the AT+VER=? command gave me the version number. But, the AT+BOOT command returned an error message.

After that, I tried to go through nrfutil, following topics that talked about updating the bootloader and/or firmware.

I followed this topic to flash a new bootloader and since then it’s been even worse. I can’t get anything out of the card, I can’t even exchange AT commands with it and I can’t reflash anything on it.

Nrfutil gives me that answer (I am on Ubuntu 20.04.6 LTS) :

nrfutil dfu serial -p /dev/ttyACM0 -pkg RAK4631_latest_dfu_package.zip 
Upgrading target on /dev/ttyACM0 with DFU package /home/nicolas/Téléchargements/RAK4630/RAK4631/Image/RAK4631_latest_dfu_package.zip. Flow control is disabled, Dual bank, Touch disabled
Timed out waiting for acknowledgement from device.

Failed to upgrade target. Error is: Attempting to use a port that is not open
Traceback (most recent call last):
  File "/home/nicolas/.local/lib/python3.8/site-packages/nordicsemi/__main__.py", line 296, in serial
    dfu.dfu_send_images()
  File "/home/nicolas/.local/lib/python3.8/site-packages/nordicsemi/dfu/dfu.py", line 235, in dfu_send_images
    self._dfu_send_image(HexType.APPLICATION, self.manifest.application)
  File "/home/nicolas/.local/lib/python3.8/site-packages/nordicsemi/dfu/dfu.py", line 203, in _dfu_send_image
    self.dfu_transport.send_init_packet(init_packet)
  File "/home/nicolas/.local/lib/python3.8/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 155, in send_init_packet
    self.send_packet(packet)
  File "/home/nicolas/.local/lib/python3.8/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 241, in send_packet
    self.serial_port.write(bytearray(pkt.data))
  File "/home/nicolas/.local/lib/python3.8/site-packages/serial/serialposix.py", line 615, in write
    raise PortNotOpenError()
serial.serialutil.PortNotOpenError: Attempting to use a port that is not open

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.

And dmesg, for information, gives me that answer :

[12837.259845] cdc_acm 3-2:1.0: ttyACM0: USB ACM device
[12956.797230] usb 3-2: USB disconnect, device number 54
[12957.296379] usb 3-2: new full-speed USB device number 55 using xhci_hcd
[12957.469784] usb 3-2: New USB device found, idVendor=1915, idProduct=521f, bcdDevice= 1.00
[12957.469798] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[12957.469805] usb 3-2: Product: Open DFU Bootloader
[12957.469811] usb 3-2: Manufacturer: Nordic Semiconductor
[12957.469817] usb 3-2: SerialNumber: C514B0AA1531
[12957.502742] cdc_acm 3-2:1.0: ttyACM0: USB ACM device

What is wrong? How can I fix it?

Welcome to the forum @nsanagustin

First question, are you using a RAK4630 on a custom PCB or are you using the WisBlock RAK4631 Core module?

As it is not clear at this time whether you have an Arduino Bootloader or a RUI3 Bootloader flashed, can you try (assuming you are using a WisBlock system)

(1) While connected over USB to your computer, double push the reset button. If doing so, do you get an external drive named RAK4631 on your computer. If yes, you have an Arduino Bootloader

(2) While connected over USB to your computer, send from a serial terminal the command “AT+VER=?\r\n” (the CR/LF at the end is important). If you get a response to this, you have an RUI3 Bootloader.

What do you want to use for your application? RUI3 API BSP or the Arduino BSP?

Hi.

Thanks for your answer.

(1) I don’t get external drive after double clicking RESET. But It might be because I don’t get anything at all from the chip anymore and I didn’t know about that trick before the incident.
(2) Before the incident, I was able to send “AT+VER=?” and get a response from it. Now, I get nothing at all…

Visually, it looks like the first module, but soldered on the second board. Its tag says 4630 (IC: 25908-RAK4630). Behind it, I can read “www.RAKwireless.com” and “RAK4631 V2.0” so I get it is the second one.
If that can help, when I got it, it was screwed on a WisBlock board (RAK19007 Ver. C), provided with a WisBlock Kit 2 (this one).
For what I can say from the last table, it looks like the bootloader was RUI3, for I was able to exchange AT commands with it.

At the moment, I get no answer from the board, not by double clicking the Reset button, nor by sending AT commands, nor by forcing BOOT state with the UART2_TX and RESET to the ground.

I just want to set it back to its original state. So, what can I do ?

This “forcing BOOT state with the UART2_TX and RESET to the ground” is not possible with either RUI3 nor Arduino bootloader.
“Double Click Reset” is only working on the Arduino Bootloader.

You are still getting an USB port when you connect to a PC, is this correct? If yes, what is the name that UBUNTU shows?

In your earlier log I see

Failed to upgrade target. Error is: Attempting to use a port that is not open
...
serial.serialutil.PortNotOpenError: Attempting to use a port that is not open

That is strange, is there anything else that was connected? A serial terminal e.g.?

You could try:
(1) Use nrfutil and retry to flash the RAK4631_latest_dfu_package.zip again, make sure to use the correct USB port and other application open
(2) Use adafruit-nrfutil and try to re-flash the Arduino bootloader and Softdevice

  • adafruit-nrfutil --verbose dfu serial --package rak4631_factory_bootloader.zip.zip.zip -p COM15
  • adafruit-nrfutil --verbose dfu serial --package rak4631_factory_softdevice.zip.zip.zip -p COM15

If that works, the device should start up with the green LED dimming on/off. Then you are in Arduino Bootloader mode and should be able to flash Arduino BSP based applications.

I get nothing more than what dmesg get me when I connect the board to the USB port. The only serial port that appears when I connect the board is /dev/ttyACM0, like said in the dmesg prompt.

But when I tried to use it with nrfutil, I got all the error prompt I posted in my first message. For what I can tell, the port is open but there is “nobody” at the board side to listen what I could send. Like if the bootloader was not the right one (or absent).


When I was typing the message, my colleague tried to reflash the board - using a Nordic dev board - with another bootloader (this one).
Now I get a reaction, but it seems it is the Arduino bootloader, because it don’t respond to AT commands but gives me the external drive by double clicking on RESET.

I understand there’s a procedure for switching from the Arduino version to the RUI3 version. Otherwise I think I could use it with the WisBlock kit.

What would you recommend for WisBlock Kit 2 LoRa+BLE ? Arduino or RUI3 ?

Changing a Arduino board to RUI3 is in the Documentation ==> Updating RAK4631 to RUI3

Thank you for the link.

However, I’m having a problem during the procedure. After I’ve flashed the bootloader, I have this error when trying to flash rui3 package :

$ nrfutil --verbose dfu serial --package rui3_rak4631_latest.zip --port /dev/ttyACM0

Traceback (most recent call last):
  File "/home/nicolas/.local/bin/adafruit-nrfutil", line 8, in <module>
    sys.exit(cli())
  File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/nicolas/.local/lib/python3.8/site-packages/nordicsemi/__main__.py", line 290, in serial
    dfu = Dfu(package, dfu_transport=serial_backend)
  File "/home/nicolas/.local/lib/python3.8/site-packages/nordicsemi/dfu/dfu.py", line 66, in __init__
    self.manifest = Package.unpack_package(self.zip_file_path, self.unpacked_zip_path)
  File "/home/nicolas/.local/lib/python3.8/site-packages/nordicsemi/dfu/package.py", line 368, in unpack_package
    return Manifest.from_json(_json)
  File "/home/nicolas/.local/lib/python3.8/site-packages/nordicsemi/dfu/manifest.py", line 239, in from_json
    return Manifest(**kwargs['manifest'])
  File "/home/nicolas/.local/lib/python3.8/site-packages/nordicsemi/dfu/manifest.py", line 223, in __init__
    SoftdeviceBootloaderFirmware(**softdevice_bootloader) if softdevice_bootloader else None
TypeError: __init__() got an unexpected keyword argument 'info_read_only_metadata'

I’ve tried with other versions found here. Same problem.

Can you open the ZIP file and tell me what it contains?
I am afraid it is not complete or it is a problem with Ubuntu (I can only test on Windows).

Can you try to do the procedure on a Windows computer?

Content of the ZIP file should be like:

Not the same, whatever the ZIP.

I only have an Ubuntu machine right now. Maybe I could try with Wine or a virtual machine.


EDIT: trying with Wine, I get this :

Traceback (most recent call last):
  File "__main__.py", line 317, in <module>
  File "click\core.py", line 1137, in __call__
  File "click\core.py", line 1062, in main
  File "click\core.py", line 1668, in invoke
  File "click\core.py", line 1668, in invoke
  File "click\core.py", line 1404, in invoke
  File "click\core.py", line 763, in invoke
  File "__main__.py", line 290, in serial
  File "dfu\dfu.py", line 66, in __init__
  File "dfu\package.py", line 368, in unpack_package
  File "dfu\manifest.py", line 239, in from_json
  File "dfu\manifest.py", line 223, in __init__
TypeError: __init__() got an unexpected keyword argument 'info_read_only_metadata'
[45] Failed to execute script '__main__' due to unhandled exception!

I don’t guarantee it means 100% it is package’s fault but sounds like it, so far.


EDIT 2: Wait a MINUTE !!! I just figured out the package you were showing is not the one given in the procedure. Should I try with that one instead ?

I need to check something.
Your ZIP file includes softdevice and an old version of the RUI3 firmware.
Mine is only the latest firmware.

After you have finished step (1) which is flashing the bootloader, it should only need a firmware file like from my ZIP file.
Try my ZIP file which is from the Downloads Center “image” folder.
Use RAK4631_latest_dfu_package.zip

I tried, but I had the same error than at the beginning. I was about to reflash Arduino bootloader, but I noticed the RAK4631_latest_dfu_package was accompagnied with a HEX version, RAK4631_latest_final.hex. So I flashed it directly and now it works. I have a RUI version working perfectly.

I’d like to be able to test the whole Arduino to RUI3 conversion procedure again, but I’m already too far behind. I’ll probably try again as soon as I have some time to spare.

Thanks for your help anyway, it’s made it a bit clearer for me between all the versions.

If you have a JLink or a DAPlink to flash, it is much easier with the HEX files than using the USB method with nrfutil or adafruit-nrfutil, because you can flash the complete set of bootloader, softdevice and application at once when switching between RUI3 and Arduino.

1 Like

I took some minutes to retry the procedure and it still doesn’t work for me. Just after I flash rui3_nrf52840_bootloader with the nrfutil, I’m not able to flash rui3_rak4631_latest nor RAK4631_latest_dfu_package.zip, because nrfutil get not response from the microcontroller.

I think I’ll stay with the RUI flashed directly with the HEX file, via JLink or so. At least, for now.

Thanks for your help.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.