Post Go back to editing

i2c on BF537 stamp

Hi,

I have problems to get a i2c communication between the BF537 and simple i2c device (LM75) running.

my question: i would expect to find something like /dev/i2c-0 in the /dev directory.

what I have is:

root:/dev> ls

console             network_throughput  ram14               random

cpu_dma_latency     null                ram15               rtc0

fd                  ptmx                ram2                stderr

foo                 pts                 ram3                stdin

full                ram0                ram4                stdout

kmsg                ram1                ram5                tty

log                 ram10               ram6                ttyBF0

mdev.seq            ram11               ram7                urandom

mem                 ram12               ram8                watchdog

network_latency     ram13               ram9                zero

does that mean that my kernel is not i2c capable?

and if not, since I flagged i2c support (x), what should I do else?

thanks in advance

Ralph

  • Which uClinux-dist release do you use?

    It looks you either forget to enable I2C device interface kernel option or the i2c-bfin-twi driver.

    Could you please check your kernel configuration under device drivers -> I2C support -> I2C hardware bus support?

  • hi Sonic,

    thanks for your quick answer.

    my uClinux-dist is:

    blackfin-linux-dist-2010R1-RC5

    I just recompiled the kernel with following settings:

    {M} I2C support  ---> 

    --- I2C support 

    [*]   Enable compatibility bits for old user-space 

    <M>   I2C device interface

    [*]   Autoselect pertinent helper modules

    I2C Hardware Bus support  --->

    [ ]   I2C Core debugging messages

    [ ]   I2C Algorithm debugging messages

    [ ]   I2C Bus debugging messages

    the compiled version is now:

    root:/> version

    kernel:    Linux release 2.6.34.7-ADI-2010R1, build #20 Mon Apr 9 15:48:54 CEST 2012

    toolchain: bfin-uclinux-gcc release gcc version 4.3.5 (ADI-2010R1-RC4)

    user-dist: release 2010R1, build #9 Mon Apr 9 15:48:35 CEST 2012

    However I got the same result as before still without the link /dev/i2c-0:

    root:/dev> ls -la

    drwxr-xr-x    3 root     root             0 Jan 13 05:35 .

    drwxr-xr-x   14 root     root             0 Jan  1  2007 ..

    crw-rw----    1 root     root        5,   1 Jan 13 05:35 console

    crw-rw----    1 root     root       10,  63 Jan 13 05:35 cpu_dma_latency

    lrwxrwxrwx    1 root     root            13 Jan 13 05:35 fd -> /proc/self/fd

    crw-rw----    1 root     root        1,   7 Jan 13 05:35 full

    crw-rw----    1 root     root        1,  11 Jan 13 05:35 kmsg

    srw-rw-rw-    1 root     root             0 Jan 13 05:35 log

    -rw-r--r--    1 root     root             0 Jan 13 05:35 mdev.seq

    crw-rw----    1 root     root        1,   1 Jan 13 05:35 mem

    crw-rw----    1 root     root       10,  62 Jan 13 05:35 network_latency

    crw-rw----    1 root     root       10,  61 Jan 13 05:35 network_throughput

    crw-rw----    1 root     root        1,   3 Jan 13 05:35 null

    crw-rw----    1 root     root        5,   2 Jan 13 05:52 ptmx

    drwxr-xr-x    2 root     root             0 Jan  1  2007 pts

    brw-rw----    1 root     root        1,   0 Jan 13 05:35 ram0

    brw-rw----    1 root     root        1,   1 Jan 13 05:35 ram1

    brw-rw----    1 root     root        1,  10 Jan 13 05:35 ram10

    brw-rw----    1 root     root        1,  11 Jan 13 05:35 ram11

    brw-rw----    1 root     root        1,  12 Jan 13 05:35 ram12

    brw-rw----    1 root     root        1,  13 Jan 13 05:35 ram13

    brw-rw----    1 root     root        1,  14 Jan 13 05:35 ram14

    brw-rw----    1 root     root        1,  15 Jan 13 05:35 ram15

    brw-rw----    1 root     root        1,   2 Jan 13 05:35 ram2

    brw-rw----    1 root     root        1,   3 Jan 13 05:35 ram3

    brw-rw----    1 root     root        1,   4 Jan 13 05:35 ram4

    brw-rw----    1 root     root        1,   5 Jan 13 05:35 ram5

    brw-rw----    1 root     root        1,   6 Jan 13 05:35 ram6

    brw-rw----    1 root     root        1,   7 Jan 13 05:35 ram7

    brw-rw----    1 root     root        1,   8 Jan 13 05:35 ram8

    brw-rw----    1 root     root        1,   9 Jan 13 05:35 ram9

    crw-rw----    1 root     root        1,   8 Jan 13 05:35 random

    crw-rw----    1 root     root      254,   0 Jan 13 05:35 rtc0

    lrwxrwxrwx    1 root     root             4 Jan 13 05:35 stderr -> fd/2

    lrwxrwxrwx    1 root     root             4 Jan 13 05:35 stdin -> fd/0

    lrwxrwxrwx    1 root     root             4 Jan 13 05:35 stdout -> fd/1

    crw-rw----    1 root     root        5,   0 Jan 13 05:35 tty

    crw-rw----    1 root     root      204,  64 Jan 13 05:35 ttyBF0

    crw-rw----    1 root     root        1,   9 Jan 13 05:35 urandom

    crw-rw----    1 root     root       10, 130 Jan 13 05:35 watchdog

    crw-rw----    1 root     root        1,   5 Jan 13 05:35 zero

    root:/dev>

    however in:

    root:/sys/devices/platform/i2c-bfin-twi.0> ls -la

    drwxr-xr-x    3 root     root             0 Jan 13 06:04 .

    drwxr-xr-x   17 root     root             0 Jan 13 05:35 ..

    -r--r--r--    1 root     root          4096 Jan 13 06:05 modalias

    drwxr-xr-x    2 root     root             0 Jan 13 06:05 power

    lrwxrwxrwx    1 root     root             0 Jan 13 06:05 subsystem -> ../../../bus/platform

    -rw-r--r--    1 root     root          4096 Jan 13 06:05 uevent

    there is something pointing on i2c. But it doesn't seems to be complete.

    You mentioned "i2c-bfin-twi driver". is that really necessary? I thought if "I2C device interface functionality" in the kernel works it is everything i need to run a twi interface.

    thanks for your help

    Ralph

  • You have two items chosen as "M", please use "Y" instead. for details of i2c dev please read Documentation/i2c/dev-interface in kernel source code.

  • Thanks Sonic,

    after following Aaronwus advice to change M to Y in the kernel settings

    (M = module, I expected to enable all child options ...??)

    plus some recompilation trails I found out

    Device Drivers  --->

          {*} I2C support  --->

         <*>   I2C device interface

         I2C Hardware Bus support  --->

             <*> Blackfin TWI I2C suppor

    I didn't enable Blackfin TWI2C support as you mentioned in your last post. after that it works

    some functions expect a link in the path /dev/i2c-0 similar to gpio interface

    the entry however is under:

    root:/sys/devices/platform/i2c-bfin-twi.0/i2c-0

    anyway for me it's fine

    thanks for your help

    Ralph

  • The Hardware Bus support is for the actual physical I2C controller you want to use in your design, on blackfin platform it should be  either Blackfin TWI I2C support or GPIO-based, depending on your hardware.