RAK4631-R WisBlock LPWAN Module Device Firmware Upgrade
Device Firmware Upgrade
There will be situations that you need to update the firmware of your RAK4631-R. Also, there are times when you want to reupload the firmware on your device to ensure that everything is set properly.
Updating the Firmware of RAK4631-R WisBlock Core 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.
You can also update the firmware of your RAK4631 WisBlock Core to RAK4631-R which supports RUI3 and vice-versa.
This section covers:
- Firmware Update via USB
- Firmware Update via BLE Using OTA DFU
- Upgrading RAK4631 to RUI3
- Converting RAK4631-R to RAK4631
Prerequisites
- nRFutil utility program
- adafruit-nrfutil.exe (you need to unzip the downloaded file)
- nRF Connect Mobile application
- RUI3 firmware for RAK4630 Upgrade
- Latest RAK4631-R FW DFU Distribution Package
Firmware Update via USB
After connecting your RAK4631-R to WisBlock Base, you can immediately update its firmware via USB.
For Windows
- Check the FW version of your RAK4631-R. If it is not the latest firmware version (you can check the FW change logs), you can update the firmware of your device.
- 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 RAK4631-R via USB and check if port has been detected via device manager. In this guide it is detected as COM32. The COM port number is not fixed and can be different depending on the PC. If no port is shown in device manager, you can try to double click reset button on the WisBlock Base and check again.
- After that, you need to send
AT+BOOT
command to the device. You can follow the guide on using Tera Term but instead of checking the firmware version, you have to inputAT+BOOT
. You will see no reply since the module will restart then will be disconnected momentarily before re-establishing again the connection to Tera Term.
You have to disconnect the device connection to Tera Term or close it so that the COM port will be free when you do the firmware update on the next step. Else, you will have error during FW update.
- Next to initiating Boot mode, you can now execute the firmware update. To update the firmware, open the command prompt and ensure you're in the folder where you place the nRFutil and the latest firmware.
For this guide, it is in the RAK4631-R Update
folder directory. Then, input the following:
cd C:/RAK4631-R Update/
nrfutil.exe dfu serial -pkg RAK4631_latest_dfu_package.zip -p COM32
Make sure that you have the right .zip
file name and COM port number
to avoid errors.
- You can now check if the firmware is successful updated by using
AT+VER=?
command. To check the firmware version and confirm if the device is updated, follow the guide on Tera Term.
For Linux
Perform the four steps described in the next section Setup the Linux Environment.
Setup the Linux Environment
- First, open a new terminal, then install all dependencies.
sudo apt-get update
sudo apt-get install net-tools git curl python xclip python3-pip
- The following prerequisite must be 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"
- Now, you can install
adafruit-nrfutil
andnrfutil
.
nrfutil
and adafruit-nrfutil
are available as a package in the Python Package Index (PyPI). Execute the following commands:
sudo apt-get update
pip3 install nrfutil --user
pip3 install adafruit-nrfutil==0.5.3.post16 --user
Execute the Firmware Update via USB
- Download the zip file DFU Distribution Package.
When you plug in the RAK4631-R 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 RAK4631-R 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
- Now, open the terminal shell go to the directory where you put the DFU Distribution Package. After that, execute the following command:
nrfutil dfu usb-serial -pkg RAK4631_latest_dfu_package.zip -p /dev/ttyACM0
Setup the Device Console Port in Linux
- Install the minicom using the following commands:
sudo apt-get update
sudo apt-get install minicom
- Open the minicom terminal utility with the ttyACM0 interface.
Enter the following code: minicom -D /dev/ttyACM0
Checking the Device Firmware Version
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.
For MacOS
-
Download nrfutil. Usually, the
nrfutil-mac.1
file will go to the downloads folder. This section assumes any downloaded file goes to 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 RAK4631-R using the command:
ls /dev/cu.*
-
Download the RAK4631-R Firmware. Usually, the
RAK4631_latest_dfu_package.zip
file will go to the downloads folder. -
Open a serial terminal software and run
AT+BOOT
to enable bootloader mode of RAK4631-R.
AT+BOOT
- You can now execute the firmware update.
- The
nrfutil-mac.1
must be on the same folder with theRAK4631_latest_dfu_package.zip
. In this guide it is Downloads folder. - You should be connected on the right port. The port name in your computer might be different than the one 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 RAK4631-R 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.
For iOS
OTA DFU over BLE
- Download the DFU package of the RAK4631-R and save it on your mobile phone.
You can upload the Distribution packet (ZIP) file to iCloud Services and download it to your smartphone.
Make sure the Bluetooth on your mobile is 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.
By default, the BLE signal of the RAK4631-R is turned off automatically if no connection is established after 60 seconds. Connect to RAK.XXXXXX immediately after pressing the reset button.
- Choose "Secure DFU Service" and 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 Write button.
- Now, the RAK4631-R is now working in DFU Mode. In the application, you will see the default status overview of RAK4631-R.
- 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 RAK4631-R 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 RAK4631-R with the latest firmware.
For Android
OTA DFU Over BLE
- Download the DFU package of the RAK4631-R 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 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.
By default, the BLE signal of the RAK4631-R is turned off automatically if no connection is established after 60 seconds. Connect to RAK.XXXXXX immediately after pressing the reset button.
- Choose "Secure DFU Services" and 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 RAK4631-R is now working in DFU Mode. In the application, you will see the default status overview of RAK4631-R.
- In the Devices list, find a BLE device named DfuTarg and click on the Connect button.
After connected, click on the DFU icon highlighted in red, as shown below.
- 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 RAK4631-R 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 RAK4631-R with the latest firmware.
Updating RAK4631 to RUI3
If your device is the RAK4631 WisBlock Core, you can upgrade its firmware to make it RAK4631-R. This section covers the steps on how to do the upgrade.
Converting the RAK4631 to RAK4631-R is a two-step processes. First, you need to update the RAK4631 bootloader that is compatible to RAK4631-R Firmware. Second, you need to upload the right RAK4631-R firmware dedicated for FW conversion of RAK4631 to RAK4631-R.
Using Windows
Bootloader Update via USB
- Create a new folder in your
C:\
drive namedRAK4631 Bootloader to RUI v3
. - Download the adafruit-nrfutil.exe (you need to unzip the downloaded file) and rui3_nrf52840_bootloader then copy both files to
RAK4631 Bootloader to RUI v3
folder you created.
- Connect the RAK4631-R via USB and check if port has been detected via device manager. In this guide it is detected as COM31. The COM port number is not fixed and can be different depending on the PC. If no port is shown in device manager, you can try to double click reset button on the WisBlock Base and check again.
- You are now ready to do the bootloader upgrade. Open the command prompt and change directory via
cd C:\RAK4631 Bootloader to RUI v3\
. After that, you can now execute the bootloader upgrade using the command below.
adafruit-nrfutil.exe --verbose dfu serial --package rui3_nrf52840_bootloader_latest.zip --port COM31 -b 115200 --singlebank --touch 1200
- After a successful bootloader upload, you are now ready to upload the RUI3 firmware on the next steps.
Firmware Update via USB
- After completing the bootloader upgrade, it will change to a new COM port number. It this guide it changed from
COM31
toCOM32
.
- Download nrfutil.exe and the rui3_rak4631_latest RUI3 FW which is specifically designed for the RAK4631's conversion to RAK4631-R. Then place the two files on
RAK4631 Bootloader to RUI v3
folder.
- You are now ready to do the firmware update. Open the command prompt and change directory via
cd C:\RAK4631 Bootloader to RUI v3\
. After that, you can now execute the firmware update using the command below.
nrfutil.exe dfu serial -pkg rui3_rak4631_latest.zip -p COM32
- You can now check if the firmware upload is successful by checking the the firmware version using
AT+VER=?
command. You can follow the guide on Tera Term to check firmware version and confirm if the device is already updated.
Using Linux
Perform the four steps described in the section Setup the Linux Environment.
When you plug in the RAK4631-R 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 RAK4631-R USB CDC device name is /dev/ttyACM0
Bootloader Update via USB on Linux
After determining the USB CDC device name, download the rui3_nrf52840_bootloader.
Then execute the following command:
adafruit-nrfutil --verbose dfu serial --package rui3_nrf52840_bootloader_latest.zip -p /dev/ttyACM0
The -p parameter is RAK4631-R USB CDC device name.
Firmware Update via USB on Linux
Download the rui3_rak4631_latest firmware.
On the download folder, execute the following command:
nrfutil dfu usb-serial -pkg rui3_rak4631_latest -p /dev/ttyACM0
The -p parameter is RAK4631-R USB CDC device name.
Set Up the Device Console Port in Linux
Install the minicom terminal emulator utility. Open a new terminal and execute the following commands:
sudo apt-get update
sudo apt-get install minicom
Now, open minicom on USB CDC port and then send the AT+VER=?
command to check the RUI firmware version.
minicom -D /dev/ttyACM0
Using MacOS
Updating the Bootloader to be Compatible with RAK4631-R FW
-
Download the adafruit-nrfutil-macos. Usually, the
adafruit-nrfutil-macos
file will go to the downloads folder. This section assumes any downloaded file goes to downloads folder. -
The next step after downloading the file is to 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
adafruit-nrfutil-macos
executable.
chmod +x adafruit-nrfutil-macos
- You also need to determine the port name of the RAK4631-R using the command:
ls /dev/cu.*
-
Download the RAK4631 to RAK4631-R Bootloader firmware. Usually, the
rui3_nrf52840_bootloader_latest.zip
file will go to the downloads folder. -
You can now execute the bootloader update.
- The
adafruit-nrfutil-macos
must be on the same folder with theruiv3_nrf52840_bootloader.zip
. In this guide it is Downloads folder. - You should be connected on the right port. The port name in your computer might be different than the one in this guide.
./adafruit-nrfutil-macos --verbose dfu serial --package rui3_nrf52840_bootloader_latest.zip -p /dev/cu.usbmodem14101 -b 115200 --singlebank --touch 1200
Uploading the RAK4631-R Firmware
After updating the bootloader, you can now upload the RAK4631-R firmware by following the steps below. You have to note that the RAK4631-R firmware used in this section is a dedicated firmware designed for updating RAK4631 to RAK4631-R.
-
Download the nrfutil. Usually, the
nrfutil-mac.1
file will go to the downloads folder. This section assumes any downloaded file goes to downloads folder. -
If your terminal is not yet open, 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 RAK4631 using the command:
ls /dev/cu.*
-
Download the RAK4631 to RAK4631-R Conversion firmware. Usually, the
rui3_rak4631_latest.zip
file will go to the downloads folder. -
You can now execute the firmware update.
- The
nrfutil-mac.1
must be on the same folder with therui3_rak4631_latest.zip
. In this guide it is Downloads folder. - You should be connected on the right port. The port name in your computer might be different than the one 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 rui3_rak4631_latest.zip -p /dev/cu.usbmodemC0D048F6604F1
- After the success FW upload, your RAK4631 is now RAK4631-R. Open a serial terminal software and run
AT+VER=?
to see the FW version.
AT+VER=3.2.0-p2_22q1_final.87
OK
Converting RAK4631-R to RAK4631
You have the option to convert your RAK4631-R to RAK4631.
-
Download the necessary files needed for conversion in a common folder.
-
Create a new folder in your
C:\
drive namedRAK4631 Bootloader to RUI v3
and place all the conversion files you downloaded from the previous step.
- Connect the RAK4631-R via USB and check if port has been detected via device manager. In this guide it is detected as COM32. The COM port number is not fixed and can be different depending on the PC. If no port is shown in device manager, you can try to double click reset button on the WisBlock Base and check again.
- After that, you need to send
AT+BOOT
command to the device. You can follow the guide on using Tera Term but instead of checking the firmware version, you have to inputAT+BOOT
. You will see no reply since the module will restart then will be disconnected momentarily before re-establishing again the connection to Tera Term.
You have to disconnect the device connection to Tera Term or close it so that the COM port will be free when you do the firmware update on the next step. Else, you will have error during FW update.
- Next to initiating Boot mode, you can now execute the firmware conversion. Open the command prompt and change directory via
cd C:\RAK4631 Bootloader to RUI v3\
. - Execute the bootloader conversion using the command
nrfutil.exe dfu serial -pkg rak4631_factory_bootloader.zip -p COM5
. Make sure that you have the right.zip
file name andCOM port number
to avoid errors.
- The previous step updated the bootloader of RAK4631. Another requirement is to ensure that the softdevice is compatible with the expected version by the Arduino BSP. To do this, execute the command
adafruit-nrfutil --verbose dfu serial --package rak4631_factory_softdevice.zip -p COM15
. You also have to make sure that you have the right.zip
file name andCOM port number
to avoid errors. The COM port will likely be different compared to step 5.
- After the successful upload, you can now see RAK4631 drive detected. This indicates that the device has now the Arduino BSP bootloader on it and ready to be uploaded with firmware created using the WisBlock Arduino BSP and not RUI3. You also need to check the COM port number since it will changed once you convert to Arduino BSP bootloader.
If there is no RAK4631 drive detected, try to double-click the reset button on the WisBlock Base.
Miscellaneous
How to Check Firmware Version Using Tera Term
- Download and install the console UART utility Tera Term. You can also use other serial terminal tool or even the Arduino Serial Monitor.
- Connect the RAK4631-R via USB port of the WisBlock Base board.
- Check the COM port of the device using device manager. The port number is not fix and can change on different computers. If no port is detected, double click the reset button on the WisBlock Base.
- Launch Tera Term and New Connection window will open. Click on
Serial
and select the correct serial port onPort
. To close the window, click on the OK button. You can check the co
- On the Tera Term menu, select Setup -> Serial port...
- Check the
Port
if correct. A USB interface is used for connection so you can ignore the Baud Rate (Speed) setting. Click on the New setting button to save.
- You can now check the firmware version of your device via
AT+VER=?
. You can also input firstATE
command so you can see the command you send.
AT+VER
: get the version of the FW.
AT+VER=?
AT+VER=3.2.0-p2_22q1_final.87