2021年4月13日 星期二

Jetson nano clone SD card

 Kingston Canvas Select Plus microSDXC UHS-I U1 V10 A1 64GB

 sudo parted -l

Model: SD SD64G (sd/mmc)

Disk /dev/mmcblk0: 64.1GB

Sector size (logical/physical): 512B/512B

Partition Table: gpt

Disk Flags: 


Number  Start   End     Size    File system  Name     Flags

 2      1049kB  1180kB  131kB                TBC

 3      2097kB  2556kB  459kB                RP1

 4      3146kB  3736kB  590kB                EBT

 5      4194kB  4260kB  65.5kB               WB0

 6      5243kB  5439kB  197kB                BPF

 7      6291kB  6685kB  393kB                BPF-DTB

 8      7340kB  7406kB  65.5kB               FX

 9      8389kB  8847kB  459kB                TOS

10      9437kB  9896kB  459kB                DTB

11      10.5MB  11.3MB  786kB                LNX

12      11.5MB  11.6MB  65.5kB               EKS

13      12.6MB  12.7MB  81.9kB               BMP

14      13.6MB  13.8MB  131kB                RP4

 1      14.7MB  64.1GB  64.1GB  ext4         APP



sudo dd if=/dev/mmcblk0 conv=sync,noerror bs=64K status=progress | gzip -c > ~/dragon-eye.img.gz

977728+0 records in
977728+0 records out
64076382208 bytes (64 GB, 60 GiB) copied, 1316.25 s, 48.7 MB/s


sudo gunzip -c ~/dragon-eye.img.gz | sudo dd of=/dev/mmcblk0 bs=64k status=progress

117838+1719780 records in
117838+1719780 records out
64076382208 bytes (64 GB, 60 GiB) copied, 2329.99 s, 27.5 MB/s



2021年3月25日 星期四

Jetson Nano Samba Server

1.Install samba

$ sudo apt-get install samba -y

2.Edit /etc/samba/smb.conf

...
[Videos]
   comment = Samba on JetsonNano
   path = /home/gigijoe/Videos
   read only = no
   browsable = yes

3.Restart Samba Server

$ sudo service smbd restart

4.Setup Samba username / password

$ sudo smbpasswd -a gigijoe

5.Open File Viewer and enter URI

smb://192.168.168.67


2021年3月8日 星期一

Jetson Nano EDIMAX EW-7811Un V2 N150 predictible interface names

1. Create new file

/etc/udev/rules.d/10-network-device.rules

with following line

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="xx:xx:xx:xx:xx:xx", NAME="wlanX"

Replacing xx:xx:xx:xx:xx:xx with your device's lowercase mac address (found with ip link) and wlanX with whatever name you choose. 

2.Test

iwconfig

wlan0     IEEE 802.11  Mode:Master  Tx-Power=22 dBm   

          Retry short limit:7   RTS thr:off   Fragment thr:off

          Power Management:on

          

rndis0    no wireless extensions.


lo        no wireless extensions.


l4tbr0    no wireless extensions.


wlan9     unassociated  ESSID:""  Nickname:"<WIFI@REALTEK>"

          Mode:Auto  Frequency=2.412 GHz  Access Point: Not-Associated   

          Sensitivity:0/0  

          Retry:off   RTS thr:off   Fragment thr:off

          Power Management:off

          Link Quality=0/100  Signal level=0 dBm  Noise level=0 dBm

          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0

          Tx excessive retries:0  Invalid misc:0   Missed beacon:0


dummy0    no wireless extensions.


usb0      no wireless extensions.


eth0      no wireless extensions.

Reference

Jetson Nano EDIMAX EW-7811Un V2 N150 as Access Point

1.Build hostapd from source 

cd rtl8188eu/hostapd-0.8/hostapd/

cp defconfig .config

make

2.Edit script control_ap for start / stop AP

cd ../..

diff --git a/control_ap b/control_ap

index c7dbb95..b055c10 100755

--- a/control_ap

+++ b/control_ap

@@ -34,7 +34,7 @@ esac

 IPTABLES=/sbin/iptables

 IFCONFIG=/sbin/ifconfig

 DHCPD=/usr/sbin/dhcpd

-HOSTAPD=/home/finger/rtl8188eu/hostapd-0.8/hostapd/hostapd

