Getting started with NRF7002
Over the last decades, Nordic Semiconductors has been always one of the most important actors in BLE devices. Its NRF51, NRF52 and NRF53 microcontrollers have always been at the forefront in microcontrollers with BLE interface. Now, they use their expertise to introduce NRF7002, a WiFi companion chip, enabling the development of low-power, WiFi6 devices. This post is a getting started guide for NRF7002.
In A Blue Thing In The Cloud, as Nordic Design Partners, we have followed the introduction of this chip very closely, and we are starting working with it in some of the products we are developing. In order to help in the adoption of NRF7002 in the new design, we have created this “Getting Starting” guide.
We write this post on 4th April 2023, and the recommended versions are valid at this moment.
Getting started with Nordic Semiconductors nRF7002dk board. An NRF7002 basic tutorial.
First, you will need to install the required software. We can start installing Virtual Studio Code. Once done, we need to install the Nordic Semiconductors’ extension “nRF Connect for VS Code Extension pack,”. Please pay attention at the little detail, we are not installing nRF Connect for VS Code, but nRF Connect for VS Extension Pack.
It is important to note that nrfjprog path must be part of the system path. The install software places the nrfjprogsoftware at C:\Program Files\Nordic Semiconductor\nrf-command-line-tools\bin
If you are using Windows, you can do it as follows:
- Open the system properties window and click on the environment variables.
- On the system variables tab, select “Path” and edit it.
- Check if the mentioned directory belongs with the environment variables, or add it as a new element if it doesn’t.
You can download it in this link. It is a cross-platform software, so you can choose your operating system and the version you are downloading.
Select the last version of the nRF Connect SDK and install it, specifying at that moment the directory where you desire to find the nRF libraries. We recommend something short and near to the root directory, we have chosen C:/nordicsemi/
Getting started with the first NRF7002 project
Now that you downloaded and set all the environment,, we are going to configure the board pinout for the nRF7002. nRF Connect SDK uses a structured and modular method to describe hardware borrowed from the Zephyr RTOS, which uses a devicetree. Since our board is relatively new to the market, we need to update the devicetree manually. There are 2 approaches for fixing this.
1. Install the NRF7002 libraries
This is the easiest way for running an example. What we make is to install the nRF7002 board configuration and add it to the Zephyr’s directory. If you have downloaded one of the most recent versions of the nRF Connect SDK, it is possible to find the nRF7002 libraries on the directory <install_path>\<sdk_version>\nrf\boards\arm
Copy the nrf7002dk_nrf5340 folder on the directory where all the devicetrees from other compatible boards products are (<install_path>\<sdk_version>\zephyr\boards\arm). This way, the nRF7002 board configuration will be compatible with your projects, and you will have access to it from any application you wish to create.
Create an application
Now everything is ready for running the first example. So we are about to run the blinky example.
1. Click the button “Create a new application” and select the template “blinky” for this example. This application will turn on and of the LED0 of the board with a 1 second period. You need to go to the NRF Extension tab for this, as shown in the image.
2. Check the board connection. VSCode must detect it. So, it should appear on the “Connected devices” section. If it doesn’t show up automatically, press the reload button. For further applications, note that you can access to the serial ports of the board clicking on them, and interact with them directly on VSCode.
3. Click on the created application from the Applications panel and select the “Add Build Configuration” button. It will drive you to a screen where you can select the board you are working with, among other configuration options. Select the NRF7002-DK board (nrf7002dk_nrf5340_cpuapp) and enable the debug options.
2. Work with an overlay file
The second option is to work with the nRF5340 devicetree combined with an overlay. We specially recommend this option when you are doing your own project where the pinout will not be the same than in the NRF7002-DK.
An overlay is a file that you can add to your project to modify the original devicetree, stating only the differences between the pinout of two boards. Therefore, this is how to work with new products. While this option provides a clean way to change the board configuration, you will need to add a new file to the new nRF7002 application. To configure the overlay file, follow these steps:
Create the overlay file
To create the overlay file, lets first look to the devicetree file’s structure, looking at the nRF5340 device tree, found on <installation_path>\<sdk_version>\\zephyr\boards\arm\nrf5340dk_nrf5340\ nrf5340_cpuapp_common.dts
As you can see on the screenshot below, the devicetree follows a hierarchical structure, where the GPIOs are assigned to their functions, described by their properties. For now, remark that the GPIO mapping is different between the nRF5340 and the nRF7002 boards. For instance, the led_0 is declared to be on the P0.28 on the nRF5340, while it is found on the P1.06 on the nRF7002 board. The overlay file should record these differences to correct the pinout for our board.
Create a file called “nrf5340dk_nrf5340_cpuapp.overlay” on the root directory of the application (make sure the file’s extension is .overlay) and write on it the changes the nRF7002 board has over the nRF5340. If you like and share this post, and you contact us we will send you an overlay file for NRF7002-DK board as an example.
Flash, run, debug, and enjoy the examples
The last step is to flash the application on the board, by first, re-building the application, and then flashing it to your board. You should see how LED0 blinks with a period of 1 second.
Congratulations! You have successfully connected your board and are now ready to create new Nordic applications. For further information, we recommend to read take the “nRF Connect SDK Fundamentals” course from the Nordic Developers Academy and continue learning about their development kits.