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?
- nRFutil utility program
- nRF Connect Mobile application
- DFU Distribution Package
- Latest RAK4630 FW DFU Distribution Package
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
- 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 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.
- 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 inputAT+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.
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.
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.
- 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 inputcd C:/RAK4631-R Update/
followed bynrfutil.exe dfu serial -pkg RAK4631_latest_dfu_package.zip -p COM32
. You have to ensure that you have the right.zip
file name andCOM port number
to avoid errors.
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.
- 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.
Linux
Setup the Linux Environment
- 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
- 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 commands:
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 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.
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 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
- 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
-
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 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
- Make the
nrfutil-mac.1
executable.
chmod +x nrfutil-mac.1
- You also need to determine the port name of the RAK4630 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 a serial terminal software and run the command
AT+BOOT
to enable the bootloader mode of RAK4630.
AT+BOOT
- Finally, execute the firmware update.
- The
nrfutil-mac.1
must be on the same folder as theRAK4631_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.
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 the Bluetooth on your mobile is turned on.
-
Press the reset button and wait for a couple of seconds.
-
Open the nRF Connect mobile application. You will see all the 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 is turned 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 RAK4630.
- In the Scanner list, find a BLE device named DfuTarg and then click the Connect button.
- 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.
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 will be disconnected. 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 the Bluetooth on your mobile is turned on.
-
Press the reset button and wait for a couple of seconds.
-
Open the nRF Connect mobile application. You will see all the 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 the Client tab. Then, choose Secure DFU Services.
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.
- 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 now working in DFU Mode. In the application, you will see the default status overview of RAK4630.
- In the Devices list, find a BLE device named DfuTarg and click on the Connect button.
After connecting, click on the DFU icon highlighted in red, as shown in Figure 25.
- 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.
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. Now, you can use your RAK4630 with the latest firmware.