Search

Technical Discussion Group Forum

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

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

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

PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 15 Apr 2013 11:11 AM by  jemiah.a@logicpd.com
Article: DM37 Linux - Newer I2Ctools
 0 Replies
Sort:
You are not authorized to post a reply.
Author Messages

jemiah.a@logicpd.com



New Member


Posts:10
New Member


--
15 Apr 2013 11:11 AM
    The version of I2CTools included with the current DM37 Linux BSP is old and doesn't support block transfers which could be a problem for I2C devices needing multi-byte reads/writes.

    The procedure for getting a newer version of the tools is pretty simple. You can down load the source here:
    http://www.lm-sensors.org/wiki/I2CTools

    To ensure the correct build environment use the ltib shell:

    logic@logic-desktop:~/logic/Logic_BSPs/Linux_3.0/REL-ltib-DM3730-2.3-2$ ./ltib -m shell
    Entering ltib shell mode, type 'exit' to quit
    LTIB>


    Once you're in the shell, switch to where you downloaded and extracted the source.

    LTIB> cd /home/logic/logic/Logic_BSPs/Linux_3.0/REL-ltib-DM3730-2.3-2/rpm/BUILD/temp/i2c-tools-3.1.0
    LTIB> ls
    CHANGES COPYING Makefile README eeprom eepromer include py-smbus stub tools version.h
    LTIB>


    The makefile for I2CTools is very simple. If your build environment is setup properly you only need to call make:

    LTIB> make
    gcc -O2 -Wall -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wnested-externs -Winline -W -Wundef -Wmissing-prototypes -Iinclude -c tools/i2cdetect.c -o tools/i2cdetect.o
    gcc -O2 -Wall -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wnested-externs -Winline -W -Wundef -Wmissing-prototypes -Iinclude -c tools/i2cbusses.c -o tools/i2cbusses.o
    gcc -O2 -Wall -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wnested-externs -Winline -W -Wundef -Wmissing-prototypes -Iinclude -c tools/i2cdump.c -o tools/i2cdump.o
    gcc -O2 -Wall -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wnested-externs -Winline -W -Wundef -Wmissing-prototypes -Iinclude -c tools/util.c -o tools/util.o
    gcc -O2 -Wall -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wnested-externs -Winline -W -Wundef -Wmissing-prototypes -Iinclude -c tools/i2cset.c -o tools/i2cset.o
    gcc -O2 -Wall -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wnested-externs -Winline -W -Wundef -Wmissing-prototypes -Iinclude -c tools/i2cget.c -o tools/i2cget.o
    gcc -o tools/i2cdetect tools/i2cdetect.o tools/i2cbusses.o
    gcc -o tools/i2cset tools/i2cset.o tools/i2cbusses.o tools/util.o
    gcc -o tools/i2cget tools/i2cget.o tools/i2cbusses.o tools/util.o
    gcc -o tools/i2cdump tools/i2cdump.o tools/i2cbusses.o tools/util.o
    LTIB>


    You'll find the resulting binaries (i2cdetect, i2cdump, i2cget, i2cset) in the ...i2c-tools-3.1.0/tools directory. Add them to your rootfs when you rebuild LTIB or simply copy them to your system with an SD card. You can overwrite the built in versions which are in /usr/sbin/. If you use an SD card to transfer the files don't for get to use 'chmod +x' on each one to set the executable flag.

    Do a quick check to ensure that you've updated everything properly and you'll see the new options listed:

    DM-37x# i2cset
    Usage: i2cset [-f] [-y] [-m MASK] I2CBUS CHIP-ADDRESS DATA-ADDRESS [VALUE] ... [MODE]
    I2CBUS is an integer or an I2C bus name
    ADDRESS is an integer (0x03 - 0x77)
    MODE is one of:
    c (byte, no value)
    b (byte data, default)
    w (word data)
    i (I2C block data)
    s (SMBus block data)
    Append p for SMBus PEC
    DM-37x
    You are not authorized to post a reply.