[U-Boot] I2c imd/imw for a digital potentiometer?
Brian Hutchinson
b.hutchman at gmail.com
Wed Sep 2 02:14:49 CEST 2009
On Tue, Sep 1, 2009 at 2:22 PM, Jerry Van Baren <gerald.vanbaren at ge.com>wrote:
> Brian Hutchinson wrote:
>
>> Hi all,
>>
>> I'm a little stumped as to how to write to a EEPot with the imw command.
>>
>> The EEPot is a Maxim 5434 and has an address of 0x28. To write to its
>> volatile or non-volatile register ... a command byte is given.
>>
>> Writing 5 bits of data (it is a 32 tap pot so that is where the 5 bits
>> come
>> from) to move the wiper goes something like this:
>>
>> Start, 0x28, Ack, Cmd byte, Ack, Data byte, Ack, Stop
>>
>> Cmd byte is 0x11 to write to volatile reg. 0x21 to write to non-volatile
>> reg.
>>
>
> Looks pretty standard if you map "cmd byte" to "register".
>
> The EEPROM really doesn't have addresses/offsets so I tried:
>>
>> imw 28 11 80 1
>>
>
The one is a count.
>
> What is the trailing '1' here? Or is the '80' bogus?
>
> I would expect this to work. The i2c command defaults to a one byte
> register offset. To write a 0x80 byte to register (aka command) 0x11, you
> want to do this:
> imw 28 11.1 80
> which should be the same as this:
> imw 28 11 80
>
> imw.w 28 0.0 1180
>>
>
> That seems like it should work also, although the '11' is more logically a
> register offset.
>
> ... but it doesn't appear to play well with my device.
>>
>
> Trivia: the old imw (imr, etc) commands are deprecated, you should use the
> new "i2c <cmd>" versions.
>
> [snip]
>
> Regards,
>>
>> Brian
>>
>
> Good luck,
> gvb
>
Well I figured my problem. I was trying various ways of writing to the
eepot and trying to read back what I wrote in its non-volatile or volatile
registers. I found out you can't read back from it! I went over the data
sheet several times and nothing really said you could or you couldn't ... I
just noticed they focused on writing to the eeprom inside and on
power-cycle, the chip would read non-volatile storage and move the stored
value to the volatile register and effect the wiper 20us after power up.
Once I realized this, I started writing values and probing the L pin with a
multimeter and once I found the right pin (helps to know the right pin :) )
I discovered that:
imw 28 11 80 1 would write to the volatile storage and make the wiper move
so it is working! (there was much rejoycing)
I was using u-boot 1.1.6 which I forgot to mention. I also have 1.3.4 that
I recently moved to. For some reason my bitbanged Soft_I2C I had working
with 1.1.6 wouldn't work in 1.3.4. I also didn't notice any new i2c commands
and just kept using the imd, imm, imw commands. Thanks for the tip on the
new commands ... I'll have to look into it.
Regards,
Brian
More information about the U-Boot
mailing list