UG: DaVinci PSP Installation on DM36x EVM

From Texas Instruments Embedded Processors Wiki

Jump to: navigation, search
Translate this page to   

Contents

Flashing DM36x EVM using NAND Writer utilities (CCS environment)

For flashing the DaVinci DM36x EVM using NAND Writer utilities, refer to the following instructions. The pre-built binaries for NAND Writer, UBL and U-Boot can be downloaded from DaVinci GIT Linux Kernel Releases

S4:1 (AECFG0) S4:2 (AECFG1) S4:3 (AECFG2) S4:4 (BITSEL0) S4:5 (BITSEL1) S4:6 (BITSEL2)
OFF OFF OFF OFF OFF OFF
S5:1 (NAND/ONE NAND) S5:2 (EXTRA1) S5:3 (EXTRA2) S5:4 (EXTRA3) S5:5 (VCORE ADJ) S5:6 (NTSC/PAL)
OFF OFF OFF OFF ON OFF

MMC/SD boot mode and SD flashing tool

For booting DM36x via SD card and flashing the EVM for MMC/SD boot mode, refer to SD card boot and flashing tool for DM36x.

SPI boot mode and SPI flashing tool

For booting DM36x via SPI flash and flashing the EVM for SPI boot mode, refer to SPI flash boot and flashing tool for DM36x. The link also describes how to setup the kernel for SPI FLASH on the DM36x

Flashing DM36x EVM (PG 1.2 Silicon or newer) using Serial flash utilities

For flashing the DaVinci DM36x EVM using Serial Flash utilities, refer to the following instructions. The pre-built binaries for Serial Flash, UBL and U-Boot can be downloaded from DaVinci GIT Linux Kernel Releases.

S4:1 (BITSEL2) S4:2 (BITSEL1) S4:3 (BITSEL0) S4:4 (AECFG2) S4:5 (AECFG1) S4:6 (AECFG0)
OFF ON ON OFF OFF OFF
S5:1 (NAND/ONE NAND) S5:2 (EXTRA1) S5:3 (EXTRA2) S5:4 (EXTRA3) S5:5 (VCORE ADJ) S5:6 (NTSC/PAL)
OFF OFF OFF OFF ON OFF
    sfh_DM36x.exe -nandflash  <UBL binary file> <binary application file>
S4:1 (BITSEL2) S4:2 (BITSEL1) S4:3 (BITSEL0) S4:4 (AECFG2) S4:5 (AECFG1) S4:6 (AECFG0)
OFF OFF OFF OFF OFF OFF

Booting the DM36x EVM using pre-built binaries

After flashing the EVM for UBL and U-Boot binaries, using one of the above methods (using CCS utilities or Serial flash utilities), the EVM can now be loaded with Kernel and Filesystem images for the complete out-of-box experience.

Refer to Booting DM36x Out of the Box for information on booting the EVM.

Booting Linux Kernel from a SDRAM (via TFTP download to SDRAM)

  setenv bootfile uImage-dm365-evm.bin
 setenv serverip <ipaddress-of-your-host-workstation>
 setenv bootcmd 'dhcp; bootm'
 saveenv
  Hit any key to stop autoboot:  0
 BOOTP broadcast 1
 *** Unhandled DHCP Option in OFFER/ACK: 44
 *** Unhandled DHCP Option in OFFER/ACK: 46
 *** Unhandled DHCP Option in OFFER/ACK: 150
 *** Unhandled DHCP Option in OFFER/ACK: 44
 *** Unhandled DHCP Option in OFFER/ACK: 46
 *** Unhandled DHCP Option in OFFER/ACK: 150
 DHCP client bound to address 192.168.1.197
 TFTP from server 192.168.1.25; our IP address is 192.168.1.197
 Filename 'uImage-dm365-evm.bin'.
 Load address: 0x80700000
 Loading: #################################################################
          #################################################################
          ###########
 done
 Bytes transferred = 2066356 (1f87b4 hex)
 ## Booting kernel from Legacy Image at 80700000 ...
    Image Name:   Arago/2.6.31+2.6.32-rc1-r26+gitr
    Image Type:   ARM Linux Kernel Image (uncompressed)
    Data Size:    2066292 Bytes =  2 MB
    Load Address: 80008000
    Entry Point:  80008000
    Verifying Checksum ... OK
    Loading Kernel Image ... OK
 OK
 
 Starting kernel ...

