Leopard Thermal IP Camera Dev Kit Setup Leopard Imaging Inc. Aug, 2013 Version 1.1 Overview LI-THERMAL-DEV - Utilizing technology advances and expansion into high-volume, low cost manufacturing, Leopard Imaging brings affordable Thermal Imaging technology to commercial surveillance and security application. With a detection range of up to 1km, Leopard Thermal IP Camera employs uncooled 320x240, 17um VOx thermal imaging technology, unlike other surveillance camera, this Thermal IP camera does NOT require any ambient light or illumination. It detects infrared (heat) waves to provide users with superior thermal images in challenging environments, including complete darkness, over water and in dark corners, where threats are difficult to detect due to lighting constraints and weather conditions. The thermal development kit is an Internet Protocol (IP) networked solution. conforming to the Open Network Video Interface Forum (ONVIF) standard, which can be accessed by most of ONVIF compliance NVR and VMS. This document provides the procedure to setup the DRS SDK. The procedure includes Thermal IP camera setup, Linux server environment setup, Compile DRS SDK, Load firmware to board and extract raw data from Motion Jpeg stream. 2 Contents Overview ................................................................................................................................................... 2 Thermal IP Camera Dev Kit includes .................................................................................................... 4 1. Set up Thermal IP Camera Dev Kit ................................................................................................... 5 2. Set up Linux Server Environment ..................................................................................................... 6 2.1 Install Ubuntu 10.04 ...................................................................................................................... 6 2.2 Set up Linux Server Environment ............................................................................................... 9 2.3 Set MontaVista tool chain ........................................................................................................... 12 3. Compile DRS SDK ............................................................................................................................. 14 3.1 Unzip LI DRS SDK package....................................................................................................... 14 3.2 Compile SDK ................................................................................................................................ 14 4. Load the firmware to camera board ................................................................................................ 15 4.1 Set up Putty on host PC for serial communication ................................................................... 15 4.2 Set up hardware ........................................................................................................................... 16 4.3 Set u-boot environment ............................................................................................................... 17 4.4 Load firmware to board and save them on NAND flash ......................................................... 18 5. Run Demo ........................................................................................................................................... 19 5.1 Get the IP address ........................................................................................................................ 19 5.2 Login IE interface ........................................................................................................................ 20 6. Record MJPEG stream and extract raw data ................................................................................. 21 6.1 Install VLC Media Player ........................................................................................................... 21 6.2 Get MJPEG stream from VLC ................................................................................................... 21 6.3 Record MJPEG stream with RAW data .................................................................................... 21 6.4 Extract the Raw data ................................................................................................................... 22 7. Update camera application and FPGA application ........................................................................ 23 7.1 Update camera application ......................................................................................................... 23 7.2 Update FPGA application ........................................................................................................... 23 Appendix ................................................................................................................................................. 24 1. Get the IP address on Windows XP.............................................................................................. 24 2. Install Add-on to get the IE Interface .......................................................................................... 26 3 Thermal IP Camera Dev Kit includes: Interposer Board Part#: LI-DRS-INTERPOSER Leopard Board 368 Part#: LI-TB02 Tamarisk 320 Camera Head ( Not included in the kit ) Leopard Board Adapter Part#: LI-VCAMADAPTER 36-PIN Flex Cable Part#: LI-FLEX03 Serial Debugger Cable Part#: LI-SER-01 5V DC Power Adapter Part#: LI-PS5-01 4 1. Set up Thermal IP Camera Dev Kit 5 2. Set up Linux Server Environment 2.1 Install Ubuntu 10.04 2.1.1 Download and install VMware player (Host is windows OS) You can use the link below to download VMware player https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/5_0 2.1.2 Download and install Ubuntu 10.04 You can download 32 bit (x86) Ubuntu 10.04 desktop iso image from Ubuntu website. http://old-releases.ubuntu.com/releases/10.04.3/ After you install VMware player and get Ubuntu 10.04 iso image, open the VMware player. Click Create a New Virtual Machine. Then select Installer disc image file(iso) and choose the Ubuntu iso image from your PC. 6 After enter the linux name, password and the virtual machine name, you will get following window. Specify the Maximum disk size, it should be more than 30 GB. More is better. When you Customize Hardware, please set the hardware like the following. 7 Then install Ubuntu. 8 2.2 Setup Linux Server Environment After Ubuntu installation, login to Ubuntu OS. 2.2.1 Setup Static IP Right click on the top panel. Then click Edit Connections... Click Add. Edit the wired connection according to your router IP address. If your IP is 192.168.1.xx, you need to change 0 to 1,like 192.168.1.16;192.168.1.1 9 Click Apply and Close. And change the network from “Auto eth0” to “Wired connection 1”, you may open the browser to check whether this network works or not. 2.2.2 update your apt-get host $ sudo apt-get update 2.2.3 setup tftp server host $ sudo apt-get install xinetd tftpd tftp host $ sudo mkdir /tftpboot host $ sudo chmod -R 777 /tftpboot host $ sudo chown -R nobody /tftpboot Create /etc/xinetd.d/tftp by using vi or gedit (sudo vi /etc/xinetd.d/tftp) host $ sudo gedit /etc/xinetd.d/tftp add the following to the empty file: service tftp { protocol = udp port = 69 socket_type = dgram wait = yes user = nobody server = /usr/sbin/in.tftpd server_args = -s /tftpboot disable = no } host $ sudo /etc/init.d/xinetd restart 2.2.4 setup samba host $ sudo apt-get install samba smbfs host $ sudo smbpasswd -a <username> host $ sudo mkdir /work host $ sudo chmod 777 /work Note: <username> in the above command is the user name of Ubuntu OS. Edit (sudo vi or sudo gedit) /etc/samba/smb.conf, 10 host $ sudo gedit /etc/samba/smb.conf add the following to the end [work] path = /work read only = no browseable = yes comment = work directory [tftpboot] path = /tftpboot read only = no browseable = yes comment = tftpboot directory host $ sudo /etc/init.d/samba restart Note: After you do above command, you may get the following message, never mind about this, please continue. sudo: /etc/init.d/samba: command not found 2.2.5 setup ssh host $ sudo apt-get install ssh 2.2.6 setup NFS host $ sudo apt-get install nfs-kernel-server nfs-common Edit /etc/exports, host $ sudo gedit /etc/exports add the following: /work/DRS_SDK/fs *(rw,no_root_squash,no_all_squash,sync) host $ sudo exportfs -a host $ sudo /etc/init.d/nfs-kernel-server restart Note: If there is no /work/DRS_SDK/fs, an error will occur, this problem can be fixed when you use NFS ) 11 2.2.7 install software packages for development host $ sudo apt-get install ncurses-dev host $ sudo apt-get install mkcramfs 2.3 Set MontaVista tool chain Before Set MontaVista tool chain, you need to download two files from http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/dvsdk/DVSDK_2_10/latest/index_FDS.html Download LSP 02_10_00_14 and MVL5.0 Tools on the list. You will get two files: mvl_5_0_0_demo_lsp_setuplinux_02_10_00_14.bin mvl_5_0_0801921_demo_sys_setuplinux.bin Copy two files to /tmp . For MontaVista tool chain setup, please refer to: http://wiki.davincidsp.com/index.php/GSG:_DVSDK_2.0_Software_Setup_in_Ubuntu For saving your time, you just need to do two things as following: 2.3.1 Set MontaVista tool chain To Set MontaVista tool chain, follow these steps: 1) Open a new terminal window. You will need root privelages to allow you to successfully run the graphical installer to install MontaVista Linux so you will need to use the gksudo in addition to the normal sudo command which will ask for your password in the coming instructions. 2) We suggest that you create a directory called /opt/mv_pro_5.0 using the following command. This will be the directory into which you install the software. host $ sudo mkdir /opt/mv_pro_5.0 3) Ensure that the installer files are executable using sudo chmod 777. For example: host $ cd /tmp host $ sudo chmod 777 mvl_5_0_#_demo_sys_setuplinux.bin host $ sudo chmod 777 mvl_5_0_0_demo_lsp_setuplinux_#_#_#_#.bin 12 3) Execute each of the following bin files (where #_#_#_# is the current version number) from the temporary location that they were copied in order to extract the installers for the Linux tools, Linux kernel, and the file system. Instead of the default installation directory, change the installation directory to the new directory you created previously (/opt/mv_pro_5.0). host $ cd /tmp host $ gksudo ./mvl_5_0_#_demo_sys_setuplinux.bin host $ gksudo ./mvl_5_0_0_demo_lsp_setuplinux_#_#_#_#.bin 4) After you execute these .bin files, make sure the following files are located in /opt/mv_pro_5.0 (or in the /mv_pro_5.0 subdirectory of the directory you chose in place of the default): host $ ls /opt/mv_pro_5.0 DaVinciLSP_#_#_#_#.tar.gz mvltools5_0_#######.tar.gz uninstall 5) Go to the location where you will unpack the tar files. For example: host $ cd /opt/mv_pro_5.0 6) Unpack the tar files with sudo by using the following commands: host $ sudo tar -zxvf mvltools5_0_#######.tar.gz host $ sudo tar -zxvf DaVinciLSP_#_#_#_#.tar.gz This creates the MontaVista directory structure under the /opt/mv_pro_5.0/montavista/ directory. Note that unpacking these tar files will overwrite any existing files that were previously installed. 2.3.2 Set the PATH Set your PATH so that the MontaVista tool chain host tools and cross compiler (arm_v5t_le-gcc) can be found. First we open the .bashrc file: host $ gedit ~/.bashrc Then add the export command below to the end of .bashrc file: export PATH="/opt/mv_pro_5.0/montavista/pro/devkit/arm/v5t_le/bin:/opt/mv_pro _5.0/montavista/pro/bin:/opt/mv_pro_5.0/montavista/common/bin:$PATH" 13 Note: Please remove the space between “/mv_pro” (1st line) and “ _5.0” (2nd line) after you copy above command to .bashrc file. Then reopen the Terminal to check the PATH. 3. Compile LI DRS SDK Please download the LI DRS SDK package LI_DRS_SDK.tgz from the link below. https://www.leopardimaging.com/Thermal_IP_Camera_Dev_Ki.html#3 Copy the package to /work. 3.1 Unzip LI DRS SDK package Go to /work host $ cd /work host $ sudo tar zxvf LI_DRS_SDK.tgz host $ sudo chown -R <username> DRS_SDK 3.2 Compile SDK host $ cd DRS_SDK host $ make all After do make all, you will get ipnc_cramfsImage and rootfs_cramfsImage under DRS_SDK/bin/fs. Note: After you modify the SDK, just do make all, you will get the new ipnc_cramfsImage and rootfs_cramfsImage. The vendor provides other 3 files ( bin/data1/data1.jffs2, bin/lsp/uImage, bin/vendor/vendor.cramfs). 14 4. Load the firmware to camera board Copy uImage, ipnc_cramfsImage, rootfs_cramfsImage, data1.jffs2, vendor.cramfs to /tftpboot. Note: The operation from section 4 to section 6.3 and section 7 will be under Windows OS. 4.1. Set up Putty on host PC for serial communication Putty is recommended to be used in order to read serial information from the board. It can be downloaded from the link below. Other software such as Hyperterminal or tera term can also be used. http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html Once Putty is installed, open it and select “Serial”. Configure it as shown below. *Note: You can find the COM port number in the Device Manager. 15 After setting up the parameter, click open and you'll see the interface shown below: 4.2 Set up hardware IMPORTANT WARNING: Always UNPLUG the power from the board if you need to remove or attach ANY of the camera parts/cords. You may cause serious damage to the board if you ignore this warning. 16 After the power is inserted, the serial port should start the log information. (To Putty on Host machine) Press any key immediately to stop the auto boot at the very beginning and you should see the u-boot prompt (Leopard 365 :>). 4.3 Set u-boot environment In putty (or another serial interface), enter the commands below to set the boot environment variables and save them. (*Note: All “setenv” and “saveenv” commands indicate a new line and should be on separate lines. Enter each line, one at a time followed by pressing “Enter” on the keyboard. When you see < > you need to input your own unique specifications here. Do not include the < > brackets in the putty screen commands.) setenv ipaddr <Board_IP> setenv serverip <TFTP_server_IP> setenv bootcmd 'nboot 0x80000000 0 0x500000;bootm 0x80000000' setenv bootargs console=ttyS0,115200n8 root=/dev/mtdblock3 rootfs=cramfs mem=48M ip=none eth=00:01:01:00:00:11 mtdparts=nand_davinci.0:3m(bootloader)ro,2m(params),5m@5242880(kernel1),16m@10 485760(rootfs),2m@27262976(private),24m@29360128(filefs),-@54525952(vendor) setenv pro_sensor DRS_Sensor 17 setenv pro_hwver IPCAM21 setenv pro_extent P saveenv Note: The value of eth can be changed to change the IP address which you will get in part 5.1. You can set the <Board_IP> by yourself, e.g. 192.168.0.30; The server IP is the IP address of your Ubuntu OS, e.g. 192.168.0.22 4.4 Load firmware to board and save them on NAND flash On the board (Putty), enter the commands below to download the firmware and save them onto the board tftp 80000000 uImage nand erase 500000 400000 nand write 80000000 500000 400000 tftp 82000000 ipnc_cramfsImage nand erase 1c00000 1000000 nand write 82000000 1c00000 1000000 tftp 82000000 rootfs_cramfsImage nand erase a00000 1000000 nand write 82000000 a00000 1000000 tftp 80000000 data1.jffs2 nand erase 1a00000 200000 nand write 80000000 1a00000 200000 tftp 80000000 vendor.cramfs nand erase 3400000 200000 nand write 80000000 3400000 200000 18 5. Run Demo After you burn the firmware, re-plug in the power adapter (or enter the command “boot”) to run the demo. Log information will be printed from the serial window showing the status of when booting the demo. 5.1 Get the IP address . (If the Host OS is Windows XP, please refer to Appendix 1 ) Open a folder --> Network (left side bar)--> right click IPNC- --> Properties You will get the IP address. (e.g. http://192.168.0.115/) You can also get the IP address from the log information. 19 5.2 Login IE interface After you get the IP address, open Internet Explorer and input the IP address below. http://<IP_Address>/ You will get the following interface (You may need to install some add-ons in the process if necessary, please refer to Appendix 2 ) : Default User Name: admin Default Password: admin Click “OK”. You will be able to see the video streaming in the IE interface. 20 6. Record MJPEG stream and extract raw data 6.1 Install VLC Media Player Download VLC Media Player from the link below. http://download.cnet.com/VLC-Media-Player/3000-13632_4-10267151.html 6.2 Get MJPEG stream from VLC After install VLC, Open it MediaOpen Network Stream… You will get following window. Enter rtsp://<IP_Address>:554/1 , e.g. rtsp://192.168.0.115:554/1 Click Play, you will get the MJPEG stream. 6.3 Record MJPEG stream with RAW data 6.3.1 Go to IE Interface, select the stream MJPEG(320x240) Click “Disabled RAW” will enable the raw data to stream. Click it again, will disable the raw data. 21 6.3.2 Go to VLC Viewcheck Advanced Controls You will get 4 more icons on the tools bar. Click the left one, the MJPEG stream will be recorded to your Video folder. Click it again will stop the recording. 6.4 Extract the Raw data Copy the video recorded in section 6.3 to /work/DRS_SDK/tool in Ubuntu OS. Go to /work/DRS_SDK/tool host $ cd /work/DRS_SDK/tool Use the command below to extract the raw data.(assume the video name is record1.avi) host $ ./extraw -f AVI -i record1.avi -o file1.raw You will get file1.raw under /work/DRS_SDK/tool You can use raw image software or the following command to check the raw data. host $ od -x file1.raw > raw1.txt You can see the raw data in raw1.txt. 22 7. Update camera application and FPGA 7.1 Update camera application Open IE Interface, go to System Maintenance Device Upgrade, When you update camera application, click “Browser”, select the file software.bin (You can get this file from vendor), then click “Upgrade”. After the update is done, please restart the camera. 7.2 Update FPGA application Please refer to section 7.1, you can use the same way to update the FPGA application. The file name is firmware.rbf , and you may need about 10 minutes to update this file. 23 Appendix Note:To get the IP address of the HD IP Camera, please make sure the UPnP protocol is enabled on the Windows XP computer. 1. Get the IP address on Windows XP. Go to Start--> My Network Places --> click Show icons for networked UPnP devices--> right click Leopard LNC-XXXXX --> Properties You will get the IP address. (e.g. http://192.168.0.176/) 24 25 2. Install Add-on to get the IE Interface 1) Go to your PC, C:\Windows, delete 3 files (if any) below: gdobridge.dll gffx.dll GoDBATL.dll 2) Open IE, Go to Internet Options Security Trusted sites. Click Sites, and add the IP address of camera to Websites. For example: http://192.168.0.* 26 Click Custom level, enable Download unsigned ActiveX controls and Initialize and script ActiveX controls not marked as safe for scripting. On IE interface. Click Install. After install the ActiveX control, you will see the live video. 27