+HOSTAPD=/home/gigijoe/rtl8188eu/hostapd-0.8/hostapd/hostapd

 

 # Symbols for AP and external interfaces

 

@@ -75,9 +75,9 @@ start)

         $IFCONFIG $NET_AP up

         $IFCONFIG $NET_AP $AP_ADDR.1

         # dhcpd needs to have a leases file available - create it if needed

-        if [ ! -f /var/lib/dhcp/db/dhcpd.leases ]; then

-               mkdir -p /var/lib/dhcp/db

-                touch /var/lib/dhcp/db/dhcpd.leases

+        if [ ! -f /var/lib/dhcp/dhcpd.leases ]; then

+               mkdir -p /var/lib/dhcp/

+                touch /var/lib/dhcp/dhcpd.leases

         fi

        # Write the DHCP server configuration file

        echo "option domain-name-servers $NAME_SERVER;" > ~/dhcpd.conf

3.Edit /etc/NetworkManager/NetworkManager.conf to unmanager the device

[keyfile]
unmanaged-devices=mac:<hwaddr>

4.Start AP (Default AP SSID is rtwap password 87654321)

sudo ./control_ap start wlan1 eth0

Starting AP mode for wlan1 at address 192.168.0.1

Internet Systems Consortium DHCP Server 4.3.5

Copyright 2004-2016 Internet Systems Consortium.

All rights reserved.

For info, please visit https://www.isc.org/software/dhcp/

Config file: /home/gigijoe/dhcpd.conf

Database file: /var/lib/dhcp/dhcpd.leases

PID file: /var/run/dhcpd.pid

Wrote 0 leases to leases file.

Listening on LPF/wlan1/08:be:ac:15:13:34/192.168.0.0/24

Sending on   LPF/wlan1/08:be:ac:15:13:34/192.168.0.0/24

Sending on   Socket/fallback/fallback-net

random: Trying to read entropy from /dev/random

Configuration file: /home/gigijoe/hostapd.conf

ctrl_interface_group=0

drv->ifindex=8

l2_sock_recv==l2_sock_xmit=0x0x55959e14d0

BSS count 1, BSSID mask 00:00:00:00:00:00 (0 bits)

Allowed channel: mode=1 chan=1 freq=2412 MHz max_tx_power=0 dBm

Allowed channel: mode=1 chan=2 freq=2417 MHz max_tx_power=0 dBm

Allowed channel: mode=1 chan=3 freq=2422 MHz max_tx_power=0 dBm

Allowed channel: mode=1 chan=4 freq=2427 MHz max_tx_power=0 dBm

Allowed channel: mode=1 chan=5 freq=2432 MHz max_tx_power=0 dBm

Allowed channel: mode=1 chan=6 freq=2437 MHz max_tx_power=0 dBm

Allowed channel: mode=1 chan=7 freq=2442 MHz max_tx_power=0 dBm

Allowed channel: mode=1 chan=8 freq=2447 MHz max_tx_power=0 dBm

Allowed channel: mode=1 chan=9 freq=2452 MHz max_tx_power=0 dBm

Allowed channel: mode=1 chan=10 freq=2457 MHz max_tx_power=0 dBm

Allowed channel: mode=1 chan=11 freq=2462 MHz max_tx_power=0 dBm

Allowed channel: mode=1 chan=12 freq=2467 MHz max_tx_power=0 dBm

Allowed channel: mode=1 chan=13 freq=2472 MHz max_tx_power=0 dBm

Allowed channel: mode=0 chan=1 freq=2412 MHz max_tx_power=0 dBm

Allowed channel: mode=0 chan=2 freq=2417 MHz max_tx_power=0 dBm

Allowed channel: mode=0 chan=3 freq=2422 MHz max_tx_power=0 dBm

Allowed channel: mode=0 chan=4 freq=2427 MHz max_tx_power=0 dBm

Allowed channel: mode=0 chan=5 freq=2432 MHz max_tx_power=0 dBm

Allowed channel: mode=0 chan=6 freq=2437 MHz max_tx_power=0 dBm

Allowed channel: mode=0 chan=7 freq=2442 MHz max_tx_power=0 dBm

Allowed channel: mode=0 chan=8 freq=2447 MHz max_tx_power=0 dBm

Allowed channel: mode=0 chan=9 freq=2452 MHz max_tx_power=0 dBm