Booting Linux Kernel from NAND flash

To boot the Linux Kernel image from NAND flash, it has to be downloaded first and copied to the NAND partition.

  tftp 0x80700000 uImage-dm365-evm.bin
 nand erase 0x400000 0x200000
 nand write 0x80700000 0x400000 0x200000
  DM365 EVM > tftp 0x80700000 uImage-dm365-evm.bin
 TFTP from server 192.168.1.25; our IP address is 192.168.1.197
 Filename 'uImage-dm365-evm.bin'.
 Load address: 0x80700000
 Loading: #################################################################
          #################################################################
          ###########
 done
 Bytes transferred = 2066356 (1f87b4 hex)
  DM365 EVM > nand erase 0x400000 0x200000
 
 NAND erase: device 0 offset 0x400000, size 0x200000
 Erasing at 0x400000 -- 100% complete.
 OK
  DM365 EVM > nand write 0x80700000 0x400000 0x200000
 
 NAND write: device 0 offset 0x400000, size 0x200000
  2097152 bytes written: OK
  setenv bootcmd 'nboot 0x80700000 0 0x400000; bootm'
  Hit any key to stop autoboot:  0
 
 Loading from NAND 1GiB 3,3V 8-bit, offset 0x400000
    Image Name:   Arago/2.6.31+2.6.32-rc1-r26+gitr
    Image Type:   ARM Linux Kernel Image (uncompressed)
    Data Size:    2066292 Bytes =  2 MB
    Load Address: 80008000
    Entry Point:  80008000
 ## Booting kernel from Legacy Image at 80700000 ...
    Image Name:   Arago/2.6.31+2.6.32-rc1-r26+gitr
    Image Type:   ARM Linux Kernel Image (uncompressed)
    Data Size:    2066292 Bytes =  2 MB
    Load Address: 80008000
    Entry Point:  80008000
    Verifying Checksum ... OK
    Loading Kernel Image ... OK
 OK
 
 Starting kernel ...

Setting up the target filesystem

DaVinci PSP 03.xx release uses Arago filesystem. The latest filesystem images can be downloaded from DaVinci GIT Linux Kernel Releases.

There are two types of filesystems generated by Arago build system:

  arago-base-image-arago.ext2.gz
 arago-base-image-arago.jffs2
 arago-base-image-arago.tar.gz
  arago-demo-image-dm365-evm.ext2.gz
 arago-demo-image-dm365-evm.jffs2
 arago-demo-image-dm365-evm.tar.gz

Booting with RAMDISK as a root filesystem

 tftp 0x82000000 arago-base-image-arago.ext2.gz
