Nvidia Jetson Nano ST60-2230C-U instructions

This tutorial covers the integration of Laird Connectivity’s ST60-2230C-U with Wifi interface using USB and Bluetooth interface using UART on a Jetson Nano Developer Kit.

Requirements

Hardware

  • A Linux PC (non-VM) with Ubuntu 18 installed
  • Jetson Nano (with power supply 5V/4A)
  • TTL-RS232-3v3 cable
  • USB micro b cable

Hardware Setup

jetson_nano

ST60-2230C-U installed

jetson_nano_wifibt

Software

This tutorial uses the Nvidia SDK Manager and assumes the user has experience using this tool.

The SDK Manager Guide can be viewed here: NVIDIA SDK Manager Guide

Download and install Nvidia SDK Manager

https://developer.nvidia.com/nvidia-sdk-manager

sdkmanager_1.8.0-10363_amd64.deb is used in this tutorial.

Known good point

Flash the Jetson Nano to bring to a known good point and allow for sdk to be download on Linux PC.

JetPack 4.6.2 is used in this tutorial.

Build

Get gcc toolchain

Get the Nvidia recommended toolchain Linaro 7.3.1 and install.

cd /opt
sudo wget http://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/aarch64-linux-gnu/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz
sudo tar xvf gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz

Get sources using source_sync.sh

cd ~/nvidia/nvidia_sdk/JetPack_4.6.2_Linux_JETSON_NANO_TARGETS/Linux_for_Tegra
./source_sync.sh -t  tegra-l4t-r32.7.1

Note source can alternatively be downloaded from the Jetson Linux R32.7.1 Release Page: https://developer.nvidia.com/embedded/linux-tegra-r3271

Using source from the release page will change the directory structure used in the rest of the tutorial.

Compile kernel

cd ~/nvidia/nvidia_sdk/JetPack_4.6.2_Linux_JETSON_NANO_TARGETS/Linux_for_Tegra/sources/kernel
export JETSON_NANO_KERNEL_SOURCE=$(pwd)
cd $JETSON_NANO_KERNEL_SOURCE

export TOOLCHAIN_PREFIX=/opt/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
export TEGRA_KERNEL_OUT=$JETSON_NANO_KERNEL_SOURCE/build
export KERNEL_MODULES_OUT=$JETSON_NANO_KERNEL_SOURCE/modules
make -C kernel-4.9/ ARCH=arm64 O=$TEGRA_KERNEL_OUT LOCALVERSION=-tegra CROSS_COMPILE=${TOOLCHAIN_PREFIX} tegra_defconfig
make -C kernel-4.9/ ARCH=arm64 O=$TEGRA_KERNEL_OUT LOCALVERSION=-tegra CROSS_COMPILE=${TOOLCHAIN_PREFIX} menuconfig
make -C kernel-4.9/ ARCH=arm64 O=$TEGRA_KERNEL_OUT LOCALVERSION=-tegra CROSS_COMPILE=${TOOLCHAIN_PREFIX} -j8
make -C kernel-4.9/ ARCH=arm64 O=$TEGRA_KERNEL_OUT LOCALVERSION=-tegra INSTALL_MOD_PATH=$KERNEL_MODULES_OUT modules_install

During the menuconfig the following items need removed:

  • deselect Device Drivers -> Network device support -> Wireless LAN
  • deselect Networking support -> Bluetooth subsystem support
  • deselect Networking support -> Wireless
  • deselect Device Drivers -> Misc drivers -> Bluedroid_pm driver support

Copy kernel over to Nvidia SDK Manager directory (kernel)

cd ~/nvidia/nvidia_sdk/JetPack_4.6.2_Linux_JETSON_NANO_TARGETS/Linux_for_Tegra/sources/kernel/build/arch/arm64/boot
cp -r * ~/nvidia/nvidia_sdk/JetPack_4.6.2_Linux_JETSON_NANO_TARGETS/Linux_for_Tegra/kernel/

Delete old kernel modules in Nvidia SDK Manager directory (kernel)

cd ~/nvidia/nvidia_sdk/JetPack_4.6.2_Linux_JETSON_NANO_TARGETS/Linux_for_Tegra/rootfs/lib/modules/4.9.253-tegra/kernel
sudo rm -rf *

Copy kernel modules from build over to Nvidia SDK Manager directory (rootfs)

cd ~/nvidia/nvidia_sdk/JetPack_4.6.2_Linux_JETSON_NANO_TARGETS/Linux_for_Tegra/sources/kernel/modules
sudo cp -r * ~/nvidia/nvidia_sdk/JetPack_4.6.2_Linux_JETSON_NANO_TARGETS/Linux_for_Tegra/rootfs

Get Laird Connectivity backports and firmware

The latest backports and firmware can be found on the Laird Connectivity Github site: https://github.com/LairdCP/Sterling-60-Release-Packages/releases

This tutorial will use backports and firmware from the 9.32.0.6 release.

Verify the backport and firmware version supports the kernel version to be used on the Jetson Nano. In this case the Jetson Nano is using a 4.9 kernel and the 9.32.0.6 driver which supports kernel 3.2-5.10.

The firmware usb-uart is used for the module ST60-2230C-U with USB wifi and UART Bluetooth.

