Skip to main content

RAK4630 WisBlock LPWAN+BLE Module Firmware Update

There will be situations where you need to update the firmware of your RAK4630. Additionally, there are times when you may want to reupload the firmware to ensure that everything is properly configured. Updating the firmware of RAK4630 WisDuo can be done via USB connection or wirelessly using BLE via OTA DFU (Over-the-Air Device Firmware Upgrade). These methods are discussed in this guide.

Prerequisites

What Do You Need?

Firmware Update via USB

You need to have a direct connection to the USB bus of RAK4630 before you can proceed with the update. Check the minimum schematic required in the quick start guide hardware setup section. This guide covers the three most popular operating systems:

Windows

  1. Create a new folder in your C:\ drive named RAK4631-R Update.
  2. Download the nRFutil.exe and the latest DFU Package. Once you downloaded both files, put them in the RAK4631-R Update folder you created as shown in Figure 1.
Figure 7999: nRFutil.exe and RAK4630 Latest Firmware
  1. Connect the RAK4630 via USB and check if the port has been detected via Device Manager. In this guide, it is detected as COM32. The COM port number is not fixed and can vary depending on the PC. If no port is shown in Device Manager, you can try double-clicking the reset button and then check again.
Figure 8000: Checking COM Port via Device Manager
  1. After that, send the AT+BOOT command to the device via Serial Terminal software. Follow the guide on using Tera Term from RAK4631-R documentation, but instead of checking the firmware version, you have to input AT+BOOT. You will see no reply since the module will restart, then it will be momentarily disconnected before re-establishing the connection to Tera Term.
NOTE

You have to disconnect the device connection to TeraTerm/Serial Terminal software or close it so that the COM port will be free when you do the firmware update in the next step. Otherwise, you will encounter errors during the firmware update.

warning

Recovery Mode

If AT+BOOT is not possible to be sent to the device, you can enable DFU mode via UART2_TX pin. You need to connect UART2_TX pin to GND then reset the device to enter DFU mode. Then, proceed on the next step and upload the firmware even without the AT+BOOT command.

Figure 8001: AT+BOOT to Initialize Boot Mode
  1. After initiating Boot mode, execute the firmware update. Open the command prompt and must be in RAK4631-R Update folder directory to do the firmware update. This is folder where you place the nRFutil and the latest firmware. You need to input cd C:/RAK4631-R Update/ followed by nrfutil.exe dfu serial -pkg RAK4631_latest_dfu_package.zip -p COM32. You have to ensure that you have the right .zip file name and COM port number to avoid errors.
NOTE

Change the COM port number in the command based on your PC. In this example, it is COM32 but it can be different in your PC.

Figure 8002: FW Update Using nRFutil
  1. Check if the firmware is successful updated by using AT+VER=? command. Follow the guide on using Tera Term from RAK4631-R documentation to check the firmware version and to confirm if the device is now updated.
Figure 8003: RAK4631-R Latest Firmware Version Check

Linux

Setup the Linux Environment

  1. First, open a new terminal and install all dependencies.
sudo apt-get update
sudo apt-get install net-tools git curl python xclip python3-pip
  1. Verify that you have installed Python 3.7 or later. Check your Python version, as shown in Figure 6.
Figure 8004: Check Python version
  1. Add .local folder to Linux $PATH variable.
export PATH="$HOME/.local:$PATH"
  1. Install nrfutil. It is available as a package in the Python Package Index (PyPI). Execute the following commands:
sudo apt-get update
pip3 install nrfutil --user

Setup the Device Console Port in Linux

  1. Install the minicom using the following commands:
sudo apt-get update
sudo apt-get install minicom
  1. To open the minicom terminal utility with the ttyACM0 interface. The correct port name can be determined using dmesg, as shown in the next steps.

Enter the following code: minicom -D /dev/ttyACM0

Execute the Firmware Update via USB

  1. Download the zip file DFU Distribution Package.

When you plug in the RAK4630 through the USB to Linux, you will see the related information "cdc_acm 1-1:1.0: ttyACM0: USB ACM device" from the dmesg command.

Figure 8005: Checking USB CDC device using dmesg command

In this case, the RAK4630 USB CDC device name is /dev/ttyACM0.

  1. Perform the steps described in the section Setup the Device Console Port in Linux.

  2. On minicom, enter the following AT command:

AT+BOOT
  1. Open the terminal and go to the directory where you put the DFU Distribution Package. Then, execute the following command:

nrfutil dfu usb-serial -pkg RAK4631_latest_dfu_package.zip -p /dev/ttyACM0

  1. To check the device firmware version in the minicom console, enter the following AT command:
AT+VER=?

You should see then the current FW version of the module.

MacOS

  1. Download nrfutil. Usually, the nrfutil-mac.1 file will go to the downloads folder. This section assumes any downloaded file goes to the downloads folder.

  2. Open the terminal and go to the downloads directory or the location where you put the downloaded file. You have to change the username based on your machine. In this guide, apple is used as the user.

cd /Users/username/Downloads
  1. Make the nrfutil-mac.1 executable.
chmod +x nrfutil-mac.1
Figure 8006: Download nrfutil for macOS
  1. You also need to determine the port name of the RAK4630 using the command:
