2009-01-28 06:22:34     problem with imw,imm commands

Document created by Aaronwu Employee on Sep 18, 2013
Version 1Show Document
  • View in full screen mode

2009-01-28 06:22:34     problem with imw,imm commands

abhrajit datta (INDIA)

Message: 68463   

 

Hi,

 

I had some problems with the imw and imm commands.

 

I used the adt75 temp sensor as i2c slave device and my board is BF527 EZkit,

 

I am using u-boot-1.1.6-2008R1.5.

 

first i use iprobe to check if my device gets probed.This works.

 

bfin> iprobe

 

Valid chip addresses: 48 53

 

0x48 is i2c slave addr for adt75 as expected.

 

Now i read the Thys register and expect the default value 4b00.this also works

 

bfin> imd 0x48 0x02 2

 

0002: 4b 00 K.

 

now i try to change the value to 0000

 

i use

 

bfin> imw 0x48 0x02 0x0000 2

 

when i read back the values i get the same default value 4b00

 

bfin> imd 0x48 0x02 2

 

0002: 4b 00 K.

 

i use the command imm to do the same thing but with no change in results

 

bfin> imm 0x48 0x02

 

00000002: 4b ? 0000

 

00000003: 50 ? x

 

bfin> imd 0x48 0x02 2

 

0002: 4b 00 K.

 

why can't i write to the registers if i can read from them. Is there any configuration i am missing ? Please help

 

Thanks

 

abhri

QuoteReplyEditDelete

 

 

2009-01-28 21:33:38     Re: problem with imw,imm commands

Mike Frysinger (UNITED STATES)

Message: 68495   

 

can you put a scope/signal analyzer to verify the i2c stream is as you expect ?  did you double check that the adt75 actually allows this behavior ?  maybe you need to set some register to enable writing first.

QuoteReplyEditDelete

 

 

2009-01-28 23:45:51     Re: problem with imw,imm commands

abhrajit datta (INDIA)

Message: 68496   

 

Hi Mike,

 

I checked for any write enabling register in adt75 but i could not find any. when i tried the same set of commands with the adxl345 accelerometer i get similiar results. i can read the values but using imw or imm does not write anything to the registers. Can i use the commands when my bf527 board is configured for hard_i2c.My board configuration in include/configs/bf527-ezkit.h is:

/*

* I2C Settings

*/

#define CONFIG_HARD_I2C         1       /* I2C TWI */

#define CFG_I2C_SPEED           50000

#define CFG_I2C_SLAVE           0

 

 

abhri

QuoteReplyEditDelete

 

 

2009-01-29 00:43:54     Re: problem with imw,imm commands

Mike Frysinger (UNITED STATES)

Message: 68497   

 

all of the i2c commands should be supported and work fine

QuoteReplyEditDelete

 

 

2009-01-29 01:59:06     Re: problem with imw,imm commands

abhrajit datta (INDIA)

Message: 68498   

 

Hi Mike,

 

i wrote a small test command to test the i2c read/write functions.

 

------------------------------------------------------------------------------------------------------------------------------------------------------------

 

# include <common.h>

# include <command.h>

# include <i2c.h>

# include <asm/byteorder.h>

 

 

int do_testcmd(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])

{

        uchar buf;

        i2c_reg_write(0x53, 0x2D, 0x08);

        buf = i2c_reg_read(0x53, 0x2D);

        printf("%x\n",buf);

        return 0;

}

 

U_BOOT_CMD(

        testcmd, 1,      1,      do_testcmd,

        "test i2c command\n",

        "\n    -\n"

);

 

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

0x53- address of adxl345 chip

 

0x2D- power_ctl register address

 

0x08 -value to be written.

 

when i run this command i get

 

bfin> iprobe

Valid chip addresses: 48 53

bfin> testcmd

0

 

i am unable to understand why its not able to write to the register .I believe that the commands use the same i2c read/write functions.

 

 

 

abhri

QuoteReplyEditDelete

 

 

2009-01-29 02:04:26     Re: problem with imw,imm commands

Mike Frysinger (UNITED STATES)

Message: 68499   

 

can you probe the signals on the actual wire like i originally asked ?

 

QuoteReplyEditDelete

 

 

2009-01-29 02:09:39     Re: problem with imw,imm commands

abhrajit datta (INDIA)

Message: 68500   

 

ok ill try that

 

abhri

Attachments

    Outcomes