nand erase 0xC00000 0x300000
nand write 0x82000000 0xC00000 0x300000
  DM365 EVM > tftp 0x82000000 arago-base-image-arago.ext2.gz
 operating at 100M full duplex mode
 TFTP from server 192.168.1.25; our IP address is 192.168.1.199
 Filename 'arago-base-image-arago.ext2.gz'.
 Load address: 0x82000000
 Loading: #################################################################
          #################################################################
          #################################################################
          ####################
 done
 Bytes transferred = 3148726 (300bb6 hex)
  DM365 EVM > nand erase 0xC00000 0x300000
 
 NAND erase: device 0 offset 0xc00000, size 0x300000
 Erasing at 0xc00000 -- 100% complete.
 OK
  DM365 EVM > nand write 0x82000000 0xC00000 0x300000
 
 NAND write: device 0 offset 0xc00000, size 0x300000
  3145728 bytes written: OK
  setenv bootcmd 'nand read 0x82000000 0xC00000 0x300000; nboot 0x80700000 0 0x400000; bootm'
  setenv bootargs mem=116M console=ttyS0,115200n8 root=/dev/ram0 rw initrd=0x82000000,4M ip=dhcp
  Hit any key to stop autoboot:  0
 
 NAND read: device 0 offset 0xc00000, size 0x300000
  3145728 bytes read: OK
 
 Loading from NAND 1GiB 3,3V 8-bit, offset 0x400000
    Image Name:   Arago/2.6.31+2.6.32-rc1-r26+gitr
    Image Type:   ARM Linux Kernel Image (uncompressed)
    Data Size:    2066292 Bytes =  2 MB
    Load Address: 80008000
    Entry Point:  80008000
 ## Booting kernel from Legacy Image at 80700000 ...
    Image Name:   Arago/2.6.31+2.6.32-rc1-r26+gitr
    Image Type:   ARM Linux Kernel Image (uncompressed)
    Data Size:    2066292 Bytes =  2 MB
    Load Address: 80008000
    Entry Point:  80008000
    Verifying Checksum ... OK
    Loading Kernel Image ... OK
 OK
 
 Starting kernel ...
     
 ...   
 RAMDISK: gzip image found at block 0
 VFS: Mounted root (ext2 filesystem) on device 1:0.
 Freeing init memory: 128K
 INIT: version 2.86 booting
 Please wait: booting...
 Starting udev
 Populating dev cachetar: short write
 Remounting root file system...
 Mon Oct 19 13:53:00 UTC 2009
 INIT: Entering runlevel: 5
 Starting telnet daemon.   
 Starting syslogd/klogd: done   
  _____                    _____           _         _
 |  _  |___ ___ ___ ___   |  _  |___ ___  |_|___ ___| |_
 |     |  _| .'| . | . |  |   __|  _| . | | | -_|  _|  _|
 |__|__|_| |__,|_  |___|  |__|  |_| |___|_| |___|___|_|
               |___|                    |___|
 
 Arago Project http://arago-project.org dm365-evm ttyS0   
 Arago 2009.09 dm365-evm ttyS0 
 dm365-evm login:


Booting with NFS as a root filesystem

  host $ cd /home/<useracct> 
 host $ mkdir -p workdir/filesys 
 host $ cd workdir/filesys 
  host $ su root
  host $ cp -a <release-location>/images/dm365-evm/arago-demo-image-dm365-evm.tar.gz .
 host $ tar xvfz arago-demo-image-dm365-evm.tar.gz
 host $ chmod 777 -R /home/<useracct>/workdir/filesys
  /home/<useracct>/workdir/filesys *(rw,no_root_squash,no_all_squash,sync) 
 
 NOTE: Make sure you do not add a space between the * and the ( in the above command.
  host $ /usr/sbin/exportfs -av 
 host $ /sbin/service nfs restart 
 
 NOTE: Use exportfs -rav to re-export all directories. Use /etc/init.d/nfs status to verify that the NFS status is running. 
  setenv nfshost <Linux Host IP address> 
 setenv rootpath <directory to mount>
  setenv bootargs mem=116M console=ttyS0,115200n8 root=/dev/nfs rw nfsroot=$(nfshost):$(rootpath) ip=dhcp
  DM365 EVM > setenv nfshost 192.168.1.25
 DM365 EVM > setenv rootpath /opt/workdir/filesys
 DM365 EVM > setenv bootargs mem=116M console=ttyS0,115200n8 root=/dev/nfs rw nfsroot=$(nfshost):$(rootpath) ip=dhcp
 DM365 EVM > print
 ...
 nfshost=192.168.1.25
 rootpath=/opt/workdir/filesys
 bootargs=mem=116M console=ttyS0,115200n8 root=/dev/nfs rw nfsroot=192.168.1.25:/opt/workdir/filesys ip=dhcp
 DM365 EVM >
  ...
 eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=1:01, id=221613)
 Sending DHCP requests .
 PHY: 1:01 - Link is Up - 100/Full., OK
 IP-Config: Got DHCP answer from 0.0.0.0, my address is 192.168.1.197
 IP-Config: Complete:
      device=eth0, addr=192.168.1.197, mask=255.255.255.0, gw=192.168.1.1,
      host=192.168.1.197, domain=xxx.com,
      bootserver=0.0.0.0, rootserver=192.168.1.25, rootpath=/opt/workdir/filesys
 Looking up port of RPC 100003/2 on 192.168.1.25
 Looking up port of RPC 100005/1 on 192.168.1.25
 VFS: Mounted root (nfs filesystem) on device 0:14.
 Freeing init memory: 128K
 INIT: version 2.86 booting
 Please wait: booting...
 Starting udev
 Populating dev cache
 Remounting root file system...
 NET: Registered protocol family 10
 INIT: Entering runlevel: 5
 Starting telnet daemon.
 Starting syslogd/klogd: done
 Starting thttpd.
  _____                    _____           _         _
 |  _  |___ ___ ___ ___   |  _  |___ ___  |_|___ ___| |_
 |     |  _| .'| . | . |  |   __|  _| . | | | -_|  _|  _|
 |__|__|_| |__,|_  |___|  |__|  |_| |___|_| |___|___|_|
               |___|                    |___|
 
 Arago Project http://arago-project.org dm365-evm ttyS0
 Arago 2009.09 dm365-evm ttyS0
 dm365-evm login:

