This tutorial aims at getting the user setup with all the development tools necessary for writing application using the ARM MBed environment for the RAK Wireless iTracker board
HardwareYou require the following hardwrae to get everythign started
- 1) Jumper WIres
- 2) the iTracker board
- 3) JLink USB programmer
Jlink USB Adapter:
So before we get started lets setup our Ubuntu/Windows machine for programming the itracker board;
Jlink Drivers
It is essential that you have the suite of Jlink software downloaded from the Segger website. The suite contains a number of utilities and drivers for the Segger product line but a few notable ones are
- 1) JlinkEXE module which is the command-line interface to the Jlink module
- 2) RTTVIewer, for viewing debug logs over the JTAG interface
- 3) Jlink Driver for the usb programmer
You can download the driver s here:
https://www.segger.com/downloads/jlink
Please install the drivers and once installed, connect the Jlink usb device to the computer, and run the JlinkExe program from the command line. This ensures that the firmware on the JlInk usb adapter is updated to the latest version.
Connecting the board to the jlink adapter:Here is the pinout on the iTracker board:
Make sure the connection to the jlink adapter is as shown
1) GND to GND on Jlink adapter
2) SWCLK to SWDCLK on Jlink adapter
3) SWDIo to SWDIO on Jlink adapter
4) VDD to VDD on Jlink adapter
Use the bottom four pins (encased in a white plug adapter ) as shown in the image above.
Mbed Online compiler:Now that we have the drivers installed and ready to go, lets look at the star of this tutorial; The Mbed online compiler. Its a nifty little tool to quickly get started with your mbed apps for a variety of supported platforms.
To use the online compiler, create an account @: https://os.mbed.com/compiler/ and then sign into the compiler. You will be gretaed with a UI like so:
The iTracker board is based on the Nordic nrf52832 BLE chipset. Hence lets add that board to our account. Go to the page here:
https://os.mbed.com/platforms/Nordic-nRF52-DK/
And click on the link in the right side pane on the page that says, "Add to onlien compiler"
Now if you go back to the compiler tab, you shoould see the nrf52dk board selected in the top right corner of the compiler UI:
Now with the target selected, Click on the New menu - > and select New Program. You will be greated with a UI like so:
Select the template as BLE Button example. Dont worry this is just for testing the compilation and if everythig in our system is setup properly, we will get to the sensors in the next tutorial :)
Click OK.
This will open the project in your online compiler like so:
The parts that we will be interested in are:
- The Main.cpp, this is the main app source code and had the venerable main() fucntion
- The BLE_API is the Mbed BLE API library to interface with the BLE stack on the nrf52
- the mbed folder is the mbed OS specific code
Now lets go ahead and click the compile button at the top of the mbed compiler ui. This will compile a file called project_name.hex that will be automatically downloaded into your browsers download folder
The Mbed Firmware:Important stats about the firmware will be present in the left hand side pane on the compiler called 'build':
The firmware is be default a combination of the softdevice for the nrf52 and the Mbed OS+app. The Softdevcie is nothing but the bare metal BLE stack provided by Nordic for its BLE chipsets. The Mbed online compiler will always choose the latest softdevice for you so you don't need to worry about the version being used.
Now lets flash the firmware.
Flashing the firmware:The firmware is always a hex file. Our firmware wouldnt have the bootloader also in built which we will get to in the upcoming tutorials in much more detail. For now we will just flash the hex directly.
Open a commandline prompt. I will consider Ubuntu OS for this.
Run the following commands:
cd to the folder containing the firmware you just downloaded
nrfjprog -e -f nrf52
nrfjprog --program xxx.hex -f nrf52 --verify
nrfjprog -f nrf52 --reset
Your board shoudl reset and now open your favourite BLE app on your android/ios phone/tab. I prefer the nrf toolbox app. Install the app and scan for BLE devices. You should see the BLEButton show up in the app. This shows that your board has been flashed successfully with the mbed app.
Flashing firmware using nrfGo:This firmware upgrade scenario involves uploading the application onto the board using a cable connection.
You will require nRFgo Studio to run this procedure. Alternatively, you can use a J-Link programmer.
Follow these steps to update Thingy using your own compiled application:
- Start nRFgo Studio.
- Connect your board to the host.
- Select nRF52 development boards.
- Click Erase all.
- In the Program SoftDevice tab, browse for the S132 v4.0.2 HEX file and click Program.
- In the Program Application tab, browse for your application HEX file and click Program.
Follow these steps to flash the factory image:
- Start nRFgo Studio.
- Connect your board to the host.
- Select nRF52 development boards.
- Click Erase all.
- In the Program Application tab, browse for the factory HEX file and click Program.
Hurray !!! Your iTracker board dev environment setup is complete. In the next tutorials we will go in depth into the sensors on-board and on understanding the Bootloader stuff supported by Mbed OS.
Clicking on the button connect option will present a tab with the button characteristics and their details.
Comments
Please log in or sign up to comment.