Tuesday, May 2, 2023

Jetson Nano Developer Kit essential steps

 
A Jetson Nano Developer Kit with 3rd party active heatsink, Netgear Wifi adapter and protective case

Stats

Install jetson_stats to get information similar to below:



Power Modes and CPU cores

Jetson Nano has 2 power modes. It follows the philosophy "If you need more, you gotta juice me up". 5W power mode only enables 2 out of 4 CPU codes. The MAXN mode enables all 4 cores. The 5W mode surely feels sluggish GUI wise. To enable 4 cores: "sudo nvpmodel -m 0". Reboot isn't necessary.

jtop preview


To toggle back to 5W mode, execute "sudo nvpmodel -m 1"

jtop preview



See below conf file

sharath@sharath-desktop:~/Downloads$ cat /etc/nvpmodel.conf

..... // clocks, GPU information..

###########################
#                         #
# POWER_MODEL DEFINITIONS #
#                         #
###########################

# MAXN is the NONE power model to release all constraints
< POWER_MODEL ID=0 NAME=MAXN >
CPU_ONLINE CORE_0 1
CPU_ONLINE CORE_1 1
CPU_ONLINE CORE_2 1
CPU_ONLINE CORE_3 1
CPU_A57 MIN_FREQ  0
CPU_A57 MAX_FREQ -1
GPU_POWER_CONTROL_ENABLE GPU_PWR_CNTL_EN on
GPU MIN_FREQ  0
GPU MAX_FREQ -1
GPU_POWER_CONTROL_DISABLE GPU_PWR_CNTL_DIS auto
EMC MAX_FREQ 0

< POWER_MODEL ID=1 NAME=5W >
CPU_ONLINE CORE_0 1
CPU_ONLINE CORE_1 1
CPU_ONLINE CORE_2 0
CPU_ONLINE CORE_3 0
CPU_A57 MIN_FREQ  0
CPU_A57 MAX_FREQ 918000
GPU_POWER_CONTROL_ENABLE GPU_PWR_CNTL_EN on
GPU MIN_FREQ 0
GPU MAX_FREQ 640000000
GPU_POWER_CONTROL_DISABLE GPU_PWR_CNTL_DIS auto
EMC MAX_FREQ 1600000000

# mandatory section to configure the default mode
< PM_CONFIG DEFAULT=0 >

Installing Alpaca-Py



Enabling Wifi:

Find the necessary toolchain to install your Wifi Dongle's driver.

For my Netgear dongle, I referred GitHub - jurobystricky/Netgear-A6210: AC1200 High Gain WiFi USB Adapter Linux kernel driver and installed the driver. You can check the driver module listed in "lsmod" output.
Now that the Wifi dongle driver installation is verified, try lsusb and see if you can find your wifi dongle in the list. If lsusb doesn't emit output, it could be very well that the driver is unable to receive any DMA memory allocations due to small coherent_pool size. Run "dmesg" to check for related errors. If this is indeed the case, relevant kernel boot parameters are to be added.

The kernel boot parameters are in /boot/extlinux/extlinux.conf. Add vmalloc=512M cma=64M coherent_pool=32M to the end of the last line. The last line starts with APPEND and is part of the LABEL primary section of the config file. It is a very long line and probably wraps several times in your text editor. It should look like this after editing:

 LABEL primary
   MENU LABEL primary kernel
   LINUX /boot/Image
   ...
   ...
   APPEND fbcon:map0 console=tty0 ... ...
     ... vmalloc=512M cma=64M coherent_pool=32M

After above step, reboot and retry lsusb. If you see your wifi dongle listed, proceed to following instructions:

nmcli r wifi on
nmcli d wifi list
nmcli d wifi connect [SSID] password [PASSWORD]

Installing Kernel Headers:


What follows is just one long alternative way to obtain and configure the “equivalent” of headers. I use this sort of method because full source is almost always better than just headers (only it takes a lot more disk space…but not too much if you don’t build an actual kernel Image). Consider what follows to be a superset of headers, and more extensive than what the 2GB model source would provide. Keep in mind while looking at this that the key to the difference between 2GB and other modules is a combination of device tree and kernel configuration…the source itself is meaningless unless it is configured to match your running system.

Typically you would just download the full source for the kernel. This includes the headers, and if something wants to point at headers, then pointing at the full source also works. The trick is that the source needs to be configured for that particular config (including CONFIG_LOCALVERSION, which usually is “-tegra”).

L4T releases are listed here:
https://developer.nvidia.com/embedded/linux-tegra-archive

For R32.4.4 the URL is here:
https://developer.nvidia.com/embedded/linux-tegra-r3244 

For the Nano of that release the URL of source code shows as:
https://developer.nvidia.com/embedded/L4T/r32_Release_v4.4/r32_Release_v4.4-GMC3/T210/Tegra210_Linux_R32.4.4_aarch64.tbz2 
but this probably does not contain everything the non-Nano sources have. Specifically, the source code of the kernel itself should be the same for the non-Nano versions, and the source for the Nano would be only a subset of what is shown for the Nano. The kernel of the Nano would probably be ok, and there is even a “.deb” package listed which might do what you want, but I suggest looking at this (the non-Nano source):
https://developer.nvidia.com/embedded/L4T/r32_Release_v4.4/r32_Release_v4.4-GMC3/Sources/T186/public_sources.tbz2 

This is a tar archive, and the package path within this archive for “source->public->kernel_src.tbz2” would be the correct content once configuration is set to match the Nano’s configuration. Notice that you’d unpack the full kernel_src.tbz2 since for some NVIDIA components, when configured in the “kernel->kernel-4.9/”, that the config will require a relative path referring to the other subdirectories (most third party configurations would never need this).

If you have a running Nano, then you should see “/proc/config.gz”. If you save a copy of this somewhere (permanent for future use), and then edit just the “CONFIG_LOCALVERSION” (this would be set ‘="-tegra"’ in the file because “-tegra” is the suffix of the output of “uname -r”), then this should be an exact match to your running system and also be the correct “.config” to use with “make prepare” and “make modules_prepare”. Those prepare statements should make the kernel configure to the exact running system if the “.config” is in place, and this in turn should make it possible to treat the full source as if it were the headers only.

Once you have this, point a symbolic link from “/lib/modules/$(uname -r)/build” to the “source->kernel->kernel-4.9/” location and it should work as if it were headers. Example, assuming native build on the Jetson:

cd /lib/modules/$(uname -r)
sudo ln -sf /where/ever/it/is/source->kernel->kernel-4.9 build
# Then verify source exists at "ls /lib/modules/$(uname -r)/build/*".

No comments:

Post a Comment

Please refrain from abusive text.

Note: Only a member of this blog may post a comment.

Jetson AGX Orin setup

Default stats on Jetson AGX Orin  Auto Mounting M.2 SSD on Jetson AGX Orin reference : https://gist.github.com/a-maumau/b826164698da318f992a...