Video Input/Output Source Configuration

The video capture (VPFE) and display (VPBE) drivers in DaVinci PSP release allow input and output sources to be configured from the bootargs ENV variable in U-Boot.

  vpfe_capture.interface=2
 for TVP7002 (default)
  vpfe_capture.interface=1
 for Micron sensor - MT9T031
  vpfe_capture.interface=0
 for TVP5146
  vpfe_capture.bufsize=4147200
 for 1080I-30 (1920*1080*2=4147200)
  vpfe_capture.bufsize=1843200
 for 720P-60 (1280*720*2=1843200)
  vpfe_capture.bufsize=829440
 for PAL (720*576*2=829440) - default
  vpfe_capture.bufsize=691200
 for NTSC (720*480*2=691200)
  davinci_enc_mngr.ch0_output=COMPOSITE davinci_enc_mngr.ch0_mode=pal
  davinci_enc_mngr.ch0_output=COMPONENT davinci_enc_mngr.ch0_mode=720P-60
  davinci_enc_mngr.ch0_output=COMPONENT davinci_enc_mngr.ch0_mode=1080I-30
  davinci_enc_mngr.ch0_output=LCD davinci_enc_mngr.ch0_mode=480x272
 for LCD mounted on the DM36x EVM

Building PSP Components

Rebuilding the Linux kernel

The rebuild the Linux kernel, follow the steps below.

Preparing your Environment

  1. If you have not already done so, install the CodeSourcery tools on your Linux host. For additional documentation on installing the CodeSourcery tools, please visit the CodeSourcery website.
  2. If U-Boot is not built yet, build U-Boot first, as building Linux Kernel requires mkimage utility, which gets built along with U-Boot. Refer to Rebuilding U-Boot for steps to build U-Boot. Once built, mkimage will be present under the tools folder of U-Boot source (/home/<user>/DaVinci-PSP-SDK-xx.xx.xx.xx/src/u-boot/uboot-xx.xx.xx.xx/tools). Ensure that this path is added to the $PATH variable by adding the following
host$ export PATH=home/<user>/DaVinci-PSP-SDK-xx.xx.xx.xx/src/u-boot/uboot-xx.xx.xx.xx/tools:$PATH

to the ~/.bashrc file. You can then source the ~/.bashrc file with the following command

host$ source ~/.bashrc
  1. Use your Linux host to extract source files for building the target Linux kernel from the src/kernel/linux-#.#.#.#.tar.gz tarball from the Linux PSP package, which is located in the DaVinci-PSP-SDK-#.#.#.# directory under the main SDK installation directory (/home/<user>/DaVinci-PSP-SDK-xx.xx.xx.xx/src/kernel for default path installation). Use the tar command to extract the sources.