ls /dev/cu.*
Figure 8007: Check the port
  1. Download the RAK4630 Firmware. Usually, the RAK4631_latest_dfu_package.zip file will go to the downloads folder.

  2. Open a serial terminal software and run the command AT+BOOT to enable the bootloader mode of RAK4630.

AT+BOOT
  1. Finally, execute the firmware update.
NOTE
  • The nrfutil-mac.1 must be on the same folder as the RAK4631_latest_dfu_package.zip. In this guide, it is the Downloads folder.
  • Ensure that you are connected to the correct port. The port name on your computer might be different from the one mentioned in this guide.
  • It might take a while for the update. Do not remove the USB or terminate the terminal application while doing the uploading process.
./nrfutil-mac.1 dfu usb-serial -pkg RAK4631_latest_dfu_package.zip -p /dev/cu.usbmodemC0D048F6604F1

Firmware Update Using BLE via OTA DFU

This section covers how to update your RAK4630 firmware wirelessly via BLE. First, you need to download and install the nRF Connect developed by Nordic Semiconductor. The App is available both in Play Store and App Store.

Figure 8008: nRF Connect App available in Play Store and App Store

DFU OTA Using iOS

OTA DFU Over BLE

  1. Download the DFU package of the RAK4630 and save it on your mobile phone.
NOTE

You can upload the Distribution packet (ZIP) file to iCloud Services and then download it to your smartphone.

Make sure the Bluetooth on your mobile is turned on.

  1. Press the reset button and wait for a couple of seconds.

  2. Open the nRF Connect mobile application. You will see all the BLE devices in range in the Scanner list.

Figure 8009: Available Bluetooth Devices
  1. Look for a BLE Device named RAK.XXXXXX in the scanner list of the app. Connect to this device and then click on the Client tab. Then, choose "Secure DFU Service".
NOTE

By default, the BLE signal of the RAK4630 is turned off automatically if no connection is established after 60 seconds. Connect to RAK.XXXXXX immediately after pressing the reset button.

Figure 8010: Secure DFU service
  1. Click the button highlighted in red, as shown in Figure 13.
Figure 8011: Buttonless DFU
  1. A Write Value window will pop up. Select Bool tab, move the switch from False to True then press the Write button.
Figure 8012: Resetting the bootloader via Bluetooth
  1. Now, the RAK4630 is in DFU Mode. In the application, you will see the default status overview of RAK4630.
Figure 8013: RAK4630 default status overview after resetting
  1. In the Scanner list, find a BLE device named DfuTarg and then click the Connect button.
Figure 8014: RAK4630 Default Bluetooth ID after Resetting
  1. After connected, select the DFU tab, then click Open Document Picker. This will prompt you to select the Distribution packet zip file of the firmware you have downloaded. Press OK, and it will automatically start to upgrade the firmware of your RAK4630 through DFU over BLE.
Figure 8015: Distribution Packet File Type under DFU
NOTE

You can upload the Distribution packet (ZIP) file to iCloud Services and download it to your smartphone.

  1. After upgrading, the module restarts, and the DFU connection will be disconnected. Now, you can use your RAK4630 with the latest firmware.
Figure 8016: DFU upgrading of RAK4630 firmware via BLE

DFU OTA Using Android

OTA DFU Over BLE

  1. Download the DFU package of the RAK4630 and save it on your mobile phone.
NOTE

You can upload the Distribution packet (ZIP) file to Google Drive and download it to your smartphone.

Make sure the Bluetooth on your mobile is turned on.

  1. Press the reset button and wait for a couple of seconds.

  2. Open the nRF Connect mobile application. You will see all the BLE devices in range in the Scanner list.

Figure 8017: Available Bluetooth Devices in the Nordic App
  1. Look for a BLE Device named RAK.XXXXXX in the scanner list of the app. Connect to this device and then click the Client tab. Then, choose Secure DFU Services.
NOTE

By default, the BLE signal of the RAK4630 is turned off automatically if no connection is established after 60 seconds. Connect to RAK.XXXXXX immediately after pressing the reset button.

Figure 8018: Secure DFU service in the Nordic App
  1. Click the button highlighted in red, as shown in Figure 21.
Figure 8019: Buttonless DFU
  1. Click the arrow-up button highlighted in a red box.

  2. A Write value window will pop up. Press the SEND button.

Figure 8020: Resetting the Bootloader via Bluetooth
  1. Now, the RAK4630 is now working in DFU Mode. In the application, you will see the default status overview of RAK4630.
Figure 8021: RAK4630 default status overview after resetting
  1. In the Devices list, find a BLE device named DfuTarg and click on the Connect button.
Figure 8022: RAK4630 default Bluetooth ID after resetting

After connecting, click on the DFU icon highlighted in red, as shown in Figure 25.

  1. Select the Distribution packet (ZIP) and press OK. This will prompt you to select the zip file of the firmware that you have downloaded. It will automatically start to upgrade the firmware of your RAK4630 through DFU over BLE.
Figure 8023: Distribution packet file type under DFU
NOTE

You can upload the Distribution packet (ZIP) file to Google Drive and download it to your smartphone.

  1. After upgrading, the module restarts, and the DFU connection will be disconnected. Now, you can use your RAK4630 with the latest firmware.
Figure 8024: DFU upgrading of RAK4630 firmware via BLE