This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TCA 8418 I2C Communication

Other Parts Discussed in Thread: TCA8418, TPS65910, TCA6416, TCA6408A, AM3359, TPS65217

Hi..

      I  want check i2c  communication with TCA8418 board to  beaglebone AM335x processor so that i have downloaded arago toolchin with kerlnel and u-boot from TI SDK 

ti-sdk-am335x-evm-05.04.01.00 version.I have booted SD Card with newly cross compiled kernel(version 3.2.0  and tca8418 module has beed added externaly)

and u-boot 2011.09.

     Board has been booted well But i am unable to communicate i2c with tca8418 board and can't find event from /dev/input/ to check key pressed

    Give me solution to check tca8418 keyboard with beaglebone (or)Explain the procedure to work with tca8418 i2c.

   what is needed  beyond.........solution pls

With Regards

Tamilarasi

  • I do not have this EVM. I am guessing that your board file needs TCA8418 platform data definition. Is the driver compiled with the kernel or as a loadable module? The device file might not be in /dev/input. Look around in /dev for any tca8418 directories.

  • Hi...

          Thank you for kind responsble answer...

         This TCA8418 driver is loaded as a module to kernel 3.2.0. It is ported after cross compiling to am335x process eventhought event is not found in /dev directory.This am335x i2c is communicating throught  I2C_2 SDA,SCL lines.

        I found in my /dev dirctory only I2c_1 and I2c_3 lines but not I2c_2 .

        How to enable i2c_2  line ?

    With Regards

    Tamilarasi

  • The i2c1 and i2c3 are probably configured in your board file. It should be a file in arch/arm/mach-omap2. Look for the ".o" file to see which one was compiled in. Look in your specific board.c to see how i2c1 and i2c3 are setup. Take care to check for pinmux conflicts.

    Loading the TCA8418 module as a loadable module might not work. Usually code in the board.c file adds the i2c device into the i2c core driver. The TCA8418 probably is not written to add itself.

  • Hi...

          I am trying to interface TCA8418 keyboard with am335x processor throught I2C communication.So I have cross compiled the TI kernel version 3.2.0 for arago toolchain. 

          Now I2C_3 line is working fine to communicate board with processor. Eventhought TCA8418 driver added as a module, Compilation has done throught procedure.

         The problem is event could not occur in beaglebone kernel /dev dirctory.

        Is there any other procedure to compile kernel with TCA8418 (or) which kernel would be support for am335x along with tca8418

    driver?

      By checking cat /proc/interrupts  I2C interrupts has incremented when i2cdump 3 0x34 is executed

     

      This is my cross compiled u-boot and kernel

    U-Boot SPL 2011.09 (Jul 19 2012 - 10:21:52)
    Texas Instruments Revision detection unimplemented
    No AC power, disabling frequency switch
    OMAP SD/MMC: 0
    reading u-boot.img
    reading u-boot.img


    U-Boot 2011.09 (Jul 19 2012 - 10:21:52)

    I2C:   ready
    DRAM:  256 MiB
    WARNING: Caches not enabled
    No daughter card present
    NAND:  HW ECC Hamming Code selected
    nand_get_flash_type: second ID read did not match 10,10 against 00,00
    No NAND device found!!!
    0 MiB
    MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
    *** Warning - readenv() failed, using default environment

    Net:   cpsw
    Hit any key to stop autoboot:  0
    SD/MMC found on device 0
    reading uEnv.txt

    33 bytes read
    Loaded environment from uEnv.txt
    Importing environment from mmc ...
    reading uImage

    3040712 bytes read
    ## Booting kernel from Legacy Image at 80007fc0 ...
       Image Name:   Linux-3.2.0
       Image Type:   ARM Linux Kernel Image (uncompressed)
       Data Size:    3040648 Bytes = 2.9 MiB
       Load Address: 80008000
       Entry Point:  80008000
       Verifying Checksum ... OK
       XIP Kernel Image ... OK
    OK

    Starting kernel ...

    Uncompressing Linux... done, booting the kernel.
    [    0.155090] tps65910 1-002d: could not be detected
    [    0.207794] Could not set LED4 to fully on
    [    0.911102] mtdoops: mtd device (mtddev=name/number) must be supplied
    [    1.017120] omap_hwmod: wkup_m3: wkup_m3: hwmod data error: OMAP4 does not support st_shift
    [   15.601654]
    [   15.601654] CPSW phy found : id is : 0x7c0f1
    [   15.608459] PHY 0:01 not found

    .---O---.                                           
    |       |                  .-.           o o        
    |   |   |-----.-----.-----.| |   .----..-----.-----.
    |       |     | __  |  ---'| '--.|  .-'|     |     |
    |   |   |  |  |     |---  ||  --'|  |  |  '  | | | |
    '---'---'--'--'--.  |-----''----''--'  '-----'-'-'-'
                    -'  |
                    '---'

    The Angstrom Distribution beaglebone ttyO0

    Angstrom v2012.01-core - Kernel 3.2.0

    I have checked keyscan using i2c tool commands

    i2cdetect -r 3
    device ID selected

    Before executing  i2cdump 3 0x34(i2cdump  i2cline  device Id)

    cat /proc/interrupts

     CPU0      
     12:       2634      INTC  edma
     14:          0      INTC  edma_error
     18:         41      INTC  musb-hdrc.0
     19:          1      INTC  musb-hdrc.1
     30:       3272      INTC  omap_i2c
     40:          0      INTC  cpsw.0
     43:          0      INTC  cpsw.0
     64:       8074      INTC  mmc0
     68:       5872      INTC  gp timer
     70:        143      INTC  omap_i2c
     72:       1664      INTC  OMAP UART0
     75:          0      INTC  rtc0
     76:          0      INTC  rtc0
     77:          0      INTC  wkup_m3
     78:          1      INTC  wkup_m3_txev
     93:        576      INTC  cpsw.0
     94:        101      INTC  cpsw.0
    166:          0      GPIO  mmc0
    Err:          0



    i2cdump 3 0x34

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
    00: c4 ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ?...............
    10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 XX    ...............X
    30: c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 XX    ???????????????X
    40: c4 ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ?...............
    50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 XX    ...............X
    70: c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 XX    ???????????????X
    80: c4 ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ?...............
    90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 XX    ...............X
    b0: c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 XX    ???????????????X
    c0: c4 ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ?...............
    d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 XX    ...............X
    f0: c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 XX    ???????????????X

    Atter Executing  i2cdump 3 0x34

    cat /proc/interrupts

               CPU0      
     12:       2640      INTC  edma
     14:          0      INTC  edma_error
     18:         41      INTC  musb-hdrc.0
     19:          1      INTC  musb-hdrc.1
     30:       4280      INTC  omap_i2c
     40:          0      INTC  cpsw.0
     43:          0      INTC  cpsw.0
     64:       8104      INTC  mmc0
     68:       6644      INTC  gp timer
     70:        143      INTC  omap_i2c
     72:       2042      INTC  OMAP UART0
     75:          0      INTC  rtc0
     76:          0      INTC  rtc0
     77:          0      INTC  wkup_m3
     78:          1      INTC  wkup_m3_txev
     93:        634      INTC  cpsw.0
     94:        111      INTC  cpsw.0
    166:          0      GPIO  mmc0
    Err:          0

        Kindly give me solution to this problem.

       With Regards.

       Senthamilarasi


  • Looks like you have managed to hook up your I2C device to i2c3 and you are talking to it. You could just talk to it using i2c but I asusme that you want to use the input interface. I am not sure what you have done so far in the kernel. The 3.2 kernel does not have the TCA8418 driver but later kernels have it. To port over the driver, the following files need to be changed.

    File:include/linux/input/tca8418_keypad.h
    Get from kernel.org or arago
    http://arago-project.org/git/projects/?p=linux-davinci.git;a=blob_plain;f=include/linux/input/tca8418_keypad.h;hb=HEAD

    File:drivers/input/keyboard/tca8418_keypad.c
    Get from kernel.org or arago
    http://arago-project.org/git/projects/?p=linux-davinci.git;a=blob_plain;f=drivers/input/keyboard/tca8418_keypad.c;hb=HEAD

    File:drivers/input/keyboard/Makefile
    obj-$(CONFIG_KEYBOARD_TCA6416)        += tca6416-keypad.o
    obj-$(CONFIG_KEYBOARD_TCA8418)        += tca8418_keypad.o
    obj-$(CONFIG_KEYBOARD_HIL)        += hil_kbd.o

    File: drivers/input/keyboard/Kconfig
    config KEYBOARD_TCA6416
        tristate "TCA6416/TCA6408A Keypad Support"
        depends on I2C
        help
          This driver implements basic keypad functionality
          for keys connected through TCA6416/TCA6408A IO expanders.

          Say Y here if your device has keys connected to
          TCA6416/TCA6408A IO expander. Your board-specific setup logic
          must also provide pin-mask details(of which TCA6416 pins
          are used for keypad).

          If enabled the entire TCA6416 device will be managed through
          this driver.

          To compile this driver as a module, choose M here: the
          module will be called tca6416_keypad.

    config KEYBOARD_TCA8418
        tristate "TCA8418 Keypad Support"
        depends on I2C
        help
          This driver implements basic keypad functionality
          for keys connected through TCA8418 keypad decoder.

          Say Y here if your device has keys connected to
          TCA8418 keypad decoder.

          If enabled the complete TCA8418 device will be managed through
          this driver.

          To compile this driver as a module, choose M here: the
          module will be called tca8418_keypad.

    config KEYBOARD_MATRIX

    File:arch/arm/configs/am335x_evm_defconfig
    # CONFIG_KEYBOARD_TCA6416 is not set
    CONFIG_KEYBOARD_TCA8418=y
    CONFIG_KEYBOARD_MATRIX=y

    File:arch/arm/mach-omap2/board-am3517evm.c
    A platform device needs to be added. I cannot find an example for this. You might want to contact the writer of the driver code. You might be able to guess it by looking at examples of other I2C keypad code on other boards.

  • Hi ....

         Thank you for valuable answer...

      As per your advice  have modified everthing in kernel  regarding TCA8418 driver, Except below mentioned file because it's already  existed in kernel as  board-am335xevm.c

    File:arch/arm/mach-omap2/board-am33xevm.c   so i didn't change anything.(i am using am3359 beaglebone processor)

    So i cross compiled compiled the kernel using the  following steps

    step 1: export PATH=~/am335x/ti-sdk-am335x-evm-05.04.01.00/linux-devkit/bin:$PATH

    step 2: export ARCH=arm

    step 3:export CROSS_COMPILE=arm-arago-linux-gnueabi-

    step 4:make ARCH=arm am335x_evm_defconfig

    step 5 :make menuconfig ====> here is enabled TCA8418 driver and i2c support modules(as predefined using *)

    step 6: make uImage

    Finally i got uImage in arch/arm/boot/uImage

    Then i ported this uImage to SDcard along with TI u-boot and MLO, Board is booted well.

    Eventhought i didn't get Event around /dev and /dev/input  directory,

     I2c communication is enabled and working fine.

    Note: I tried latest kernel 3.4.7 but here board-am335xevm.c support is not existed .

    Unable to find the problem in this kernel, Any other solution please (or) Any configuration needs for TCA8418  registers and am335x board.


    With Regards.

    M.senthamilarasi






  • The board file absolutely needs to modified to startup the driver. You will not get any event devices until then. There are also other questions of how to specify an GPIO IRQ for asynchronous notification. Might be that the driver uses polling. I suggest you e-mail the driver writer.

    Sorry about pointing you to the wrong board file. My error.

  • Hi..

       Thank you very much for your respose

    Now i understood the problem is in am335x board file, Needs in include platform data definitions about the TCA8418 device.

    Can you suggest me how to add platform data definitions to board file, Becase i am new this beaglebone environment and i have e-mailed to  the driver writter.

    =>kernel version 3.2.0

    =>board file is board-am335xevm.c

     =>i2c line  i2c_3

    If you have any idea of platform definitions please help me to this project.

    With Regards..

    Senthamilarasi

  • I can only make some guesses at what the structure initializations should be in your board.c file. No guarantees.

    File: arch/arm/mach-omap2/board-am335xevm.c

    ...
    #include <linux/input/tca8418_keypad.h>
    ...
    /* KEY(row, col, val) */
    static uint32_t tca8418_km_data[] = {
        KEY(0, 0, KEY_LEFT),
        KEY(0, 1, KEY_DOWN),
        KEY(0, 2, KEY_ENTER),
        KEY(0, 3, KEY_M),

        KEY(1, 0, KEY_RIGHT),
        KEY(1, 1, KEY_UP),
        KEY(1, 2, KEY_I),
        KEY(1, 3, KEY_N),

        KEY(2, 0, KEY_A),
        KEY(2, 1, KEY_E),
        KEY(2, 2, KEY_J),
        KEY(2, 3, KEY_O),

        KEY(3, 0, KEY_B),
        KEY(3, 1, KEY_F),
        KEY(3, 2, KEY_K),
        KEY(3, 3, KEY_P)
    };

    static const struct matrix_keymap_data tca8418_mkdata[] = {
        .keymap            = tca8418_km_data,
        .keymap_size        = ARRAY_SIZE(tca8418_km_data),
    };

    static struct tca8418_keypad_platform_data tca8418_pdata = {
        .keymap_data = &tca8418_mkdata;
        .rows = 4;
        .cols = 4;
        .rep = 1;         /* Just a guess */
        .irq_is_gpio = 0; /* Just a guess */
    };

    static struct i2c_board_info am335x_i2c_boardinfo2[] = {
        {
            I2C_BOARD_INFO(TCA8418_NAME, TCA8418_I2C_ADDR),
            .platform_data = &tca8418_pdata,
        },
    };
    ...

    Search around in your kernel source for usage of the matrix_keymap_data structure. There are a lot of examples.

  • Hi Norman Wong

                    i was on leave around one month so that unable continue my work. Recently i started my keyboard work.

      I have added below platform data with my board file board-am335xevm.c

           static struct tca8418_keypad_platform_data am335x_tca8418_info = {
            .keymap_data = &am335x_evm_keymap_data,
            .rows=8,
            .cols=10,
            .rep=0,
            .irq_is_gpio=0,

       };

          {
                   I2C_BOARD_INFO("tca8418_keypad", 0x34),
                    .platform_data=&am335x_tca8418_info,
            },

    ==>After compilation of this kernel, I have ported this uImage to the board.

    ==>Now i am getting event0 on /dev/input/event0 and /sys/class/input/event0 but keys are not detected from tca8418 board.

    ==>After porting this image donot connect the TCA8418 keyboard to the beaglebone but event0 is existed.

    ==>By using I2c tools can be accessed the keyboard, So i confomed that keyboard is working fine, and it has been set as keypad mode.

    I posted Boot log and dmesg please help us to solve this problem.

    root@beaglebone:~# ls /dev/input
    by-path  event0  mice

    root@beaglebone:~# ls /sys/class/input/
    event0  input0  mice

    Boot log

    Starting kernel ...

    Uncompressing Linux... done, booting the kernel.
    [    0.155273] tps65910 1-002d: could not be detected
    [    1.168151] omap_i2c omap_i2c.3: controller timed out
    [    1.188140] tps65910 3-002d: could not be detected
    [    1.241302] Could not set LED4 to fully on
    [    2.242340] omap_i2c omap_i2c.3: controller timed out
    [    2.242401] Could not set LED4 to fully on
    [    2.380340] kobject_add_internal failed for omap_i2c.3 with -EEXIST, don't try to register things with the .
    [    2.394897] omap_device: omap_i2c: build failed (-17)
    [    2.524475] mtdoops: mtd device (mtddev=name/number) must be supplied
    [    2.606231] omap_hwmod: wkup_m3: wkup_m3: hwmod data error: OMAP4 does not support st_shift
    Failed to mount /sys/kernel/security: No such file or directory

    .---O---.                                           
    |       |                  .-.           o o        
    |   |   |-----.-----.-----.| |   .----..-----.-----.
    |       |     | __  |  ---'| '--.|  .-'|     |     |
    |   |   |  |  |     |---  ||  --'|  |  |  '  | | | |
    '---'---'--'--'--.  |-----''----''--'  '-----'-'-'-'
                    -'  |
                    '---'

    The Angstrom Distribution beaglebone ttyO0

    Angstrom v2012.03-core - Kernel 3.2.0

    dmesg | grep tca8418

    [    0.155639] tca8418 keyscan key probe
    [    0.156219] input: tca8418_keypad as /devices/platform/omap/omap_i2c.1/i2c-1/1-0034/input/input0

    dmesg

    [    0.000000] Linux version 3.2.0 (arasi@arasi) (gcc version 4.5.3 20110311 (prerelease) (GCC) ) #2 Fri Sep 12
    [    0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c53c7d
    [    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
    [    0.000000] Machine: am335xevm
    [    0.000000] Memory policy: ECC disabled, Data cache writeback
    [    0.000000] On node 0 totalpages: 65536
    [    0.000000] free_area_init_node: node 0, pgdat c065545c, node_mem_map c068c000
    [    0.000000]   Normal zone: 512 pages used for memmap
    [    0.000000]   Normal zone: 0 pages reserved
    [    0.000000]   Normal zone: 65024 pages, LIFO batch:15
    [    0.000000] AM335X ES1.0 (sgx neon )
    [    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
    [    0.000000] pcpu-alloc: [0] 0
    [    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 65024
    [    0.000000] Kernel command line: console=ttyO0,115200n8 run_hardware_tests quiet root=/dev/mmcblk0p2 rw rooe
    [    0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
    [    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
    [    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
    [    0.000000] Memory: 256MB = 256MB total
    [    0.000000] Memory: 253152k/253152k available, 8992k reserved, 0K highmem
    [    0.000000] Virtual kernel memory layout:
    [    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    [    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    [    0.000000]     vmalloc : 0xd0800000 - 0xff000000   ( 744 MB)
    [    0.000000]     lowmem  : 0xc0000000 - 0xd0000000   ( 256 MB)
    [    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
    [    0.000000]       .text : 0xc0008000 - 0xc05c3000   (5868 kB)
    [    0.000000]       .init : 0xc05c3000 - 0xc0600000   ( 244 kB)
    [    0.000000]       .data : 0xc0600000 - 0xc065e320   ( 377 kB)
    [    0.000000]        .bss : 0xc065e344 - 0xc068b424   ( 181 kB)
    [    0.000000] NR_IRQS:396
    [    0.000000] IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128 interrupts
    [    0.000000] Total of 128 interrupts on 1 active controller
    [    0.000000] OMAP clockevent source: GPTIMER2 at 24000000 Hz
    [    0.000000] OMAP clocksource: GPTIMER1 at 32768 Hz
    [    0.000000] sched_clock: 32 bits at 32kHz, resolution 30517ns, wraps every 131071999ms
    [    0.000000] Console: colour dummy device 80x30
    [    0.000183] Calibrating delay loop... 498.89 BogoMIPS (lpj=2494464)
    [    0.058166] pid_max: default: 32768 minimum: 301
    [    0.058319] Security Framework initialized
    [    0.058441] Mount-cache hash table entries: 512
    [    0.058898] CPU: Testing write buffer coherency: ok
    [    0.059844] devtmpfs: initialized
    [    0.080566] omap_hwmod: gfx: failed to hardreset
    [    0.097320] omap_hwmod: pruss: failed to hardreset
    [    0.098724] print_constraints: dummy:
    [    0.099182] NET: Registered protocol family 16
    [    0.101989] OMAP GPIO hardware version 0.1
    [    0.105560] omap_mux_init: Add partition: #1: core, flags: 0
    [    0.108520]  omap_i2c.1: alias fck already exists
    [    0.109710]  omap2_mcspi.1: alias fck already exists
    [    0.109985]  omap2_mcspi.2: alias fck already exists
    [    0.110351]  edma.0: alias fck already exists
    [    0.110382]  edma.0: alias fck already exists
    [    0.110412]  edma.0: alias fck already exists
    [    0.144836] bio: create slab <bio-0> at 0
    [    0.147796] SCSI subsystem initialized
    [    0.149993] usbcore: registered new interface driver usbfs
    [    0.150421] usbcore: registered new interface driver hub
    [    0.150695] usbcore: registered new device driver usb
    [    0.150848] musb-ti81xx musb-ti81xx: musb0, board_mode=0x13, plat_mode=0x3
    [    0.151245] musb-ti81xx musb-ti81xx: musb1, board_mode=0x13, plat_mode=0x1
    [    0.152954] omap_i2c omap_i2c.1: bus 1 rev2.4.0 at 100 kHz
    [    0.154815] tps65910 1-002d: could not be detected
    [    0.155181] tca8418 keyscan key probe
    [    0.155822] input: tca8418_keypad as /devices/platform/omap/omap_

    i2c.1/i2c-1/1-0034/input/input0
    [    0.157012] Advanced Linux Sound Architecture Driver Version 1.0.24.
    [    0.158630] Switching to clocksource gp timer
    [    0.183654] musb-hdrc: version 6.0, ?dma?, otg (peripheral+host)
    [    0.183868] musb-hdrc musb-hdrc.0: dma type: pio
    [    0.184326] musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk split, HB-ISO Rx, HB-ISO Tx, )
    [    0.184356] musb-hdrc: MHDRC RTL version 2.0
    [    0.184356] musb-hdrc: setup fifo_mode 4
    [    0.184417] musb-hdrc: 28/31 max ep, 16384/16384 memory
    [    0.185058] musb-hdrc musb-hdrc.0: USB OTG mode controller at d081c000 using PIO, IRQ 18
    [    0.185272] musb-hdrc musb-hdrc.1: dma type: pio
    [    0.185699] musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk split, HB-ISO Rx, HB-ISO Tx, )
    [    0.185729] musb-hdrc: MHDRC RTL version 2.0
    [    0.185729] musb-hdrc: setup fifo_mode 4
    [    0.185760] musb-hdrc: 28/31 max ep, 16384/16384 memory
    [    0.185821] musb-hdrc musb-hdrc.1: MUSB HDRC host driver
    [    0.185913] musb-hdrc musb-hdrc.1: new USB bus registered, assigned bus number 1
    [    0.186096] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
    [    0.186096] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    [    0.186126] usb usb1: Product: MUSB HDRC host driver
    [    0.186126] usb usb1: Manufacturer: Linux 3.2.0 musb-hcd
    [    0.186157] usb usb1: SerialNumber: musb-hdrc.1
    [    0.187408] hub 1-0:1.0: USB hub found
    [    0.187469] hub 1-0:1.0: 1 port detected
    [    0.188293] musb-hdrc musb-hdrc.1: USB Host mode controller at d081e800 using PIO, IRQ 19
    [    0.188903] NET: Registered protocol family 2
    [    0.189147] IP route cache hash table entries: 2048 (order: 1, 8192 bytes)
    [    0.189514] TCP established hash table entries: 8192 (order: 4, 65536 bytes)
    [    0.189758] TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
    [    0.189880] TCP: Hash tables configured (established 8192 bind 8192)
    [    0.189910] TCP reno registered
    [    0.189910] UDP hash table entries: 256 (order: 0, 4096 bytes)
    [    0.189941] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
    [    0.190185] NET: Registered protocol family 1
    [    0.190521] RPC: Registered named UNIX socket transport module.
    [    0.190551] RPC: Registered udp transport module.
    [    0.190551] RPC: Registered tcp transport module.
    [    0.190582] RPC: Registered tcp NFSv4.1 backchannel transport module.
    [    0.190856] NetWinder Floating Point Emulator V0.97 (double precision)
    [    0.204650] VFS: Disk quotas dquot_6.5.2
    [    0.204742] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
    [    0.205871] msgmni has been set to 494
    [    0.206848] io scheduler noop registered
    [    0.206848] io scheduler deadline registered
    [    0.206939] io scheduler cfq registered (default)
    [    0.208526] Could not set LED4 to fully on
    [    0.210845] omap_uart.0: ttyO0 at MMIO 0x44e09000 (irq = 72) is a OMAP UART0
    [    0.220458] console [ttyO0] enabled
    [    0.221160] omap_uart.1: ttyO1 at MMIO 0x48022000 (irq = 73) is a OMAP UART1
    [    0.221832] omap_uart.2: ttyO2 at MMIO 0x48024000 (irq = 74) is a OMAP UART2
    [    0.222442] omap_uart.3: ttyO3 at MMIO 0x481a6000 (irq = 44) is a OMAP UART3
    [    0.223022] omap_uart.4: ttyO4 at MMIO 0x481a8000 (irq = 45) is a OMAP UART4
    [    0.223632] omap_uart.5: ttyO5 at MMIO 0x481aa000 (irq = 46) is a OMAP UART5
    [    0.237792] brd: module loaded
    [    0.245330] loop: module loaded
    [    0.245605] i2c-core: driver [tsl2550] using legacy suspend method
    [    0.245605] i2c-core: driver [tsl2550] using legacy resume method
    [    0.245727] at24 1-0051: 32768 byte 24c256 EEPROM, writable, 64 bytes/write
    [    0.298828] No daughter card found on AM335x EVM
    [    0.298889] at24 1-0050: 32768 byte 24c256 EEPROM, writable, 64 bytes/write
    [    0.306854] Board name: A335BONE
    [    0.306854] Board version: 00A3
    [    0.306884] The board is a AM335x Beaglebone.
    [    0.307891] tps65217 1-0024: TPS65217 ID 0x7 version 1.0
    [    0.310180] print_constraints: DCDC1: 900 <--> 1800 mV at 1800 mV
    [    0.312561] print_constraints: DCDC2: 900 <--> 3300 mV at 1275 mV
    [    0.314910] print_constraints: DCDC3: 900 <--> 1500 mV at 1100 mV
    [    0.317199] print_constraints: LDO1: 1000 <--> 3300 mV at 1800 mV
    [    0.319519] print_constraints: LDO2: 900 <--> 3300 mV at 3300 mV
    [    0.321838] print_constraints: LDO3: 1800 <--> 3300 mV at 3300 mV
    [    0.324127] print_constraints: LDO4: 1800 <--> 3300 mV at 3300 mV
    [    0.324676]  omap_hsmmc.0: alias fck already exists
    [    0.325225]  omap_i2c.3: alias fck already exists
    [    0.325683] omap_i2c omap_i2c.3: bus 3 rev2.4.0 at 100 kHz
    [    0.326080] i2c i2c-3: Invalid 7-bit I2C address 0x00
    [    0.331451] i2c i2c-3: Can't create device at 0x00
    [    0.339447] mtdoops: mtd device (mtddev=name/number) must be supplied
    [    0.346771] omap2-nand driver initializing
    [    0.347015] OneNAND driver initializing
    [    0.348907] CAN device driver interface
    [    0.348937] CAN bus driver for Bosch D_CAN controller 1.0
    [    0.398864] davinci_mdio davinci_mdio.0: davinci mdio revision 1.6
    [    0.398895] davinci_mdio davinci_mdio.0: detected phy mask fffffffe
    [    0.399780] davinci_mdio.0: probed
    [    0.399810] davinci_mdio davinci_mdio.0: phy[0]: device 0:00, driver SMSC LAN8710/LAN8720
    [    0.400238] usbcore: registered new interface driver zd1201
    [    0.400512] usbcore: registered new interface driver cdc_ether
    [    0.400726] usbcore: registered new interface driver cdc_eem
    [    0.400939] usbcore: registered new interface driver dm9601
    [    0.401000] cdc_ncm: 04-Aug-2011
    [    0.401214] usbcore: registered new interface driver cdc_ncm
    [    0.401245] Initializing USB Mass Storage driver...
    [    0.401550] usbcore: registered new interface driver usb-storage
    [    0.401580] USB Mass Storage support registered.
    [    0.402374] mousedev: PS/2 mouse device common for all mice
    [    0.404205] omap_rtc omap_rtc: rtc core: registered omap_rtc as rtc0
    [    0.404266] omap_rtc: already running
    [    0.404479] i2c /dev entries driver
    [    0.405456] Linux video capture interface: v2.00
    [    0.405914] usbcore: registered new interface driver uvcvideo
    [    0.405914] USB Video Class driver (1.1.1)
    [    0.409362] OMAP Watchdog Timer Rev 0x01: initial timeout 60 sec
    [    0.411102] cpuidle: using governor ladder
    [    0.411804] cpuidle: using governor menu
    [    0.417266] usbcore: registered new interface driver usbhid
    [    0.417266] usbhid: USB HID core driver
    [    0.418182] usbcore: registered new interface driver snd-usb-audio
    [    0.420349] ALSA device list:
    [    0.420349]   No soundcards found.
    [    0.420379] oprofile: hardware counters not available
    [    0.420379] oprofile: using timer interrupt.
    [    0.420410] nf_conntrack version 0.5.0 (3955 buckets, 15820 max)
    [    0.421081] ip_tables: (C) 2000-2006 Netfilter Core Team
    [    0.421234] TCP cubic registered
    [    0.421264] NET: Registered protocol family 17
    [    0.421295] can: controller area network core (rev 20090105 abi 8)
    [    0.421417] NET: Registered protocol family 29
    [    0.421447] can: raw protocol (rev 20090105)
    [    0.421447] can: broadcast manager protocol (rev 20090105 t)
    [    0.421508] Registering the dns_resolver key type
    [    0.421630] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
    [    0.421661] ThumbEE CPU extension supported.
    [    0.421722] mux: Failed to setup hwmod io irq -22
    [    0.422515] Power Management for AM33XX family
    [    0.422760] Trying to load am335x-pm-firmware.bin (60 secs timeout)
    [    0.422882] Copied the M3 firmware to UMEM
    [    0.422912] omap_hwmod: wkup_m3: wkup_m3: hwmod data error: OMAP4 does not support st_shift
    [    0.436157] clock: disabling unused clocks to save power
    [    0.439117] Detected MACID=d4:94:a1:36:21:a7
    [    0.440948] omap_rtc omap_rtc: setting system clock to 2000-01-01 00:05:45 UTC (946685145)
    [    0.441619] Waiting for root device /dev/mmcblk0p2...
    [    0.533172] mmc0: host does not support reading read-only switch. assuming write-enable.
    [    0.538330] mmc0: new high speed SDHC card at address aaaa
    [    0.539215] mmcblk0: mmc0:aaaa SU04G 3.69 GiB
    [    0.542999]  mmcblk0: p1 p2
    [    0.639129] usb 1-1: new full-speed USB device number 2 using musb-hdrc
    [    0.779815] usb 1-1: New USB device found, idVendor=0fe6, idProduct=9700
    [    0.779846] usb 1-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
    [    0.779846] usb 1-1: Product: USB 2.0 10/100M Ethernet Adaptor
    [    0.796478] dm9601 1-1:1.0: eth1: register 'dm9601' at usb-musb-hdrc.1-1, Davicom DM9601 USB Ethernet, 00:e8
    [    0.804199] EXT4-fs (mmcblk0p2): warning: maximal mount count reached, running e2fsck is recommended
    [    0.807769] EXT4-fs (mmcblk0p2): ext4_orphan_cleanup: deleting unreferenced inode 9617
    [    0.809539] EXT4-fs (mmcblk0p2): 1 orphan inode deleted
    [    0.809570] EXT4-fs (mmcblk0p2): recovery complete
    [    0.839263] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
    [    0.839355] VFS: Mounted root (ext4 filesystem) on device 179:2.
    [    0.841583] devtmpfs: mounted
    [    0.842102] Freeing init memory: 244K
    [   11.587158] udevd[614]: starting version 182
    [   11.760009] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
    root@beaglebone:~#
    please read above message and give me solution...
    With Regards.
    Senthamilarasi








         


  • The dmesg looks okay. The tca8418 code seems to print errors if anything went wrong. A couple things to check.

    The file "/dev/input/event0" is a symbolic link to "/devices/platform/omap/omap_i2c.1/i2c-1/1-0034/input/input0".

    In your event0 tests, you are executing as root.

    You have reached the limits of my knowledge on the subject. Hopefully somebody more knowledgable than me can advise you.

  • Dear Sir,

    I am using beaglebone white with linux kernel source ti-sdk-am335x-evm-06.00.00.00. 

    I want to interface i2c based I/O expander tca6416 ic with beaglebone on i2c-1. I have modified am335xboard.c file and selected the tca6416 option in make menuconfig option. I then compiled linux kernel and booted the board with generated uImage.

    I can see the entry of i2c-2 in /dev folder but there is no entry of tca6416-keypad driver in /dev/input device. I have checked that the tca6416-keypad.c in /drivers/input/keyboard folder of linux 3.2 kernel source have the capability for the required application.

    My application is to check the port status of tca6416 input pins and get interrupt alert when there is any change in port status.

    I want to read the port status whenever there is interrupt in my user application.

    Below are contents of beaglebone board.c file.

    static struct tca6416_button tca6416_gpio_keys[] = {
    KEYPAD_BUTTON(KEY1,1,EV_KEY),
    KEYPAD_BUTTON(KEY2,1,EV_KEY),
    KEYPAD_BUTTON(KEY3,1,EV_KEY),
    KEYPAD_BUTTON(KEY4,1,EV_KEY),
    KEYPAD_BUTTON(KEY5,1,EV_KEY),
    KEYPAD_BUTTON(KEY6,1,EV_KEY),
    KEYPAD_BUTTON(KEY7,1,EV_KEY),
    KEYPAD_BUTTON(KEY8,1,EV_KEY),

    };

    static struct tca6416_keys_platform_data am335x_tca6416_keys_info = {

    .buttons = tca6416_gpio_keys,
    .nbuttons = ARRAY_SIZE(tca6416_gpio_keys),
    .rep = 0, /* enable input subsystem auto repeat */
    .pinmask = 0,
    .invert = 0,
    .irq_is_gpio = 32, //GPIO1_0
    .use_polling=0, /* use polling if Interrupt is not connected*/
    };

    static struct i2c_board_info __initdata am335x_i2c1_boardinfo[] = { //Ajay added
    {
    I2C_BOARD_INFO("tca6416-keypad", 0x20),
    .platform_data = &am335x_tca6416_keys_info,
    },
    };
    /***************************************************/
    static struct i2c_board_info am335x_i2c2_boardinfo[] = {

    };

    static void i2c2_init(int evm_id, int profile)
    {
    setup_pin_mux(i2c2_pin_mux);
    omap_register_i2c_bus(3, 100, am335x_i2c2_boardinfo,
    ARRAY_SIZE(am335x_i2c2_boardinfo));
    return;
    }

    My board bootlog shows that it has detected the i2c device at 400khz on i2c-2 port.

    Can you please guide me that what is the issue that there is no entry of tca6416 device in /dev/input.

    and 

    Also, how can we read the status of port of tca6416 input on user application.

    Thanks & Regards,

    Ajay Rajput

  • No experience with the AM335x BeagleBone or tca6416. Some guesses. Are you compiling the tca6416 as a module or as a built-in? A module might require you to manually insmod the module or copy the module into the "/lib/modules" area.

    Seems the only other example of the tca6416 is in the mackerel baord. Using that board's platform code as a guide, your code might look something like this:

    ----------------------
    // From arch/arm/mach-shmobile/board-mackerel.c
    #define KEYPAD_BUTTON(ev_type, ev_code, act_low) \
    {\
      .type = ev_type,\
      .code = ev_code,\
      .active_low = act_low,\
    }
    #define KEYPAD_BUTTON_LOW(event_code) KEYPAD_BUTTON(EV_KEY, event_code, 1)

    static struct tca6416_button tca6416_gpio_keys[] = {
      KEYPAD_BUTTON_LOW(KEY1), //<--- changed
      KEYPAD_BUTTON_LOW(KEY2), //<--- changed
      KEYPAD_BUTTON_LOW(KEY3), //<--- changed
      KEYPAD_BUTTON_LOW(KEY4), //<--- changed
      KEYPAD_BUTTON_LOW(KEY5), //<--- changed
      KEYPAD_BUTTON_LOW(KEY6), //<--- changed
      KEYPAD_BUTTON_LOW(KEY7), //<--- changed
      KEYPAD_BUTTON_MOW(KEY8), //<--- changed
    };

    static struct tca6416_keys_platform_data am335x_tca6416_keys_info = {
      .buttons = tca6416_gpio_keys,
      .nbuttons = ARRAY_SIZE(tca6416_gpio_keys),
      .rep = 0, /* enable input subsystem auto repeat */
      .pinmask = 0xFF, //<------------ Was 0
      .invert = 0,
      .irq_is_gpio = 32, //GPIO1_0
      .use_polling=0, /* use polling if Interrupt is not connected*/
    };

    static struct i2c_board_info __initdata am335x_i2c1_boardinfo[] = { //Ajay added
    {
      //<---- Moved assumes tca6416 is connected to i2c2
    };
    /***************************************************/
    static struct i2c_board_info am335x_i2c2_boardinfo[] = {
      {
        I2C_BOARD_INFO("tca6416-keys", 0x20), //<------ Was "tca6416-keypad"
        .platform_data = &am335x_tca6416_keys_info,
    // .irq = ? // TODO
      },
    };

    static void i2c2_init(int evm_id, int profile)
    {
      setup_pin_mux(i2c2_pin_mux);
      omap_register_i2c_bus(3, 100, am335x_i2c2_boardinfo,
      ARRAY_SIZE(am335x_i2c2_boardinfo));
      return;
    }

  • Dear Sir,

    Thanks for the reply. 

    I am compiling the tca6416 as built in static module in kernel.

    After your suggestion, i am able to generate entry of tca6416 device in /dev/input/ as event0 after booting the beaglebone with new uImage after correction applied.

    Can you suggest me that how should i read the port status of tca6416 inputs from /dev/input/event0 device in user space program.

    Thanks & Regards,

    Ajay Rajput

  • Dear Sir, 

    I would also want to know that in my previous query, what should be address/value of KEY1 to KEY8.

    I my board file.c , i have kept

    #define KEY1 0

    #define KEY2 1

    #define KEY3 2

    #define KEY4 3

    #define KEY5 4

    #define KEY6 5

    #define KEY7 6

    #define KEY8 7

    I am doubtful that above values are wrong, but i am not aware what should be the values.

    Thanks & Regards,

    Ajay

  • I think you should use the predefined linux kernel input values. You might not have to but it is safer if kernel input driver that depends on it. Your code would then look something like this:
    -----------kernel----------
    #include <linux/input.h> // For EV_KEY, KEY_1-KEY8

    static struct tca6416_button tca6416_gpio_keys[] = {
    // code active_low type
      {KEY_1, 1, EV_KEY},
      {KEY_2, 1, EV_KEY},
      {KEY_3, 1, EV_KEY},
      {KEY_4, 1, EV_KEY},
      {KEY_5, 1, EV_KEY},
      {KEY_6, 1, EV_KEY},
      {KEY_7, 1, EV_KEY},
      {KEY_8, 1, EV_KEY},
    };

    static struct tca6416_keys_platform_data am335x_tca6416_keys_info = {
      .buttons = tca6416_gpio_keys,
      .nbuttons = ARRAY_SIZE(tca6416_gpio_keys),
      .rep = 0, /* enable input subsystem auto repeat */
      .pinmask = 0xFF,
      .invert = 0,
      .irq_is_gpio = 32, //GPIO1_0
      .use_polling=0, /* use polling if Interrupt is not connected*/
    };

    static struct i2c_board_info am335x_i2c2_boardinfo[] = {
      {
        I2C_BOARD_INFO("tca6416-keys", 0x20),
        .platform_data = &am335x_tca6416_keys_info,
    // .irq = ? // TODO
      },
    };

    static void i2c2_init(int evm_id, int profile)
    {
      setup_pin_mux(i2c2_pin_mux);
      omap_register_i2c_bus(3, 100, am335x_i2c2_boardinfo,
      ARRAY_SIZE(am335x_i2c2_boardinfo));
      return;
    }
    -----------userspace----------
    // You must path in the linux kernel include directory for this
    #include <linux/input.h> // For EV_KEY, KEY_1-KEY8
    int fd;
    struct input_event ev;
    int size = sizeof (struct input_event);

    fd = open ("/dev/input/event0", O_RDONLY);
    read(fd, &ev, size);
    if(ev.type == EV_KEY)
    {
      switch(ev.code)
      {
        case KEY_1: printf("1 is %d\n", ev.value); break;
        ...
        case KEY_8: printf("8 is %d\n", ev.value); break;
      }
    }
    ----
    The BTN_1 to BTN_8 may be decriptively better. Please start a new thread if you have another problem.

  • Dear Sir,

    Thanks for the reply.

    As per you suggestion, i am able to detect the keys in user space  application.

    Actual problem in board.c file was as below:

    static struct tca6416_keys_platform_data am335x_tca6416_keys_info = {
      .buttons = tca6416_gpio_keys,
      .nbuttons = ARRAY_SIZE(tca6416_gpio_keys),
      .rep = 0, /* enable input subsystem auto repeat */
      .pinmask = 0xFF,
      .invert = 0,
      .irq_is_gpio = 1, <-- it should be 0 or 1 flag //1 if interrupt is required
      .use_polling=0, /* use polling if Interrupt is not connected*/
    };

    static struct i2c_board_info am335x_i2c2_boardinfo[] = {
      {
        I2C_BOARD_INFO("tca6416-keys", 0x20),
        .platform_data = &am335x_tca6416_keys_info,
        .irq = 32 //for GPIO1_0 pin as interrupt source should be define here.
      },
    };

    Thanks.

    Regards,
    Ajay Rajput

  • I am not clear on what you are saying. What are the symptoms of the problem? Are you saying you are trying to use interrupt driven events? From the userspace side that requires the use of poll(). Assumes the driver's interrupt has been setup correctly.

  • Hi Norman,

    I've seen the answer and the exmaple you've given:
    static uint32_t tca8418_km_data[] = {
    KEY(0, 0, KEY_LEFT),
    KEY(0, 1, KEY_DOWN),
    KEY(0, 2, KEY_ENTER),
    KEY(0, 3, KEY_M),

    KEY(1, 0, KEY_RIGHT),
    KEY(1, 1, KEY_UP),
    KEY(1, 2, KEY_I),
    KEY(1, 3, KEY_N),

    KEY(2, 0, KEY_A),
    KEY(2, 1, KEY_E),
    KEY(2, 2, KEY_J),
    KEY(2, 3, KEY_O),

    KEY(3, 0, KEY_B),
    KEY(3, 1, KEY_F),
    KEY(3, 2, KEY_K),
    KEY(3, 3, KEY_P)
    };

    But According to datasheet , it seems that each row/col should be used with specific number of event, and not whatever we want. see below (page 15 in datasheet):

    Table 1. Key Event Table (Keypad Array)

    C0 C1 C2 C3 C4 C5 C6 C7 C8 C9
    R0 1 2 3 4 5 6 7 8 9 10
    R1 11 12 13 14 15 16 17 18 19 20
    R2 21 22 23 24 25 26 27 28 29 30
    R3 31 32 33 34 35 36 37 38 39 40
    R4 41 42 43 44 45 46 47 48 49 50
    R5 51 52 53 54 55 56 57 58 59 60
    R6 61 62 63 64 65 66 67 68 69 70
    R7 71 72 73 74 75 76 77 78 79 80

    As I understand therefore the above code example, cannot be used and need to be modified acoording to the KEY_* which represent the number for the given (row,column).

    Is that Right ?

    Regards,
    Ran