host$ tar zxf linux-#.#.#.#.tar.gz

NOTE
Patches from the kernel-patches-#.#.#.#.tar.gz file have already been applied on Linux Kernel. This is the list of patches which have been developed on top of the base Linux kernel version. You can find information about the base Linux kernel version from the release notes accompanying the PSP release.

  1. Change directory (cd command) to the top-level directory of the Linux kernel source files obtained in the previous step.
host$ cd linux-xx.xx.xx.xx

Basic Configuration of the Kernel

Based on what chip and development board you are using, you will need to configure the kernel for different options. Most of these setings are build into the Make file provided by TI, and you can switch between builds using some simple make options.

  1. Clean your installation of previous build settings
host$ make distclean ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
  1. Configure the kernel according to the default configuration provided. The steps below assume that the CodeSourcery tools are already present in your $PATH variable. Information on how to add the tools to your $PATH can be obtained form the Getting Started Guide for the CodeSourcery tools.
host$ make davinci_dm365_defconfig ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
  1. Modify the kernel options you would like to run. This may take some planning, but the default settings are a good place to start. For more information on these settings, look further down the page at Driver configuration in the Linux kernel or see detaile instructions for | a different processors root file system]. there are two menu configs that are commmon to run:
host$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- menuconfig
(or)
host$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- xconfig

Building uImage

Run the following command to build the kernel image:

host$ make uImage ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-

The compiled uImage is copied into the arch/arm/boot directory under the kernel tree.

Once the kernel has been compiled, if you are using tftp boot, use the following commands to copy the uImage to a place where U-Boot can use TFTP to download it to the EVM. These commands assume you are using the default TFTP root area, which is /tftpboot. If you use another TFTP root location, please change /tftpboot to your own TFTP root location:

host$ cp arch/arm/boot/uImage /tftpboot

Note
If the uImage build fails with a similar message as follows:

"mkimage" command not found - U-Boot images will not be built

it could be that the path to the u-boot uImage script has not been added to the command search path. Include the path "{u-boot source path}/tools" to your PATH environment variable.

Building Modules

To build all features configured as modules (M), issue the following command:

host$ make modules ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-

Installing modules to Target File System

To install the compiled modules into the target root file system, issue the following command:

host$ make modules_install INSTALL_MOD_PATH=<root fs path> ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-

where the <root fs path> is the path of your target root file system on the host machine (/home/user/workdir/filesys for example).


See Loading Linux Kernel Modules for more information on using kernel modules after you build them.

Rebuilding U-Boot

Follow these steps to rebuild U-Boot:

  1. If you have not already done so, install the CodeSourcery tools on your Linux host. For documentation on installing the CodeSourcery tools, please visit the CodeSourcery website.
  2. Use your Linux host to extract source files for building U-Boot from the src/u-boot/u-boot-#.#.#.#.tar.gz tarball from the Linux PSP package, which is located in the DaVinci-PSP-SDK-#.#.#.# directory under the main SDK installation directory. Use the tar command to extract the sources.
    Note: Patches from the uboot-patches-#.#.#.#.tar.gz file have already been applied to U-Boot. This is the list of patches which have been developed on top of the base version. You can find information about the base U-Boot version from the release notes accompanying the PSP release.
  3. Go to the u-boot directory created when you extracted the files.
  4. Run the following commands on your Linux host to build U-Boot. Note: The steps below assume that the CodeSourcery tools are already present in your $PATH variable. Information on how to add the tools to your $PATH can be obtained form the Getting Started Guide for the CodeSourcery tools.
host$ make distclean CROSS_COMPILE=arm-none-linux-gnueabi-
host$ make davinci_dm365evm_config CROSS_COMPILE=arm-none-linux-gnueabi- 
host$ make all CROSS_COMPILE=arm-none-linux-gnueabi-
  1. The compiled u-boot.bin file will be created in the same directory.
  2. To change the default options, the EVM configuration file needs to be edited.
    • for DM36x (DM365 and DM368) EVM are specified in the include file include/configs/davinci_dm365evm.h