Allowed channel: mode=0 chan=10 freq=2457 MHz max_tx_power=0 dBm

Allowed channel: mode=0 chan=11 freq=2462 MHz max_tx_power=0 dBm

Allowed channel: mode=2 chan=36 freq=5180 MHz max_tx_power=0 dBm

Allowed channel: mode=2 chan=40 freq=5200 MHz max_tx_power=0 dBm

Allowed channel: mode=2 chan=44 freq=5220 MHz max_tx_power=0 dBm

Allowed channel: mode=2 chan=48 freq=5240 MHz max_tx_power=0 dBm

Allowed channel: mode=2 chan=149 freq=5745 MHz max_tx_power=0 dBm

Allowed channel: mode=2 chan=153 freq=5765 MHz max_tx_power=0 dBm

Allowed channel: mode=2 chan=157 freq=5785 MHz max_tx_power=0 dBm

Allowed channel: mode=2 chan=161 freq=5805 MHz max_tx_power=0 dBm

Allowed channel: mode=2 chan=165 freq=5825 MHz max_tx_power=0 dBm

Completing interface initialization

Mode: IEEE 802.11g  Channel: 11  Frequency: 2462 MHz

RATE[0] rate=10 flags=0x1

RATE[1] rate=20 flags=0x1

RATE[2] rate=55 flags=0x1

RATE[3] rate=110 flags=0x1

RATE[4] rate=60 flags=0x0

RATE[5] rate=90 flags=0x0

RATE[6] rate=120 flags=0x0

RATE[7] rate=180 flags=0x0

RATE[8] rate=240 flags=0x0

RATE[9] rate=360 flags=0x0

RATE[10] rate=480 flags=0x0

RATE[11] rate=540 flags=0x0

Flushing old station entries

Deauthenticate all stations

+rtl871x_sta_deauth_ops, ff:ff:ff:ff:ff:ff is deauth, reason=2

rtl871x_set_key_ops

rtl871x_set_key_ops

rtl871x_set_key_ops

rtl871x_set_key_ops

Using interface wlan1 with hwaddr 08:be:ac:15:13:34 and ssid 'rtwap'

Deriving WPA PSK based on passphrase

SSID - hexdump_ascii(len=5):

     72 74 77 61 70                                    rtwap           

PSK (ASCII passphrase) - hexdump_ascii(len=8): [REMOVED]

PSK (from passphrase) - hexdump(len=32): [REMOVED]

rtl871x_set_wps_assoc_resp_ie

rtl871x_set_wps_beacon_ie

rtl871x_set_wps_probe_resp_ie

random: Got 20/20 bytes from /dev/random

Get randomness: len=32 entropy=0

GMK - hexdump(len=32): [REMOVED]

Get randomness: len=32 entropy=0

Key Counter - hexdump(len=32): [REMOVED]

WPA: group state machine entering state GTK_INIT (VLAN-ID 0)

Get randomness: len=16 entropy=0

GTK - hexdump(len=16): [REMOVED]

WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0)

rtl871x_set_key_ops

rtl871x_set_beacon_ops

wlan1: Setup of interface done.


iwconfig

wlan1     IEEE 802.11bgn  ESSID:"rtwap"  Nickname:"<WIFI@REALTEK>"
          Mode:Master  Frequency:2.462 GHz  Access Point: 08:BE:AC:15:13:34   
          Sensitivity:0/0  
          Retry:off   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=100/100  Signal level=-36 dBm  Noise level=0 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0


5.Stop AP

sudo ./control_ap stop

Reference

https://wiki.archlinux.org/index.php/Software_access_point_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)


2021年2月23日 星期二

Jetson Nano EDIMAX EW-7811Un V2 N150 wifi dongle

git clone https://github.com/lwfinger/rtl8188eu.git

cd rtl8188eu

make

sudo make install


gigijoe@gigijoe-desktop:~/rtl8188eu$ make

make: Warning: File 'Makefile' has modification time 5690693 s in the future

make ARCH=arm64 CROSS_COMPILE= -C /lib/modules/4.9.140-tegra/build M=/home/gigijoe/rtl8188eu  modules