cd ~/nvidia/nvidia_sdk/JetPack_4.6.2_Linux_JETSON_NANO_TARGETS/Linux_for_Tegra/sources/kernel
wget https://github.com/LairdCP/Sterling-60-Release-Packages/releases/download/LRD-REL-9.32.0.6/backports-laird-9.32.0.6.tar.bz2
wget https://github.com/LairdCP/Sterling-60-Release-Packages/releases/download/LRD-REL-9.32.0.6/laird-sterling60-firmware-usb-uart-9.32.0.6.tar.bz2

Extract firmware to Nvidia SDK Manager directory (rootfs)

sudo tar xvf laird-sterling60-firmware-usb-uart-9.32.0.6.tar.bz2 -C ~/nvidia/nvidia_sdk/JetPack_4.6.2_Linux_JETSON_NANO_TARGETS/Linux_for_Tegra/rootfs/

Extract backports and compile

tar xvf backports-laird-9.32.0.6.tar.bz2
cd laird-backport-9.32.0.6

export KLIB_BUILD="/home/laird/nvidia/nvidia_sdk/JetPack_4.6.2_Linux_JETSON_NANO_TARGETS/Linux_for_Tegra/sources/kernel/build"
export KLIB="/home/laird/nvidia/nvidia_sdk/JetPack_4.6.2_Linux_JETSON_NANO_TARGETS/Linux_for_Tegra/sources/kernel/modules"

make ARCH=arm64 CROSS_COMPILE=/opt/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- defconfig-sterling60
make ARCH=arm64 CROSS_COMPILE=/opt/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- -j8

Find backport modules and tar and extract to Nvidia SDK Manager directory (rootfs/lib/modules/4.9.253-tegra/updates)

find . -name *.ko -print0 | tar -cvf laird_modules.tar --null -T -

sudo mkdir /home/laird/nvidia/nvidia_sdk/JetPack_4.6.2_Linux_JETSON_NANO_TARGETS/Linux_for_Tegra/rootfs/lib/modules/4.9.253-tegra/updates
sudo tar xvf laird_modules.tar -C /home/laird/nvidia/nvidia_sdk/JetPack_4.6.2_Linux_JETSON_NANO_TARGETS/Linux_for_Tegra/rootfs/lib/modules/4.9.253-tegra/updates

Flash Jetson Nano

cd ~/nvidia/nvidia_sdk/JetPack_4.6.2_Linux_JETSON_NANO_TARGETS/Linux_for_Tegra
sudo ./flash.sh jetson-nano-qspi-sd mmcblk0p1

Final setup and checks on Jetson Nano

Login to the Jetson Nano

There is a setup after flashing that is required to login, this is done with the graphical interface or via serial port console. This tutorial assumes the user knows this and how to finish setting up the Jetson Nano.

Run depmod

This will probe all the modules on the system and allow the new modules to be seen.

sudo depmod -a

Disable nvgetty and nvwifibt

sudo systemctl disable nvgetty
sudo systemctl disable nvwifibt
sudo reboot

Add user to groups for Bluetooth UART access

The default Jetson Nano platform will not attach the bluetooth UART unless the user is either added to bluetooth and dialout groups or the btattach command is ran as root with ‘sudo su’ not as ‘sudo btattach’. Running ‘sudo btattach’ as a user only works randomly where as ran from a ‘sudo su’ prompt or adding the user to bluetooth and dialout groups works consistently.

sudo usermod -aG bluetooth,dialout laird

check wifi

iw dev


root@ubuntu:/home/laird# iw dev
phy#1
        Interface wlan0
                ifindex 7
                wdev 0x100000001
                addr c0:ee:40:46:c0:20
                type managed
                txpower 20.00 dBm
root@ubuntu:/home/laird#

check bluetooth

BT only wants to attach when ran from root prompt (‘sudo su’ not ‘sudo’) or user is added to bluetooth and dialout groups.

sudo su
btattach -B /dev/ttyTHS2 -P h4 -S 3000000 &


laird@ubuntu:~$ sudo su
[sudo] password for laird:
root@ubuntu:/home/laird# btattach -B /dev/ttyTHS2 -P h4 -S 3000000 &
[1] 7179
root@ubuntu:/home/laird# Attaching Primary controller to /dev/ttyTHS2
Switched line discipline from 0 to 15
Device index 0 attached

root@ubuntu:/home/laird# bluetoothctl
[NEW] Controller C0:EE:40:46:C0:23 ubuntu [default]
Agent registered
[bluetooth]# scan on
Discovery started
[CHG] Controller C0:EE:40:46:C0:23 Discovering: yes
[NEW] Device 6F:4C:F4:B5:75:7A 6F-4C-F4-B5-75-7A
[NEW] Device 47:62:C0:FF:CC:62 47-62-C0-FF-CC-62
[NEW] Device E7:A3:99:CE:06:A2 BL654 BME280 Sensor
[NEW] Device 7B:37:F3:84:DA:9F 7B-37-F3-84-DA-9F
[NEW] Device 00:FE:8D:8E:F9:BB 00-FE-8D-8E-F9-BB
[NEW] Device 44:98:3B:F9:5B:0A 44-98-3B-F9-5B-0A
[NEW] Device 51:A4:5D:6F:60:1D 51-A4-5D-6F-60-1D
[CHG] Device D2:31:30:30:4F:3B RSSI: -96
[NEW] Device 7C:2F:E2:85:AB:00 7C-2F-E2-85-AB-00
[bluetooth]# exit
Agent unregistered
[DEL] Controller C0:EE:40:46:C0:23 ubuntu [default]
root@ubuntu:/home/laird#