To change U-Boot environment area location or size:

    • CONFIG_ENV_SIZE Configures the environment variable size.
    • CONFIG_ENV_OFFSET Configures the environment variable offset.

Building the User Boot Loader (UBL)

Follow the steps mentioned below for releases before the 03.21.xx.xx release:

The latest source code for UBL can be downloaded from Arago GIT server. Once the source is extracted (from source tarball), following steps can be followed to build UBL.

  1. Start CCStudio v3.3.
  2. From the menus, choose Project->Open.
  3. Browse to the extracted UBL source and open the UBL.pjt project. Project file can be found under <flash-utils-install-dir>\DM36x\CCS\UBL\ folder of the extracted source.
  4. To build for different ARM and DDR frequencies, select the "Config" option suitably in CCStudio window.
  5. From the menus, choose Project->Build.
  6. When the build is complete, the binary file (UBL_DM36x_NAND*.bin) suitable for flashing is generated in the Project Root directory (<flash-utils-install-dir>\DM36x\CCS\UBL\)

For 03.21.xx.xx Release:

Use your Linux host to extract the UBL code from the src/boot-strap/flash-utils-#.#.#.#.tar.gz tarball from the Linux PSP package, which is located in the DaVinci-PSP-SDK-#.#.#.# directory under the main SDK installation directory. Use the tar command to extract the sources. If the extracted files are not accessible from your Microsoft Windows host, copy all the extracted files to a location that is accessible.

When using CCStudiov5:

  1. Start CCStudiov5.
  2. From the menus, choose File->Import. Choose CCS->Existing CCS/CCE Eclipse Project. Browse to DM36x/CCS directory inside the extracted UBL source and select the UBL folder.
  3. From the list of Discovered projects:
    • Select UBL_NAND for NAND boot mode.
    • Select UBL_SDMMC for MMC/SD boot mode.
  4. From the menus, choose Project->Build Project
  5. When build is complete:
    • The binary file (ubl_DM36x_NAND.bin) suitable for flashing is created in the directory (<flash-utils-install-dir>\DM36x\CCS\UBL\UBL_NAND)

When using Cygwin or Linux Host:

  1. For a particular platform, the extracted package will consist of a 'Common' directory and a '<PlatformName>' directory.
  2. Enter into the '<PlatformName>/GNU' directory.
     cd '<PlatformName>/GNU'
  3. If you wish to rebuild everything, simply run 'make' at this point.
  4. When build is complete:
    • The binary files (ubl_DM36x_xxx.bin) for supported ARM and DDR frequencies, suitable for flashing is created in the directory (<flash-utils-install-dir>\DM36x\GNU\ubl).
    • The serial flasher (sfh_DM36x.exe) which can be used for flashing NAND is created in the directory (<flash-utils-install-dir>\DM36x\GNU).

Note
Currently, serial flasher built from the source code will not work. Till this problem is resolved, please use the serial flasher available in pre-built binaries folder.

  1. If you wish to clean-up already built components, run 'make clean' from the path you wish to clean.

Building the NAND Flash writer

NAND flash writer is used to flash the UBL and U-Boot images to NAND flash. The flash writer also supports flashing a given image at a chosen offset.

Use the following steps to build NAND Flash writer using CCStudio v5:

  1. Use your Linux host to extract the flash utilities code from the src/boot-strap/flash-utils-#.#.#.#.tar.gz tarball from the Linux PSP package, which is located in the DaVinci-PSP-SDK-#.#.#.# directory under the main SDK installation directory. Use the tar command to extract the sources. If the extracted files are not accessible from your Microsoft Windows host, copy all the extracted files to a location that is accessible.
  2. Start CCStudio v5.
  3. From the menus, choose File->Import. Choose CCS->Existing CCS/CCE Eclipse Project. Browse to DM36x/CCS directory inside the extracted source and select the NANDWriter folder.
  4. From the list of Discovered projects, select NANDWriter.
  5. From the menus, choose Project->Build Project. The built image NANDWriter_DM36x.out is placed in the ccsv4/Debug under the top directory.

