[U-Boot-Users] Re: probably bug in ds1621.c

Erik Theisen etheisen at mindspring.com
Thu Jul 17 04:18:20 CEST 2003


On Monday, Jul 14, 2003, at 06:59 US/Eastern, Wolfgang Denk wrote:

> Hello,
>
> in message <3812591505.20030702114201 at morion.ru> you wrote:
>>
>> In dtt/ds1621.c file:
>>
>> 1.
>> int dtt_write(int sensor, int reg, int val)
>> {
>>     int dlen;
>>     uchar data[2];
>>
>>     /*
>>      * Calculate sensor address and register.
>>      *
>>      */
>>     sensor = DTT_I2C_DEV_CODE + (sensor & sensor);
>>
>> I think it should be:
>>
>> int dtt_write(int sensor, int reg, int val)
>> {
>>     int dlen;
>>     uchar data[2];
>>
>>     /*
>>      * Calculate sensor address and register.
>>      *
>>      */
>>     sensor = DTT_I2C_DEV_CODE + (sensor & 0x07);
>
>
> I think you are right. Added.
>
>
>> 2.
>>     else if ((reg == DTT_WRITE_START_CONV) || (reg == 
>> DTT_WRITE_STOP_CONV)) {
>>         dlen = 0;
>>         data[0] = (char)0;
>>         data[1] = (char)0;
>>     }
>>
>> I think it should be:
>>
>>     else if ((reg == DTT_WRITE_START_CONV) || (reg == 
>> DTT_WRITE_STOP_CONV)) {
>>         dlen = 1;
>>         data[0] = (char)0;
>>         data[1] = (char)0;
>>     }
>>
>> differently MPC8260 I2C controller go in down
>
> I'm not sure about this one. Erik, maybe you can comment?  It's  your
> code after all...
>
> Best regards,
>
> Wolfgang Denk
>
> -- 
> Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
> Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
> The day-to-day travails of the IBM programmer are so amusing to  most
> of us who are fortunate enough never to have been one - like watching
> Charlie Chaplin trying to cook a shoe.
>

Sorry folks,

I've been quite busy lately with several new hardware designs.

Now to the issues:

#1 - Yes it is a bug

#2 - I believe the dlen of 0 is correct as it stands. The DS1621 has a 
special start
and stop conversion "command".  This has a  data length of 0.

If someone is trying these routines on non 405 hardware, the code may 
require
some adjustment due to minor differences in the low level I2C routines.

Erik






More information about the U-Boot mailing list