NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

USB Webcam

From Texas Instruments Wiki
Jump to: navigation, search

I have recently brought Logitech USB webcam for my laptop and decided to try my luck on DM6446 EVM.

Linux kernel configuration[edit]

Of course, the first step was to search if someone has got working procedure. Did not find anything conclusive after browsing open-source-davinci mailing list archive but have found that GIT tree has some issues with Davinci USB controller driver. Hence, decided to use MontaVista Linux Support Package (LSP) included in DVSDK 1.3. USB webcam falls under USB Isochronous (ISO) category. USB Isochronous allows a device to reserve a defined bandwidth with guaranteed latency. This is ideal in Audio or Video applications where congestion may cause loss of data or frames to drop.

Enable the following options in kernel configuration to support USB ISO devices.

   host# make davinci_dm6446_defconfig
   host# make menuconfig
   
   Device Driver -> USB -> <*> Support for USB Host side
                           <*> USB device file system
                           <*> Inventra USB controller 
                                Driver Mode -> Host
                            <*> Reserve ISO endpoint
   host# make uImage

(please see Inventra HDRC USB Controller for more details on the underlying driver)

Boot DM6446 EVM with the newly built kernel and mount usbfs fileystem

   target# mount –t usbfs usbfs /proc/bus/usb/

Now its time to plug USB Webcam on EVM. After plugging the webcam, type

    target# cat /proc/bus/usb/device 
    T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=12  MxCh= 0
    D:  Ver= 1.10 Cls=ff(vend.) Sub=ff Prot=00 MxPS= 8 #Cfgs=  1
    P:  Vendor=046d ProdID=092e Rev= 0.00 
    S:  Manufacturer=
    S:  Product=Camera
    C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
    E:  Ad=81(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
    I:  If#= 0 Alt= 1 #EPs= 1 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
    E:  Ad=81(I) Atr=01(Isoc) MxPS= 128 Ivl=1ms

Output confirms that the device is detected by usbcore but is not registered with any driver. In next section we will find driver for this device.


Linux Web Cam Driver[edit]

Was curious to know any other Linux user has tried this device and consulted Linux USB working device list. On searching the VendorID 046d in Quick Search box results that this device is tested and supported by spca5xx driver. MontaVista LSP is based on 2.6.10 kernel, so need to downloaded old spac5xx-v4l1goodbye.tar.gz driver source and cross compile it for DM6446 LSP. To successfully compile this driver for MontaVista LSP, followed the below steps

     untar spca5xx-v4l1goodbye.tar.gz
     host# tar zxf spca5xx-v4l1goodbye.tar.gz
     Modify KERNELDIR variable to point correct LSP path.
     Build the driver
     host# CC=arm_v5t_le-gcc make

Copy spac5xx.ko module on EVM and install the module using

     target# insmod spac5xx.ko

If webcam is connected then dmesg output will look something like this

     target# dmesg
     /mnt/hgfs/shared/spca5xx-v4l1goodbye/drivers/usb/spca5xx.c: USB SPCA5XX camera found.Logitech QuickCam chat(SPCA561A)
     /mnt/hgfs/shared/spca5xx-v4l1goodbye/drivers/usb/spca5xx.c: [spca5xx_probe:5485] Camera typeS561
     /mnt/hgfs/shared/spca5xx-v4l1goodbye/drivers/usb/spca5xx.c: [spca5xx_getcapability:1767] maxw 352 maxh 288 minw 160 minh 120 usbcore: registered new driver spca5xx
     /mnt/hgfs/shared/spca5xx-v4l1goodbye/drivers/usb/spca5xx.c: spca5xx driver 00.60.00.1 registEred

In addition to this, cat /proc/bus/usb/device

    target# cat /proc/bus/usb/device
    T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=12  MxCh= 0
    D:  Ver= 1.10 Cls=ff(vend.) Sub=ff Prot=00 MxPS= 8 #Cfgs=  1
    P:  Vendor=046d ProdID=092e Rev= 0.00
    S:  Manufacturer=
    S:  Product=Camera
    C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=00 Prot=00 Driver=gspca
    E:  Ad=81(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
    I:  If#= 0 Alt= 1 #EPs= 1 Cls=ff(vend.) Sub=00 Prot=00 Driver=gspca
    E:  Ad=81(I) Atr=01(Isoc) MxPS= 128 Ivl=1ms

confirms that webcam is registered with spac5xx driver. In next section we will find a player to capture/view webcam images from this webcam.

Displaying Image[edit]

Logitech QuickCam chat is based on SPCA561A chipset. Michel Xhaard website has nice tool for testing the webcam based on spca5xx. spacview utility is used for testing the webcam based on spca5xx model. Spacview utility is based on Simple Directmedia Layer (SDL) and unfortunately SDL package is neither part of spacview utility and nor MontaVista filesystem. So we need to rebuild the SDL for DM6446.

Steps to build SDL

       1. Download SDL-1.2.13.tar.gz 
       2. untar SDL-1.2.13.tgz
          target# tar zxf SDL-1.2.13.tgz
       3. Configure SDL. Please note that the X11 is enabled by default and you may want to disable on your filesystem.
         Refer configure –help for more options
          target# ./configure 	
       4. Compile and install 
          target# make 
          target# make install

If you wish to cross compile SDL then you may need to configure SDL with appropriate host option (e.g ./configure –host=arm-linux CC=arm_v5t_le-gcc –build=i686-linux).

Steps to build SDL_image

        1. Download SDL_image-1.2.6.tar.gz
        2. untar SDL_image
           target# tar zxf SDL_image-1.2.6.tgz
        3. Configure
           target# ./configure
        4. Compile and install
           target# make 
           target# make install

Steps to build spcaview

         1. Download spacview20071224.tgz
         2. Untar spacview.20071224.tgz
            target# tar zxf spaceview.20071224.tgz
         3. Compile and install
            target# make 
            target# make install

After successful installation, use the below command to view the image

Start X server (needed because we have build SDL with X server support) , this will launch ICEWM Manager.

target# startx

Open Xterm and type target# spacview -d /dev/video1

Smile you are on camera :)

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article USB Webcam here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article USB Webcam here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article USB Webcam here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article USB Webcam here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article USB Webcam here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article USB Webcam here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article USB Webcam here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article USB Webcam here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article USB Webcam here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity