Search

Technical Discussion Group Forum

This forum is provided for user discussion. While Beacon EmbeddedWorks support staff and engineers participate, Beacon EmbeddedWorks does not guarantee the accuracy of all information within in the Technical Discussion Group (TDG).

The "Articles" forums provide brief Articles written by Beacon EmbeddedWorks engineers that address the most frequently asked technical questions.

To receive email notifications when updates are posted for a Beacon EmbeddedWorks product download, please subscribe to the TDG Forum of interest.

TDG Forum

PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 08 Jan 2008 06:49 AM by  prashm_77@yahoo.com
Micron CMOS sensor CSI interface
 3 Replies
Sort:
You are not authorized to post a reply.
Author Messages
prashm_77@yahoo.com
New Member
New Member
Posts:


--
07 Jan 2008 06:10 AM
    Hai

    We are trying to interface the CSI port of IMX31 using Micron MT9D131 CMOS sensor module

    We have currently done the following changes,

    we have enabled the CSI and MXC IPU interface and we are currently selected MT9V111 driver

    But the observation what we have is , it is found that I2C is not able to detect the CMOS SENSOR module and it is saying ACK not received

    We have currently done the changes in mx31lite_gpio.c and function like gpio_sensor_active/gpio_sensor_inactive as mentioned in ADS Linux BSP

    When we run i2cdetect
    i2c_adapter i2c-0: master_xfer[0] W, addr=0x90, len=1
    i2c_adapter i2c-0: master_xfer[1] W, addr=0x90, len=2
    ACK not received


    But we are getting error when accessing the v4l mxc device

    please help us.
    davek
    New Member
    New Member
    Posts:


    --
    07 Jan 2008 08:26 AM
    What is the error you're getting? I assume you have things connected to the appropriate I2C interface? There are a few changes that need to be made to the sensor_active( ) logic, since there is no mux on the lower 4 bits like on the ADS board.
    prashm_77@yahoo.com
    New Member
    New Member
    Posts:


    --
    07 Jan 2008 08:56 PM
    Hai

    We have just enabled the gpio_sensor_active/inactive as in ADS GPIO settings

    After this we are loading the kernel and trying to run motion application for detecting , even though it is saying detected , it giving I2C ACK not received error



    mx31# motion
    [0] Processing thread 0 - config file /usr/etc/motion.conf
    [0] Unknown config option "ffmpeg_cap_new"
    [0] Unknown config option "ffmpeg_video_codec"
    [0] Thread 1 is from /usr/etc/motion.conf
    [1] Thread started
    [1] cap.driver: "mxc_v4l2"
    [1] cap.card: ""
    [1] cap.bus_info: ""
    [1] cap.capabilities=0x05000005
    [1] - VIDEO_CAPTURE
    [1] - VIDEO_OVERLAY
    [1] - READWRITE
    [1] - STREAMING
    [1] Unable to query input 0.
    [1] VIDIOC_ENUMINPUT: Invalid argument
    [1] ioctl (VIDIOCGCAP): Invalid argument
    [1] Capture error calling vid_start
    [1] Thread finishing...
    mxc_v4l_close: release resource
    mx31# dmesg
    ipu: Warning: channel already initialized
    Console: switching to colour frame buffer device 22x27
    MXCFB_EPSON MXCFB_EPSON.0: MXCFB_EPSON registered
    fb1: Virtual frame buffer device, using 1024K of video memory
    Real TIme clock Driver v1.0
    MXC WatchDog Driver 2.0
    MXC Watchdog # 0 Timer: initial timeout 60 sec
    Serial: MXC Internal UART driver
    mxcintuart.0: ttymxc0 at MMIO 0x43f90000 (irq = 45) is a Freescale MXC
    mxcintuart.1: ttymxc1 at MMIO 0x43f94000 (irq = 32) is a Freescale MXC
    mxcintuart.2: ttymxc2 at MMIO 0x5000c000 (irq = 18) is a Freescale MXC
    mxcintuart.4: ttymxc4 at MMIO 0x43fb4000 (irq = 47) is a Freescale MXC
    RAMDISK driver initialized: 16 RAM disks of 16384K size 1024 blocksize
    loop: loaded (max 8 devices)
    Linux video capture interface: v2.00

    sensor_active

    sensor_select 0
    i2c-core: driver [MT9V111 Client] registered
    i2c_adapter i2c-0: client [mt9v111 I2C dev] registered with bus id 0-0090
    MXC Video Output MXC Video Output.0: Registered device video16
    MXC MTD nor Driver 2.0
    mxc_nor_flash.0: Found 1 x16 devices at 0x0 in 16-bit bank
    mxc_nor_flash.0: Found an alias at 0x200000 for the chip at 0x0
    mxc_nor_flash.0: Found an alias at 0x400000 for the chip at 0x0
    mxc_nor_flash.0: Found an alias at 0x600000 for the chip at 0x0
    mxc_nor_flash.0: Found an alias at 0x800000 for the chip at 0x0
    mxc_nor_flash.0: Found an alias at 0xa00000 for the chip at 0x0
    mxc_nor_flash.0: Found an alias at 0xc00000 for the chip at 0x0
    mxc_nor_flash.0: Found an alias at 0xe00000 for the chip at 0x0
    mxc_nor_flash.0: Found an alias at 0x1000000 for the chip at 0x0
    mxc_nor_flash.0: Found an alias at 0x1200000 for the chip at 0x0
    mxc_nor_flash.0: Found an alias at 0x1400000 for the chip at 0x0
    mxc_nor_flash.0: Found an alias at 0x1600000 for the chip at 0x0
    mxc_nor_flash.0: Found an alias at 0x1800000 for the chip at 0x0
    mxc_nor_flash.0: Found an alias at 0x1a00000 for the chip at 0x0
    mxc_nor_flash.0: Found an alias at 0x1c00000 for the chip at 0x0
    mxc_nor_flash.0: Found an alias at 0x1e00000 for the chip at 0x0
    Support for command set 0003 not present
    gen_probe: No supported Vendor Command Set found
    mxc_nor_flash: probe of mxc_nor_flash.0 failed with error -5
    MXC MTD nand Driver 2.0
    NAND device: Manufacturer ID: 0x20, Chip ID: 0x76 (ST Micro NAND 64MiB 3,3V 8-bit)
    Scanning device for bad blocks
    Bad eraseblock 0 at 0x00000000
    Creating 4 MTD partitions on "NAND 64MiB 3,3V 8-bit":
    0x00000000-0x00200000 : "nand.kernel"
    0x00200000-0x04000000 : "nand.rootfs"
    0x00000000-0x04000000 : "<NULL>"
    0x00000000-0x04000000 : "<NULL>"
    usbmon: debugfs is not available
    Initializing USB Mass Storage driver...
    usbcore: registered new interface driver usb-storage
    USB Mass Storage support registered.
    mice: PS/2 mouse device common for all mice
    i2c /dev entries driver
    i2c-core: driver [dev_driver] registered
    i2c-dev: adapter [MXC I2C Adapter] registered as minor 0
    Driver for 1-wire Dallas network protocol.
    Serial: MXC OWire driver
    IPU Post-filter loading
    SSI module loaded successfully
    PMIC Audio driver loading...
    PMIC Battery successfully probed
    PMIC Connectivity driver loading..
    DVFS & DPTC: using 27MHz CKIH table
    DPTC controller initialized
    DVFS controller initialized
    DVFS frequency #0: 532000000
    DVFS frequency #1: 266000000
    DVFS frequency #2: 133000000
    DVFS frequency #3: 133000000
    RNG Driver: Loading
    SEC: mxc_sec_mod_init() called
    MXC MMC/SD driver
    mxcmci-0 found
    Advanced Linux Sound Architecture Driver Version 1.0.13 (Tue Nov 28 14:07:24 2006 UTC).
    Control ALSA component registered
    ALSA device list:
    #0: MXC Freescale with PMIC
    oprofile: using arm/arm11
    TCP cubic registered
    NET: Registered protocol family 1
    NET: Registered protocol family 17
    ieee80211: 802.11 data/management/control stack, git-1.1.13
    ieee80211: Copyright (C) 2004-2005 Intel Corporation <jketreno@linux.intel.com>
    ieee80211_crypt: registered algorithm 'NULL'
    Power Management for Freescale MX31
    VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 2
    input: mxc_ts as /class/input/input0
    mxc input touchscreen loaded
    eth0: SMSC911x/921x identified at 0xc7a00000, IRQ: 90
    eth0: SMSC911x MAC Address: 00:08:ee:01:86:71
    eth0: link down
    IP-Config: Complete:
    device=eth0, addr=192.168.50.172, mask=255.255.255.0, gw=192.168.50.1,
    host=192.168.50.172, domain=, nis-domain=(none),
    bootserver=192.168.50.1, rootserver=192.168.50.247, rootpath=
    Looking up port of RPC 100003/2 on 192.168.50.247
    eth0: link up, 100Mbps, full-duplex, lpa 0x05E1
    Looking up port of RPC 100005/1 on 192.168.50.247
    VFS: Mounted root (nfs filesystem).
    Freeing init memory: 120K
    driver isp1504_arc, Revision: 1.0
    XXXXXXXXXXXXXXXXXXXX pll = 197640000, usb_pdf = 1, usb_prepdf = 1, retval = 49410000
    USB_CLK=49410000, should be 60MHz
    i2c_adapter i2c-0: master_xfer[0] W, addr=0x90, len=1
    i2c_adapter i2c-0: master_xfer[1] W, addr=0x90, len=2


    /*!
    * Switch to the specified sensor - MX31 SOM has none
    *
    */
    void gpio_sensor_select(int sensor)
    {
    printk("\r\n sensor_select %d \r\n", sensor);
    u16 temp;

    switch (sensor) {
    case 0:
    #ifdef CONFIG_MXC_CAMERA_MC521DA
    temp = 0x100;
    __raw_writew(temp, PBC_BASE_ADDRESS + PBC_BCTRL1_SET);
    #else
    temp = PBC_BCTRL1_SENSOR2_ON;
    __raw_writew(temp, PBC_BASE_ADDRESS + PBC_BCTRL1_CLEAR);
    temp = PBC_BCTRL1_SENSOR1_ON;
    __raw_writew(temp, PBC_BASE_ADDRESS + PBC_BCTRL1_SET);
    #endif
    break;
    case 1:
    temp = PBC_BCTRL1_SENSOR1_ON;
    __raw_writew(temp, PBC_BASE_ADDRESS + PBC_BCTRL1_CLEAR);
    temp = PBC_BCTRL1_SENSOR2_ON;
    __raw_writew(temp, PBC_BASE_ADDRESS + PBC_BCTRL1_SET);
    break;
    default:
    break;
    }
    }

    /*!
    * Setup GPIO for sensor to be active
    *
    */
    void gpio_sensor_active(void)
    {
    printk("\r\n sensor_active \r\n");
    gpio_sensor_select(0);

    /*
    * * Configure the iomuxen for the CSI.
    * */

    mxc_request_iomux(MX31_PIN_CSI_D4, OUTPUTCONFIG_FUNC, INPUTCONFIG_FUNC);
    mxc_request_iomux(MX31_PIN_CSI_D5, OUTPUTCONFIG_FUNC, INPUTCONFIG_FUNC);
    mxc_request_iomux(MX31_PIN_CSI_D6, OUTPUTCONFIG_FUNC, INPUTCONFIG_FUNC);
    mxc_request_iomux(MX31_PIN_CSI_D7, OUTPUTCONFIG_FUNC, INPUTCONFIG_FUNC);
    mxc_request_iomux(MX31_PIN_CSI_D8, OUTPUTCONFIG_FUNC, INPUTCONFIG_FUNC);
    mxc_request_iomux(MX31_PIN_CSI_D9, OUTPUTCONFIG_FUNC, INPUTCONFIG_FUNC);
    mxc_request_iomux(MX31_PIN_CSI_D10, OUTPUTCONFIG_FUNC,
    INPUTCONFIG_FUNC);
    mxc_request_iomux(MX31_PIN_CSI_D11, OUTPUTCONFIG_FUNC,
    INPUTCONFIG_FUNC);
    mxc_request_iomux(MX31_PIN_CSI_D12, OUTPUTCONFIG_FUNC,
    INPUTCONFIG_FUNC);
    mxc_request_iomux(MX31_PIN_CSI_D13, OUTPUTCONFIG_FUNC,
    INPUTCONFIG_FUNC);
    mxc_request_iomux(MX31_PIN_CSI_D14, OUTPUTCONFIG_FUNC,
    INPUTCONFIG_FUNC);
    mxc_request_iomux(MX31_PIN_CSI_D15, OUTPUTCONFIG_FUNC,
    INPUTCONFIG_FUNC);
    mxc_request_iomux(MX31_PIN_CSI_HSYNC, OUTPUTCONFIG_FUNC,
    INPUTCONFIG_FUNC);
    mxc_request_iomux(MX31_PIN_CSI_MCLK, OUTPUTCONFIG_FUNC,
    INPUTCONFIG_FUNC);
    mxc_request_iomux(MX31_PIN_CSI_PIXCLK, OUTPUTCONFIG_FUNC,
    INPUTCONFIG_FUNC);
    mxc_request_iomux(MX31_PIN_CSI_VSYNC, OUTPUTCONFIG_FUNC,
    INPUTCONFIG_FUNC);

    #ifdef CONFIG_MXC_IPU_CAMERA_16BIT
    /*
    * * The other 4 data bits are multiplexed on MX31.
    * */
    mxc_request_iomux(MX31_PIN_ATA_CS0, OUTPUTCONFIG_ALT2,
    INPUTCONFIG_ALT2);
    mxc_request_iomux(MX31_PIN_ATA_CS1, OUTPUTCONFIG_ALT2,
    INPUTCONFIG_ALT2);
    mxc_request_iomux(MX31_PIN_ATA_DIOR, OUTPUTCONFIG_ALT2,
    INPUTCONFIG_ALT2);
    mxc_request_iomux(MX31_PIN_ATA_DIOW, OUTPUTCONFIG_ALT2,
    INPUTCONFIG_ALT2);
    #endif

    /*
    * * Now enable the CSI buffers
    * */

    __raw_writew(PBC_BCTRL2_CSI_EN, PBC_BASE_ADDRESS + PBC_BCTRL2_CLEAR);

    #ifdef CONFIG_MXC_IPU_CAMERA_16BIT
    /*
    * * Enable the other buffer for the additional 4 data bits.
    * */
    __raw_writew(PBC_BCTRL4_CSI_MSB_EN,
    PBC_BASE_ADDRESS + PBC_BCTRL4_CLEAR);
    #endif

    }

    EXPORT_SYMBOL(gpio_sensor_active);

    /*!
    * Setup GPIO for sensor to be inactive
    *
    */
    void gpio_sensor_inactive(void)
    {
    printk("\r\n sensor_inactive\r\n");
    mxc_free_iomux(MX31_PIN_CSI_D4, OUTPUTCONFIG_FUNC, INPUTCONFIG_FUNC);
    mxc_free_iomux(MX31_PIN_CSI_D5, OUTPUTCONFIG_FUNC, INPUTCONFIG_FUNC);
    mxc_free_iomux(MX31_PIN_CSI_D6, OUTPUTCONFIG_FUNC, INPUTCONFIG_FUNC);
    mxc_free_iomux(MX31_PIN_CSI_D7, OUTPUTCONFIG_FUNC, INPUTCONFIG_FUNC);
    mxc_free_iomux(MX31_PIN_CSI_D8, OUTPUTCONFIG_FUNC, INPUTCONFIG_FUNC);
    mxc_free_iomux(MX31_PIN_CSI_D9, OUTPUTCONFIG_FUNC, INPUTCONFIG_FUNC);
    mxc_free_iomux(MX31_PIN_CSI_D10, OUTPUTCONFIG_FUNC, INPUTCONFIG_FUNC);
    mxc_free_iomux(MX31_PIN_CSI_D11, OUTPUTCONFIG_FUNC, INPUTCONFIG_FUNC);
    mxc_free_iomux(MX31_PIN_CSI_D12, OUTPUTCONFIG_FUNC, INPUTCONFIG_FUNC);
    mxc_free_iomux(MX31_PIN_CSI_D13, OUTPUTCONFIG_FUNC, INPUTCONFIG_FUNC);
    mxc_free_iomux(MX31_PIN_CSI_D14, OUTPUTCONFIG_FUNC, INPUTCONFIG_FUNC);
    mxc_free_iomux(MX31_PIN_CSI_D15, OUTPUTCONFIG_FUNC, INPUTCONFIG_FUNC);
    mxc_free_iomux(MX31_PIN_CSI_HSYNC, OUTPUTCONFIG_FUNC, INPUTCONFIG_FUNC);
    mxc_free_iomux(MX31_PIN_CSI_MCLK, OUTPUTCONFIG_FUNC, INPUTCONFIG_FUNC);
    mxc_free_iomux(MX31_PIN_CSI_PIXCLK, OUTPUTCONFIG_FUNC,
    INPUTCONFIG_FUNC);
    mxc_free_iomux(MX31_PIN_CSI_VSYNC, OUTPUTCONFIG_FUNC, INPUTCONFIG_FUNC);
    }

    EXPORT_SYMBOL(gpio_sensor_inactive);




    Posted By davek on 7 Jan 2008 8:26 AM
    What is the error you''re getting? I assume you have things connected to the appropriate I2C interface? There are a few changes that need to be made to the sensor_active( ) logic, since there is no mux on the lower 4 bits like on the ADS board.


    prashm_77@yahoo.com
    New Member
    New Member
    Posts:


    --
    08 Jan 2008 06:49 AM
    hai davek

    We are able to read the I2C dump of the Micron Sensor module, but after that when we run motion application we are seeing error.

    I think we need to do some changes in gpio_sensor_active and gpio_sensor_inactive function, please inform us, if any changes required, i am attaching the log

    mx31# i2cdetect 0
    WARNING! This program can confuse your I2C bus, cause data loss and worse!
    I will probe file /dev/i2c/0.
    I will probe address range 0x03-0x77.
    0 1 2 3 4 5 6 7 8 9 a b c d e f
    XX XX XX XX XX XX XX XX XX XX XX XX XX
    XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
    XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
    30 31 32 33 34 35 36 37 XX XX XX XX XX XX XX XX
    XX XX XX XX XX XX XX XX UU XX XX XX XX XX XX XX
    50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f
    XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
    XX XX XX 73 XX XX XX XX
    mx31# i2cdump 0 0x48 w
    WARNING! This program can confuse your I2C bus, cause data loss and worse!
    I will probe file /dev/i2c/0, address 0x48, mode word
    0,8 1,9 2,a 3,b 4,c 5,d 6,e 7,f
    00: 1915 1c00 3c00 b004 4006 0402 2f00 fe00
    08: 0c00 e804 0100 0000 0000 0000 0000 0000
    10: 0000 0000 0000 0000 0000 0000 0000 0000
    18: 0000 0000 0000 0000 0000 0000 0000 0000
    20: 0003 0084 0f01 0806 0080 0000 0700 0000
    28: 0000 0000 0000 3800 5000 4000 3800 3800
    30: 2a04 0000 aa02 4303 0f00 e80f f0f0 0000
    38: 6708 0000 0000 3f00 2020 0020 3f00 0010
    40: 0000 d700 7700 0000 0000 0000 0000 0000
    48: 0000 0000 0000 0000 0000 0000 0000 0000
    50: 0000 0000 0000 0000 0000 0000 ff87 0200
    58: 0000 ff00 0ae0 1e00 1f00 1e00 1f00 1d23
    60: 8000 f301 e701 ef01 f401 00e0 0010 7005
    68: 0000 0000 0000 0000 0000 0000 01b6 3f89
    70: 02b5 02b5 032b 121a 5088 5f70 8ab4 284f
    78: 01b6 09b6 0fb6 00ff 01b6 56b6 b700 1ab5
    80: 0284 0284 0381 1c26 066d 2334 0187 8800
    88: 036e 0182 0000 0000 0000 0000 0000 0000
    90: 6f7b ffff 5e71 798a 7a89 1923 ffff 111b
    98: 21b7 22b6 0000 0000 0000 0000 0000 0000
    a0: 3347 ffff 2235 456f 466e 2535 ffff 1b27
    a8: 3383 3482 0000 0000 0000 0000 0000 0000
    b0: 001a 0119 0218 001a 0119 0218 2c00 1a00
    b8: 0000 0000 0000 0000 0000 0000 0000 0000
    c0: 0000 6400 6400 9600 c800 6400 7800 204e
    c8: 5802 401f 1e00 0000 0000 0000 0000 0000
    d0: 0000 0000 0000 0000 0000 0000 0000 0000
    d8: 0000 0000 0000 0000 0000 0000 0000 0000
    e0: 0000 0000 0000 0000 0000 0000 0000 0000
    e8: 0000 0000 0000 0000 0000 0000 0000 0000
    f0: 0000 0000 0000 0000 0000 ff07 ff07 0000
    f8: 0000 0010 0000 0000 0000 0000 0000 1915
    mx31# i2cdetect 0           motion
    [0] Processing thread 0 - config file /usr/etc/motion.conf
    [0] Unknown config option "ffmpeg_cap_new"
    [0] Unknown config option "ffmpeg_video_codec"
    [0] Thread 1 is from /usr/etc/motion.conf
    [1] Thread started



    pra mt9v111_config



    pra mt9v111_interface



    pra mt9v111_i2c_client_xfer



    pra mt9v111_i2c_client_xfer



    pra mt9v111_i2c_client_xfer



    pra mt9v111_i2c_client_xfer



    pra mt9v111_i2c_client_xfer



    pra mt9v111_i2c_client_xfer



    pra mt9v111_i2c_client_xfer



    pra mt9v111_i2c_client_xfer



    pra mt9v111_i2c_client_xfer



    pra mt9v111_i2c_client_xfer



    pra mt9v111_i2c_client_xfer



    pra mt9v111_i2c_client_xfer



    pra mt9v111_i2c_client_xfer



    pra mt9v111_i2c_client_xfer



    pra mt9v111_i2c_client_xfer



    pra mt9v111_i2c_client_xfer



    pra mt9v111_i2c_client_xfer



    pra mt9v111_i2c_client_xfer



    pra mt9v111_i2c_client_xfer



    pra mt9v111_i2c_client_xfer



    pra mt9v111_i2c_client_xfer



    pra mt9v111_i2c_client_xfer



    pra mt9v111_i2c_client_xfer

    [1] cap.driver: "mxc_v4l2"
    [1] cap.card: ""
    [1] cap.bus_info: ""
    [1] cap.capabilities=0x05000005
    [1] - VIDEO_CAPTURE
    [1] - VIDEO_OVERLAY
    [1] - READWRITE
    [1] - STREAMING
    [1] Unable to query input 0.
    [1] VIDIOC_ENUMINPUT: Invalid argument
    [1] ioctl (VIDIOCGCAP): Invalid argument
    [1] Capture error calling vid_start
    [1] Thread finishing...
    mxc_v4l_close: release resource




    Posted By davek on 7 Jan 2008 8:26 AM
    What is the error you''re getting? I assume you have things connected to the appropriate I2C interface? There are a few changes that need to be made to the sensor_active( ) logic, since there is no mux on the lower 4 bits like on the ADS board.


    You are not authorized to post a reply.