To flash images to NAND Flash, see Flashing images to NAND Flash.
To boot U-Boot from NAND Flash, see Booting from NAND Flash.
To boot the Linux kernel from NAND Flash using U-Boot, see Booting the Linux kernel from NAND Flash.

NAND Partitions

The NAND writer writer the UBL to Block 1 and U-boot to block 25. We reserve 24 blocks for UBL becuase RBL will search for a valid UBL header from blocks 1 to 24


Building and using the MT9P031 CMOS image sensor driver

This section contains the information on compiling and installing the CMOS sensor driver, as well as the use of an application demo to capture video at 1080p30 (1920x1080 30fps) and display up to 1080I60.

The demo has a semi-auto exposure and semi-auto white balance algorithm, which only requires one-time calibration under unchanged lighting condition. The calibration is simple and easy. It is performed by pointing the camera to a white scene and pressing one key. This algorithm is contributed to the open source by Leopard Imaging, Inc.

The demo is tested on DM36x EVM with LI-5M02 rev2 image sensor board from Leopard Imaging,Inc.


1. Building the driver

The CMOS sensor driver is available at arago git tree in this directory : drivers/media/video/davinci/. The major part of the driver is in mt9p031.c.

git clone git://arago-project.org/git/projects/linux-davinci.git linux-davinci


Follow the steps in section “Building the Kernel” on this page. Make sure “CONFIG_SOC_CAMERA_MT9P031=y” is included in linux-davinci/arch/arm/configs/davinci_dm365_deconfig. If not, it can be configured using:

make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- menuconfig


check “device drivers -> Multimedia Support -> Video for Linux” and “device drivers -> Multimedia Support -> Video Capture Adapters -> mt9p031 support”. It can be built in the kernel or dynamically loaded as a module.


insmod mt9p031.ko


rmmod mt9p031.ko 


2 . Building the demo application

The latest sample application code for DaVinci PSP release can be downloaded/cloned from examples-davinci Git tree.

git clone git://arago-project.org/git/projects/examples-davinci.git examples-davinci


cd examples-davinci/imp-prev-rsz/dm365/


export KERNEL_DIR=<kernel directory> 
export LINUXLIBS_DIR=<linuxlibs directory>


make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- clean


make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-


cp capture_prev_rsz_onthe_fly_bayer_mew <target filesys addr>/opt/


3. Running the demo

setenv bootargs console=ttyS0,115200n8 noinitrd rw ip=dhcp root=/dev/nfs nfsroot=<linux host IP>:<nfs host directory>,nolock mem=60M video=davincifb:vid0=OFF:vid1=OFF:osd0=1920x1080x4,32400K dm365_imp.oper_mode=0 vpfe_capture.interface=1 vpfe_capture.bufsize=4147200 davinci_enc_mngr.ch0_mode=1080I-30

the meaning of the parameters:

- dm365_imp.oper_mode

 select the image mode, 0:default, 1:continuous,2: XOR mode

- vpfe_capture.interface

 select the vpfe input interface, 0:tvp5146 composite input. 1:mt9p031 CMOS sensor bayer input. 2:tvp7002 component input.

-vpfe_capture.bufsize

 make sure the buffer size is equal to or larger than : 1920*1080*2 = 4147200 bytes

-davinci_enc_mngr.ch0_mode

 Select the display mode, 1080I-30 standards for 1920*1080 interleaved @30fps


cd /opt

./loadmodules_hd.sh

./capture_prev_rsz_onthe_fly_bayer_mew -i1 -m4 -h50

or ./capture_prev_rsz_onthe_fly_bayer_mew -i1 -m4 -h60

or ./capture_prev_rsz_onthe_fly_bayer_mew -i1 -m10 –h50

or ./capture_prev_rsz_onthe_fly_bayer_mew -i1 -m10 -h60

For the arguments that follows “./capture_prev_rsz_onthe_fly_bayer_mew”:

-i1: select input type is CMOS sensor input

