我是直接购买的微雪 Jetson nano 开发板,它基于 Jetson Nano Module 核心板,提供与官方的 Jetson Nano Developer Kit (B01) 几乎一模一样的外设接口、大小及厚度
Jetson Nano Module 参数
JETSON-IO-BASE-A 底板资源
如果购买的是微雪提供的带核心板的 Nano 套件,出厂的时候就已经预先烧好了 JetPack4.6 镜像在 emmc 上,且已经设置了 SD 卡识别,可以跳过这一步。如果需要修改 SD 卡启动,请查看使用手册修改启动路径即可
系统安装
ls /dev/sd*
sudo mkfs.ext4 dev/sda
APPEND ${cbootargs} quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyS0,115200n8 console=tty0
, 将 mmcblk0p1
修改为 sda
保存sudo vi /boot/extlinux/extlinux.conf
sudo mount /dev/sda /mnt
sudo cp -ax / /mnt
sudo umount /mnt/
sudo reboot
设备树时能 SD 卡
sudo apt-get install device-tree-compiler
# 若使用的 SDK Manager 软件请使用以下命令
cd ~/nvidia/nvidia_sdk/JetPack_4.6_Linux_JETSON_NANO_TARGETS/Linux_for_Tegra/kernel/dtb #(针对不同jetpack,修改对应路径)
dtc -I dtb -O dts -o tegra210-p3448-0002-p3449-0000-b00.dts tegra210-p3448-0002-p3449-0000-b00.dtb
# 若使用的资源包请使用以下命令
cd sources_nano/Linux_for_Tegra/kernel/dtb
sudo dtc -I dtb -O dts -o tegra210-p3448-0002-p3449-0000-b00.dts tegra210-p3448-0002-p3449-0000-b00.dtb
sudo gedit tegra210-p3448-0002-p3449-0000-b00.dts
sdhci@700b0400
部分,将 status = "disable"
改成 status = "okay"
,并在下面添加 TF 信息cd-gpios = <0x5b 0xc2 0x0>;
sd-uhs-sdr104;
sd-uhs-sdr50;
sd-uhs-sdr25;
sd-uhs-sdr12;
no-mmc;
uhs-mask = <0xc>;
sudo dtc -I dts -O dtb -o tegra210-p3448-0002-p3449-0000-b00.dtb tegra210-p3448-0002-p3449-0000-b00.dts
# 若使用的 SDK Manager 软件请使用以下命令:
cd ~/nvidia/nvidia_sdk/JetPack_4.6_Linux_JETSON_NANO_TARGETS/Linux_for_Tegra
sudo ./flash.sh jetson-nano-emmc mmcblk0p1
# 若使用的资源包请使用以下命令:
cd sources_nano/Linux_for_Tegra
sudo ./flash.sh jetson-nano-emmc mmcblk0p1
sudo ls /dev/mmcblk*
安装系统 - 直接复制 eMMC 上系统 (该操作会格式化 TF 卡 )
sudo umount /media/(这里按下 Tab 键自动补全)
)sudo mkfs.ext4 /dev/mmcblk1
sudo mount /dev/mmcblk1 /mnt
sudo cp -ax / /mnt
sudo umount /mnt/
下载其他镜像
修改从 SD 卡启动系统 (可选)
sudo vi /boot/extlinux/extlinux.conf
APPEND ${cbootargs} quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyS0,115200n8 console=tty0
, 将 mmcblk0p1
改成 mmcblk1
, 保存,然后重启系统即可扩容镜像
df -h
,查看磁盘大小,若空间大小显示小于 64G,可以按如下方法扩容镜像:cd /usr/lib/nvidia/resizefs/
sudo chmod 777 nvresizefs.sh
sudo ./nvresizefs.sh
sudo reboot
sudo apt update
sudo apt install nvidia-jetpack
# 风扇转速调节
# 255 是最大转速,0 是停止
sudo sh -c 'echo 255 > /sys/devices/pwm-fan/target_pwm'
# 获取 CPU 温度,可以通过程序智能控制风扇
cat /sys/class/thermal/thermal_zone0/temp
sudo apt update
sudo apt-get install python3-pip python3-dev
# 默认安装的 PIP 是 9.01 版本,需要把它升级到最新版
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade --force-reinstall pip
sudo reboot
# 查看 pip3 版本
pip3 -V
~/.bashrc
最后添加echo "export OPENBLAS_CORETYPE=ARMV8" >> ~/.bashrc
sudo apt-get install python3-numpy
sudo apt-get install python3-scipy
sudo apt-get install python3-pandas
sudo apt-get install python3-matplotlib
sudo apt-get install python3-sklearn
注意:需要先进行 SDK 安装来安装 CUDA
sudo vim .bashrc
export PATH=/usr/local/cuda-10.2/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
export CUDA_HOME=$CUDA_HOME:/usr/local/cuda-10.2
# 查看 CUDA 版本
nvcc -V
sudo apt-get install libjpeg-dev zlib1g-dev libpython3-dev libavcodec-dev libavformat-dev libswscale-dev libopenblas-base libopenmpi-dev
sudo pip3 install torch-1.9.0-cp36-cp36m-linux_aarch64.whl
pip3 install torchvision==0.10.0
Warning: Jetson-io.py 无法支持 Jetson Nano B01 带 emmc 模组版本,因此用户无法通过 jetson-io.py 来直接配置 40PIN 引脚
sudo /opt/nvidia/jetson-io/jetson-io.py
使能 SPI
资源下载 (Jetpack 4.6.2)
sudo mkdir sources_nano
cd sources_nano
wget https://developer.nvidia.com/embedded/l4t/r32_release_v7.2/t210/jetson-210_linux_r32.7.2_aarch64.tbz2
wget https://developer.nvidia.com/embedded/l4t/r32_release_v7.2/t210/tegra_linux_sample-root-filesystem_r32.7.2_aarch64.tbz2
sudo tar -xjvf jetson-210_linux_r32.7.2_aarch64.tbz2
cd Linux_for_Tegra/rootfs/
sudo tar -xjvf ../../tegra_linux_sample-root-filesystem_r32.7.2_aarch64.tbz2
cd ../
sudo ./apply_binaries.sh # 若出现报错按照系统提示操作,然后再次输入该行命令
修改设备树
sudo apt-get install -y device-tree-compiler
cd kernel/dtb
sudo dtc -I dtb -O dts -o tegra210-p3448-0002-p3449-0000-b00.dts tegra210-p3448-0002-p3449-0000-b00.dtb
sudo cp tegra210-p3448-0002-p3449-0000-b00.dts tegra210-p3448-0002-p3449-0000-b00-bak.dts
sudo gedit tegra210-p3448-0002-p3449-0000-b00.dts
sudo dtc -I dts -O dtb -o tegra210-p3448-0002-p3449-0000-b00.dtb tegra210-p3448-0002-p3449-0000-b00.dts
重新烧录系统
cd ../../
sudo ./flash.sh jetson-nano-emmc mmcblk0p1
加载内核模块
pip install spidev
echo "sudo modprobe spidev" >> ~/.bashrc
source ~/.bashrc
测试 SPI
git clone https://github.com/rm-hull/spidev-test
cd spidev-test/
gcc spidev_test.c -o spidev_test
./spidev_test -v -D /dev/spidev0.0 -p "Test"
硬件连接
测试摄像头
ls /dev/video*
测试 video 0
DISPLAY=:0.0 nvgstcapture-1.0 --sensor-id=0
测试 video 1
DISPLAY=:0.0 nvgstcapture-1.0 --sensor-id=1
如果摄像头拍摄效果偏红的话,可以按照一下步骤操作
# 下载 camera-override.isp 文件,解压到特定文件夹
wget http://www.waveshare.net/w/upload/e/eb/Camera_overrides.tar.gz
tar zxvf Camera_overrides.tar.gz
sudo cp camera_overrides.isp /var/nvidia/nvcam/settings/
# 安装文件
sudo chmod 664 /var/nvidia/nvcam/settings/camera_overrides.isp
sudo chown root:root /var/nvidia/nvcam/settings/camera_overrides.isp
git clone https://github.com/IntelRealSense/librealsense.git
# install necessary packages
sudo apt-get install libxrandr-dev
sudo apt-get install libxinerama-dev
sudo apt-get install libsdl2-dev
mkdir build
cd build
# cmake 时需要下载一个 github 仓库,因此需要确保网络可以访问 github
cmake ../ -DBUILD_PYTHON_BINDINGS:bool=true -DPYTHON_EXECUTABLE=/usr/bin/python3.6
make -j4
sudo make install
# 把下面的命令写入 ~/.bashrc
export PATH=$PATH:~/.local/bin
export PYTHONPATH=$PYTHONPATH:/usr/local/lib
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python3.6/pyrealsense2
Test
# First import the library
import pyrealsense2 as rs
# Create a context object. This object owns the handles to all connected realsense devices
pipeline = rs.pipeline()
pipeline.start()