Jetson Nano - A quick start with .NET Core 3


Jetson-nano-pcb

image credit:https://www.nvidia.com/en-gb/autonomous-machines/embedded-systems/jetson-nano/

Introduction

I’ve recently purchased a Nvidia Jetson Nano devkit and I’m excited by the possibilities this device opens up. The Jetson Nano is a small computer from Nvidia focussed on AI scenarios and it’s priced at a very reasonable $99 (~£95). With a form factor similar to a Raspberry Pi (RPi) and with similar support for many peripherals and add-ons I can this being very popular with home enthusiasts and makers, much like the RPi is. The AI capabilities of the Jetson are powerful and I’ll explore those in another post, in the meantime you can checkout Nvidia’s material if you can’t wait.

Initially I wanted to flex my existing skills and see if I can get some .NET Core code up and running, we won’t be doing anything that uses the AI power of the Jetson in this post but you can imagine combining .NET Core with something like ML.NET and or Azure IoT Edge to create some very cool things! And obviously you can use the device with the vast Python based examples/projects that is the usual route for AI/ML scenarios.

Ultimate the Jetson Nano is an ARM64 computer running Linux so the instructions for installing and running .NET Core are not that different to any other ARM64 device. This guide is intended to help those who may not be very comfortable with Ubuntu.

What you’ll need

  • A Jetson Nano dev kit (buying details)
  • A microSD card (ideally 32gig+)
  • A micro USB power supply (5v 2amp) - an official RPi one should work
  • A USB keyboard & mouse
  • Monitor (HDMI/Display port)
  • A wired network, as there is no built-in WiFi :(

Once the device is setup you can access it remotely so wouldn’t need the peripherals or monitor after the initial setup.

Setting up the Jetson Nano

The instructions for setting up the Jetson are reasonably straightforward so rather than repeat those here I’ll link to the Nvidia documentation. At the end of these instructions you should have the Jetson setup and have an Ubuntu desktop available.

Install .NET Core on the Jetson Nano

The Jetson is an ARM64 device running Linux 1 and therefore we need to use .NET Core. Although I believe support for ARM64 was included from .NET Core 2.1 in this example I’ll use the latest .NET Core 3 preview bits2.

  1. Download the latest .NET Core 3 bits into a folder. Ensure you download the ARM64 SDK binaries (should be a tar.gz file).

  2. Open a terminal window by right-clicking the desktop and selecting Open Terminal

  3. Navigate to the folder where you downloaded the SDK (remember Linux is case sensitive)

  4. Create a dotnet folder in your home folder and untar the binaries

    mkdir -p $HOME/dotnet && tar zxf <downloadedFile> -C $HOME/dotnet 
    
    1. We now need to add some paths to the terminal profile (so they are available every time we open the terminal). Edit the bash profile using Vim (if you’re unfamiliar with Vim you’ll need to know some basic commands to avoid needing to restart your computer to exit it ;)

      vi ~/.bashrc
      

      Scroll to the bottom of the bash profile and add the following lines

      # dotnet
      export DOTNET_ROOT=$HOME/dotnet
      export PATH=$PATH:$HOME/dotnet
      
    2. Save the profile and exit

    3. Test that dotnet core is installed by closing the terminal window and re-opening a new terminal and typing

      dotnet --info
      

which should display something like this: "dotnet core info"

Congratulations you’ve got .NET Core running on the Jetson Nano

Creating a hello world application

This is now the same process as you would use to create an application using the .NET CLI on any platform

  1. Create a new folder and move into it

    mkdir code
    cd code
    
    1. Create a new .NET Core console application ```

dotnet new console -n hello-jetson-nano

If all is working you should get a new project created for you
!["dotnet new console result"](/images/2019/jetson-intro/dotnet-new.png)

3. Move to the newly created project folder and run dotnet run
```bash
cd hello-jetson-nano/
dotnet run

"dotnet run console result"

And there we are our first .NET Core application on the Jetson Nano!

It’s worth remembering that dotnet run will compile the code everytime you run it so it may appear to be a little slow to execute. If you want to simply execute the generated binary you need to run

dotnet bin/Debug/netcoreapp3.0/hello-jetson-nano.dll

And you should see this executes almost immediately.

Summary

This quick guide was designed to help you get started with .NET Core on the Jetson (or any other ARM64 device). In subsequent posts we’ll dive a little deeper into AI/ML scenarios and start to see how we can utilise the power of the Jetson.


  1. Ubuntu 18.04.2 LTS at the time of writing [return]
  2. 3.0.100-preview3-010431 at the time of writing [return]

Back to home