When you upload code to a microcontroller, it can be either a library sample or a code made by yourself. The bootloader is a small program stored inside the microcontroller and starts to work each time the hardware is powered on or reset, this can be physical or software, the main task of the bootloader is to receive orders to read, write or delete data (the code).
Now that you know what a bootloader is, why do you need to upload it?Because is a very small, but very important piece of software, that makes your WisBlock Core operate correctly when you experience bugs, abnormal behavior on a microcontroller or just random things. There is a chance it can be resolved just by updating the bootloader, just like the BIOS in your personal PC.
If you want to check the Update the Bootloader (via BLE) Click Here
For this project you will need:Check the current bootloader versionThe first step is to check the current version of the bootloader. These are the steps to do it via USB, so you will need the Micro USB Cable.
Connect the RAK4631 to the PC via USB cable and double click the reset button on the WisBlock Base.
There will be a new drive named RAK4631 or FTHR840BOOT
depending on how old your bootloader is. This will be shown on your folder explorer.
Inside this drive, there will be a text file named INFO_UF2.TXT
, as shown below.
If you open INFO_UF2.TXT
, you'll see:
1UF2 Bootloader 0.4.2 lib/nrfx (v2.0.0) lib/tinyusb (0.10.1-293-gaf8e5a90) lib/uf2 (remotes/origin/configupdate-9-gadbb8c7) 2Model: WisBlock RAK4631 Board 3Board-ID: WisBlock-RAK4631-Board 4Date: Dec 1 2021 5SoftDevice: S140 6.1.1
If you have a different drive name or an older date, it means that you do not have the updated RAK4631 bootloader and need to update it.
Checking the bootloader for LinuxFollow the same steps as for Windows. Connect the RAK4631 via USB cable to your Linux Machine, then press two times the reset button. Right after that, it will appear a new device to explore. In this case, there is an old bootloader from June 2020, and the name of the device is FTHR840BOOT.
The device name will be changing as you update the bootloader to RAK4631.
Hardware and Tools
- WisBlock Base RAK5005-O
- WisBlock Core RAK4631
- The latest bootloader
- Adafruit-nrfutil application
- USB cable
First, download the adafruit-nrfutil.exe (this is an automatic download) and the latest RAK4631 bootloader firmware.
To download the firmware, click on the download button on our GitHub.
Once you downloaded these files, put them in the same directory/folder on your computer.
For simplicity, this guide will assume the files are in C: drive.
When the files are ready, open Windows Command Prompt application. Then change the location to C. The command below can do that cd(change directory) and C:\(The direction of the directory).
cd C:\
After that, you can execute the update using this command.
You have to determine the right COM port number of your device. COM8 on the command above is only for illustration. You will get an error if you are not connected to the right COM port number.
Also, you can check the port number on the Device Manager as the image below (in this case is COM5).
adafruit-nrfutil.exe --verbose dfu serial --package WisCore_RAK4631_Board_Bootloader.zip --port COM8 -b 115200 --singlebank --touch 1200
NOTE:
If there is an error when you use this command (Not finding the Port), check again the number of the COM and update the same number on the command.
If your device has been updated correctly, the message “Device programmed“ will appear, and you'll be ready to go.
For Linux
Begin installing the “adafruit-nrfutil“. Do it using these two lines of code in the terminal:
sudo pip3 install adafruit-nrfutil
or
pip3 install --user adafruit-nrfutil
If everything has gone right you will see the same as the image above.
Then, download the latest RAK4631 bootloader firmware.
At this point you have to connect your WisBlock via USB and determine the port name of the RAK4631 using the command:
ls /dev/tty*
In this case, the port is the /dev/ttyACM0.
After determining the port name, go to the directory where the bootloader FW file WisCore_RAK4631_Board_Bootloader.zip
is located. For this example is located in the Desktop.
Then execute the following command:
adafruit-nrfutil --verbose dfu serial --package WisCore_RAK4631_Board_Bootloader.zip -p /dev/ttyACM0 -b 115200 --singlebank --touch 1200
or
sudo adafruit-nrfutil --verbose dfu serial --package WisCore_RAK4631_Board_Bootloader.zip -p /dev/ttyACM0 -b 115200 --singlebank --touch 1200
After this process you will see that the bootloader was successfully updated, the date is now Dec 2021 and the name of the device changed to RAK4631.
For macOS
Follow the same Windows and Linux procedures. Download the latest RAK4631 bootloader firmware.
There are two ways to update the RAK4631 bootloader in macOS.
- If you have Python installed, follow the same steps for Linux.
- Another way is by creating a macOS executable. To do this method, download adafruit-nrfutil-macos and make it executable.
Usually, the adafruit-nrfutil-macos
file will be placed in the 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.
cd /Users/username/Downloads
And then execute this command:
chmod +x adafruit-nrfutil-macos
You also need to determine the port name of the RAK4631 using the command:
ls /dev/cu.*
.
After all these steps, you can now upload the latest RAK4631 Bootloader Firmware by executing this command:
./adafruit-nrfutil-macos --verbose dfu serial --package WisCore_RAK4631_Board_Bootloader.zip -p /dev/cu.usbmodem411 -b 115200 --singlebank --touch 1200
After following all these steps, you will have successfully updated your bootloader to keep working on your RAK4631Core. If you want to continue this journey you can check the next tutorial: Getting Started with your first and basic RAK Module - Wisblock Starter Kit.
Also, follow us on our Hackster profile and be part of our community to keep updated with more projects and news.
Please share it with us, comment on your doubts, and interact with us in the comment section.
Comments