make[1]: Entering directory '/usr/src/linux-headers-4.9.140-tegra-ubuntu18.04_aarch64/kernel-4.9'

  CC [M]  /home/gigijoe/rtl8188eu/core/rtw_ap.o

  CC [M]  /home/gigijoe/rtl8188eu/core/rtw_br_ext.o

  CC [M]  /home/gigijoe/rtl8188eu/core/rtw_cmd.o

  CC [M]  /home/gigijoe/rtl8188eu/core/rtw_debug.o

  CC [M]  /home/gigijoe/rtl8188eu/core/rtw_efuse.o

  CC [M]  /home/gigijoe/rtl8188eu/core/rtw_ieee80211.o

  CC [M]  /home/gigijoe/rtl8188eu/core/rtw_io.o

  CC [M]  /home/gigijoe/rtl8188eu/core/rtw_ioctl_set.o

  CC [M]  /home/gigijoe/rtl8188eu/core/rtw_iol.o

  CC [M]  /home/gigijoe/rtl8188eu/core/rtw_led.o

  CC [M]  /home/gigijoe/rtl8188eu/core/rtw_mlme.o

  CC [M]  /home/gigijoe/rtl8188eu/core/rtw_mlme_ext.o

  CC [M]  /home/gigijoe/rtl8188eu/core/rtw_mp.o

  CC [M]  /home/gigijoe/rtl8188eu/core/rtw_mp_ioctl.o

  CC [M]  /home/gigijoe/rtl8188eu/core/rtw_pwrctrl.o

  CC [M]  /home/gigijoe/rtl8188eu/core/rtw_p2p.o

  CC [M]  /home/gigijoe/rtl8188eu/core/rtw_recv.o

  CC [M]  /home/gigijoe/rtl8188eu/core/rtw_rf.o

  CC [M]  /home/gigijoe/rtl8188eu/core/rtw_security.o

  CC [M]  /home/gigijoe/rtl8188eu/core/rtw_sreset.o

  CC [M]  /home/gigijoe/rtl8188eu/core/rtw_sta_mgt.o

  CC [M]  /home/gigijoe/rtl8188eu/core/rtw_wlan_util.o

  CC [M]  /home/gigijoe/rtl8188eu/core/rtw_xmit.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/HalHWImg8188E_MAC.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/HalHWImg8188E_BB.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/HalHWImg8188E_RF.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/HalPhyRf.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/HalPhyRf_8188e.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/HalPwrSeqCmd.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/Hal8188EPwrSeq.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/Hal8188ERateAdaptive.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/hal_intf.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/hal_com.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/odm.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/odm_debug.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/odm_interface.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/odm_HWConfig.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/odm_RegConfig8188E.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/odm_RTL8188E.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/rtl8188e_cmd.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/rtl8188e_dm.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/rtl8188e_hal_init.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/rtl8188e_mp.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/rtl8188e_phycfg.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/rtl8188e_rf6052.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/rtl8188e_rxdesc.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/rtl8188e_sreset.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/rtl8188e_xmit.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/rtl8188eu_led.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/rtl8188eu_recv.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/rtl8188eu_xmit.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/usb_halinit.o

  CC [M]  /home/gigijoe/rtl8188eu/hal/usb_ops_linux.o

  CC [M]  /home/gigijoe/rtl8188eu/os_dep/ioctl_linux.o

  CC [M]  /home/gigijoe/rtl8188eu/os_dep/mlme_linux.o

  CC [M]  /home/gigijoe/rtl8188eu/os_dep/os_intfs.o

  CC [M]  /home/gigijoe/rtl8188eu/os_dep/osdep_service.o

  CC [M]  /home/gigijoe/rtl8188eu/os_dep/recv_linux.o

  CC [M]  /home/gigijoe/rtl8188eu/os_dep/rtw_android.o

  CC [M]  /home/gigijoe/rtl8188eu/os_dep/usb_intf.o

  CC [M]  /home/gigijoe/rtl8188eu/os_dep/usb_ops_linux.o

  CC [M]  /home/gigijoe/rtl8188eu/os_dep/xmit_linux.o

  LD [M]  /home/gigijoe/rtl8188eu/8188eu.o

make[2]: warning:  Clock skew detected.  Your build may be incomplete.

  Building modules, stage 2.

  MODPOST 1 modules

  CC      /home/gigijoe/rtl8188eu/8188eu.mod.o

  LD [M]  /home/gigijoe/rtl8188eu/8188eu.ko