-m4/m10: select standard is 720P-30/1080P-30

-h50/h60: select 50Hz/60Hz anti-flicker


When the loop-back video is on the TV screen, point the camera to a white or grey area, such as a piece of white paper, a white wall, or the professional 18% grey card, type 'w' key, a square frame will show up in the center of the video, make sure the frame covers a uniform white/grey area, type 'w' key again, it will ajust sensor exposure time and gain, IPIPE white balance gains and RGB matrix to get a decent quality video.


MT9P031 CMOS Sensor Driver Overview

This section provides a brief overview of the driver and its features. The driver is under GPL license, contributed to the open source community by Leopard Imaging, Inc.

1. Overview

The MT9P031 CMOS sensor driver can work as built-in driver or loadable module. It mainly handles the communication and configuration of the CMOS sensor. And it fits into the V4l2 structure as a video capture device.

The CMOS sensor driver can be divided into the following blocks:

Module init:

    This block handles all the initialization activities including driver registration, driver un-registration, probe and remove registration.

Sensor init:

    This block handles CMOS sensor reset and enable.

Configuration and Control:

    This block handles the CMOS sensor function.

Standard and Format:

    This block handles standard and format supported by the CMOS sensor.


2. Features

The CMOS sensor driver supports communication and configuration of sensor through I2C bus, as well as other features such as:

Multiple Standards

Binning or non-binning mode

Set and get control status

Set, set and query standard

Set and try(check) format

Get and set sensor registers


The CMOS sensor driver supports the following standards:


-V4L2_STD_720P_30 (1280*720 progressive 30fps), binning mode, tested

-V4L2_STD_1080P_30 (1920*1080 progressive 30fps), non-binning mode, tested

-V4L2_STD_525_60, non-tested

-V4L2_STD_625_50, non-tested

-V4L2_STD_525P_60, non-tested

-V4L2_STD_625P_50, non-tested


The CMOS sensor drive can supports set and get the current control, the control type includes:

- VFLIP control

- HFLIP control

- Gain control

- Exposure and Auto-Exposure control


- PLL config

- Enable or Disable sensor

- Bin and Skip mode - Width and Height

- Row start and Column start

- Horizontal blank and Vertical blank


The CMOS sensor driver supports reading and setting the sensor register values. 


By default, the driver initializes the CMOS sensor in V4L2_STD_1080P_30 standard, which is 1920*1080 progressive 30fps, non-binning mode.


E2e.jpg For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article UG: DaVinci PSP Installation on DM36x EVM here.
Hyperlink blue.png Links
ARM Microcontroller MCU ARM Processor Digital Media Processor Digital Signal Processing Microcontroller MCU Multi Core Processor
Ultra Low Power DSP 8 bit Microcontroller MCU 16 bit Microcontroller MCU 32 bit Microcontroller MCU

Retrieved from "http://processors.wiki.ti.com/index.php/UG:_DaVinci_PSP_Installation_on_DM36x_EVM"
Leave a Comment

Comments

Comments on UG: DaVinci PSP Installation on DM365 EVM


Sdusse said ...

The latest Arago kernel pre-built image is greater than 0x200000 bytes so the above instructions should be changed for section "Booting Linux Kernel from NAND flash" to be

 nand erase 0x400000 0x203000
 nand write 0x80700000 0x400000 0x203000

Then boot proceeds rather than giving a CRC error.

--Sdusse 13:23, 23 February 2010 (CST)

Sdusse said ...

Similarly, the latest Arago pre-built base system image is greater than 0x300000 bytes so the above instructions should be changed for section "Booting with RAMDISK as a root filesystem" to be

nand erase 0xC00000 0x303000
nand write 0x82000000 0xC00000 0x303000

and the bootcmd set needs to be

 setenv bootcmd 'nand read 0x82000000 0xC00000 0x303000; nboot 0x80700000 0 0x400000; bootm'


--Sdusse 13:44, 23 February 2010 (CST)

Personal tools
Namespaces
Variants
Actions
Navigation
Print/export
Toolbox