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 reload the firmware to ensure everything is properly configured. Updating the firmware of the RAK4630 WisDuo can be done via USB connection or wirelessly using BLE via OTA DFU (Over-the-Air Device Firmware Update). These methods are discussed in this guide.
Prerequisites
What Do You Need?
- nRFutil utility program
- nRF Connect Mobile application
- DFU Distribution Package
- Latest RAK4630 FW DFU Distribution Package
Firmware Update via USB
You need a direct connection to the RAK4630's USB bus before proceeding with the update. Check the minimum schematic in the quick start guide's hardware setup section. This guide covers the three most popular operating systems.
Windows
- Create a new folder in your
C:\
drive namedRAK4631-R Update
. - 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.
- Connect the RAK4630 via USB and check if the port is detected in Device Manager. In this guide, it is detected as COM32. The COM port number may vary depending on the PC. If no port appears in Device Manager, try double-clicking the reset button and checking again.
- After that, send the
AT+BOOT
command to the device via serial terminal software. Follow the guide on using Tera Term from the RAK4631-R documentation, but instead of checking the firmware version, inputAT+BOOT
. You will see no reply as the module will restart; it will then be momentarily disconnected before re-establishing the connection to Tera Term.
Disconnect teh device from TeraTerm/Serial Terminal software or close it to free the COM port before the firmware update. Otherwise, errors may occur during the update.
Recovery Mode
If AT+BOOT
cannot be sent to the device, you can enable DFU mode via the UART2_TX pin. Connect the UART2_TX pin to GND, then reset the device to enter DFU mode. Proceed to the next step and upload the firmware without the AT+BOOT
command.
- After initiating Boot mode, execute the firmware update. Open the command prompt and navigate to the
RAK4631-R Update
folder. This folder contains the nRFutil and the latest firmware. Inputcd C:/RAK4631-R Update/
followed bynrfutil.exe dfu serial -pkg RAK4631_latest_dfu_package.zip -p COM32
. Ensure you have the correct.zip
file name andCOM port number
to avoid errors.
Change the COM port number in the command to match your PC. In this example, it is COM32, but it may differ on your PC.
- Check if the firmware successfully updated using the
AT+VER=?
command. Follow the guide on using Tera Term from the RAK4631-R documentation to check the firmware version and confirm the device update.
Linux
Setup the Linux Environment
- First, open a new terminal and install all necessary dependencies.
sudo apt-get update
sudo apt-get install net-tools git curl python xclip python3-pip
- Verify that you have installed
Python 3.7
or later. Check your Python version, as shown in Figure 6.
- Add
.local
folder to Linux$PATH
variable.
export PATH="$HOME/.local:$PATH"
- Install
nrfutil
. It is available as a package in the Python Package Index (PyPI). Execute the following command:
sudo apt-get update
pip3 install nrfutil --user
Setup the Device Console Port in Linux
- Install the minicom using the following commands:
sudo apt-get update
sudo apt-get install minicom
- 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
- Download the zip file DFU Distribution Package.
When you plug the RAK4630 into a Linux computer via USB, the dmesg
command will show the information cdc_acm 1-1:1.0: ttyACM0: USB ACM device
In this case, the RAK4630 USB CDC device name is /dev/ttyACM0
.
-
Perform the steps described in the section Setup the Device Console Port in Linux.
-
On minicom, enter the following AT command:
AT+BOOT
- Open the terminal and navigate to the directory containing the DFU distribution package. Then, execute the following command:
nrfutil dfu usb-serial -pkg RAK4631_latest_dfu_package.zip -p /dev/ttyACM0
- To check the device's 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
-
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. -
Open the terminal and navigate to the downloads directory or the location where you saved the downloaded file. Replace
username
with your actual username;apple
is used as an example in this guide.
cd /Users/username/Downloads
- Make the
nrfutil-mac.1
executable.
chmod +x nrfutil-mac.1
- You also need to determine the RAK4630's port name using the command:
ls /dev/cu.*
-
Download the RAK4630 Firmware. Usually, the
RAK4631_latest_dfu_package.zip
file will go to the downloads folder. -
Open serial terminal software and run the command
AT+BOOT
to enable the RAK4630's bootloader mode.
AT+BOOT
- Finally, execute the firmware update.
- The
nrfutil-mac.1
must be in the same folder asRAK4631_latest_dfu_package.zip
. In this guide, this is the Downloads folder. - Ensure you are connected to the correct port. The port name on your computer may differ from the one in this guide.
- The update may take some time. Do not remove the USB or close the terminal application during the upload 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.
DFU OTA Using iOS
OTA DFU Over BLE
- Download the DFU package of the RAK4630 and save it on your mobile phone.
You can upload the Distribution packet (ZIP) file to iCloud Services and then download it to your smartphone.
Make sure Bluetooth on your mobile device is turned on.
-
Press the reset button and wait a couple of seconds.
-
Open the nRF Connect mobile application. You will see all BLE devices in range in the scanner list.
- 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".
By default, the BLE signal of the RAK4630 turns off automatically if no connection is established after 60 seconds. Connect to RAK.XXXXXX immediately after pressing the reset button.
- Click the button highlighted in red, as shown in Figure 13.
- A Write Value window will pop up. Select Bool tab, move the switch from
False
toTrue
then press the Write button.
- Now, the RAK4630 is in DFU mode. In the application, you will see the default status overview of the RAK4630.
- In the Scanner list, find a BLE device named DfuTarg and then click the Connect button.
- After connecting, 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.
You can upload the distribution packet (ZIP) file to iCloud Services and download it to your smartphone.
- After upgrading, the module restarts, and the DFU connection disconnects. Now you can use your RAK4630 with the latest firmware.
DFU OTA Using Android
OTA DFU Over BLE
- Download the DFU package of the RAK4630 and save it on your mobile phone.
You can upload the Distribution packet (ZIP) file to Google Drive and download it to your smartphone.
Make sure Bluetooth on your mobile device is turned on.
-
Press the reset button and wait a couple of seconds.
-
Open the nRF Connect mobile application. The scanner list will show all BLE devices in range.
- 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.
By default, the BLE signal of the RAK4630 turns off automatically if no connection is established after 60 seconds. Connect to RAK.XXXXXX immediately after pressing the reset button.
- Click the button highlighted in red, as shown in Figure 21.
-
Click the arrow-up button highlighted in a red box.
-
A Write value window will pop up. Press the SEND button.
- Now, the RAK4630 is in DFU mode. The application will show the default status overview of the RAK4630.
- In the Devices list, find a BLE device named DfuTarg and click on the Connect button.
After connecting, click the DFU icon (highlighted in red in Figure 25).
- Select the distribution packet (.ZIP) and press OK. This will prompt you to select the downloaded firmware's ZIP file. The RAK4630's firmware will then automatically upgrade via DFU over BLE.
You can upload the distribution packet (ZIP) file to Google Drive and download it to your smartphone.
- After upgrading, the module restarts, and the DFU connection will be disconnected. You can now use your RAK4630 with the latest firmware.