make[2]: warning:  Clock skew detected.  Your build may be incomplete.

make[1]: Leaving directory '/usr/src/linux-headers-4.9.140-tegra-ubuntu18.04_aarch64/kernel-4.9'

make: warning:  Clock skew detected.  Your build may be incomplete.

gigijoe@gigijoe-desktop:~/rtl8188eu$ sudo make install

[sudo] password for gigijoe: 

install -p -m 644 8188eu.ko  /lib/modules/4.9.140-tegra/kernel/drivers/net/wireless

cp rtl8188eufw.bin /lib/firmware/.

/sbin/depmod -a 4.9.140-tegra

mkdir -p /lib/firmware/rtlwifi

cp rtl8188eufw.bin /lib/firmware/rtlwifi/.

sudo reboot

gigijoe@gigijoe-desktop:~$ iwconfig

wlan0     IEEE 802.11  Mode:Master  Tx-Power=22 dBm   

          Retry short limit:7   RTS thr:off   Fragment thr:off

          Power Management:on

          

rndis0    no wireless extensions.


lo        no wireless extensions.


l4tbr0    no wireless extensions.


dummy0    no wireless extensions.


usb0      no wireless extensions.


eth0      no wireless extensions.


wlan1     unassociated  ESSID:""  Nickname:"<WIFI@REALTEK>"

          Mode:Managed  Frequency=2.412 GHz  Access Point: Not-Associated   

          Sensitivity:0/0  

          Retry:off   RTS thr:off   Fragment thr:off

          Power Management:off

          Link Quality=0/100  Signal level=0 dBm  Noise level=0 dBm

          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0

          Tx excessive retries:0  Invalid misc:0   Missed beacon:0




2021年2月9日 星期二

dragon-eye - F3F real-time electronic judging system with Jetson Nano

 F3F is an radio control aeromodelling sport, slope soaring gliders.

F3F - SLOPE SOARING GLIDERS

As the name depicts, this event is flown in front of a slope, taking advantage of the updrafts created by the wind. In the single Speed task the pilot tries to fly its model over a 1000m course (composed of 10 X 100 meter legs) in the shortest possible time.

At least four rounds should be completed in order to determine the winner.

F3F glider
F3F human judging

dragon-eye is an F3F real-time electronic judging system with Jetson Nano. It's base on technology of computer vision, capture video stream from camera then detect moving objects and keeps tracking them, once one of the tracking target across central vertical line, trigger out a signal. 




Feature
- Multi moving targets tracking base on technology of background subtraction (MOG2)
- Camera resolution is 720p and frame rate is limited to 30 fps
- Supports selection 1 of 2 cameras with different angle of view
- Trigger out GPIO / UART / UDP when target across central line
- Record video files to SD card with or without tracking result
- Built-in wifi AP for connectivity
- Built-in RTSP video server (H.265 codec)
- Video output can be one of the following option HDMI / RTP / HLS / RTSP (Prefer RTSP)
- Android APP to start / stop / config / play RTSP video stream
- Written in c/c++ for running performance
- Background subtraction runnung by GPU to improve real-time performance
- Camera settings for different scenes such as dim light or over exposure
- Adjustable MOG2 threshold to reduce nosie or improve object detection 

Source code and more detail please refer to dragon-eye

Android APP dragon-eye-rc
- Remote control dragon-eye from Android phone
- Connect dragon-eye through wifi
- Start / Stop dragon-eye
- System config / Camera config
- Play video from RTSP server of dragon-eye
- Play sound with trigger

System Steeings screenshot

Camera Settings screenshot

Main screenshot

RTSP video stream screenshot


- An program running on PC Ubuntu desktop for development of dragon-eye
- It process video file from dragon-eye and output result on screen or to file

Demo video : Good result of glider go through complex background under horizon 

Demo video : Glider flying in far distance. There's a bug make false trigger

Demo video : High speed pass by


Demo video : Birds across screen and varios bugs fool around



Full scale test

2021年2月5日 星期五

Jetson nano build darknet

 Log of build darknet on Jetson nano


git clone https://github.com/AlexeyAB/darknet.git

cd darknet

vi Makefile


export PATH=$PATH:/usr/local/bin:/usr/local/cuda/bin

export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/cuda/lib

make