public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* MAX1236 with smbus (CS5536 ACB0)
@ 2008-10-13  1:20 Andreas Seidler
       [not found] ` <48F2A270.8060307-bXdiauyh1GQ7K2kJdssfr+TW4wlIGRCZ@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Andreas Seidler @ 2008-10-13  1:20 UTC (permalink / raw)
  To: i2c-GZX6beZjE8VD60Wz+7aTrA

I want to connect a MAX1236 (ADC) [1] to a I2C/SMBus in a
PC-Engines/ALIX board to monitor some voltages.
This board have a AMD geode CPU with an an I2C companion (scx200_acb.c).

>   Installed I2C busses:
>     i2c-0       smbus           CS5536 ACB0
> root@OpenWrt:/# i2cdetect -F 0
> Functionalities implemented by /dev/i2c-0:
> I2C                              no
> SMBus Quick Command              yes
> SMBus Send Byte                  yes
> SMBus Receive Byte               yes
> SMBus Write Byte                 yes
> SMBus Read Byte                  yes
> SMBus Write Word                 yes
> SMBus Read Word                  yes
> SMBus Process Call               no
> SMBus Block Write                no
> SMBus Block Read                 no
> SMBus Block Process Call         no
> SMBus PEC                        no
> I2C Block Write                  yes
> I2C Block Read                   yes
> root@OpenWrt:/# i2cdetect -y 0
>      0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
> 00:          -- -- -- -- -- -- -- -- -- -- -- -- --
> 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 40: -- -- -- -- -- -- -- -- -- -- -- -- 4c -- -- --
> 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 70: -- -- -- -- -- -- -- --    

but i cant access the MAX1236 on slave address 0x34.
(0x4c is the onbard LM90)

Does "I2C no" means the CS5536 is a plain smbus without i2c support?


Regards
Andreas

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: MAX1236 with smbus (CS5536 ACB0)
       [not found] ` <48F2A270.8060307-bXdiauyh1GQ7K2kJdssfr+TW4wlIGRCZ@public.gmane.org>
@ 2008-10-13  7:25   ` Jean Delvare
       [not found]     ` <20081013092548.3d58a320-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Jean Delvare @ 2008-10-13  7:25 UTC (permalink / raw)
  To: Andreas Seidler; +Cc: i2c-GZX6beZjE8VD60Wz+7aTrA

Hi Andreas,

On Mon, 13 Oct 2008 03:20:48 +0200, Andreas Seidler wrote:
> I want to connect a MAX1236 (ADC) [1] to a I2C/SMBus in a
> PC-Engines/ALIX board to monitor some voltages.
> This board have a AMD geode CPU with an an I2C companion (scx200_acb.c).
> 
> >   Installed I2C busses:
> >     i2c-0       smbus           CS5536 ACB0
> > root@OpenWrt:/# i2cdetect -F 0
> > Functionalities implemented by /dev/i2c-0:
> > I2C                              no
> > SMBus Quick Command              yes
> > SMBus Send Byte                  yes
> > SMBus Receive Byte               yes
> > SMBus Write Byte                 yes
> > SMBus Read Byte                  yes
> > SMBus Write Word                 yes
> > SMBus Read Word                  yes
> > SMBus Process Call               no
> > SMBus Block Write                no
> > SMBus Block Read                 no
> > SMBus Block Process Call         no
> > SMBus PEC                        no
> > I2C Block Write                  yes
> > I2C Block Read                   yes
> > root@OpenWrt:/# i2cdetect -y 0
> >      0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
> > 00:          -- -- -- -- -- -- -- -- -- -- -- -- --
> > 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> > 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> > 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> > 40: -- -- -- -- -- -- -- -- -- -- -- -- 4c -- -- --
> > 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> > 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> > 70: -- -- -- -- -- -- -- --    
> 
> but i cant access the MAX1236 on slave address 0x34.
> (0x4c is the onbard LM90)

Maybe it's not wired properly?

If it is wired properly, then another possibility is that the MAX1236
is doing clock stretching beyond what the CS5536 supports...

> Does "I2C no" means the CS5536 is a plain smbus without i2c support?

Yes and no. It means that the scx200_acb driver runs the CS5536 in
SMBus mode without plain I2C support. But there is also the scx200_i2c
driver (which I would love to see go away in favor of i2c-gpio but
that's another story) which can use the same pins as GPIO to do plain
I2C. If I read the MAX1236 datasheet properly, it uses transactions
which aren't part of the SMBus set, so you may need to use the
scx200_i2c driver, depending on what exactly you need to do with the
MAX1236. There are still a few SMBus transactions which should work
though, and that may be enough.

-- 
Jean Delvare

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: MAX1236 with smbus (CS5536 ACB0)
       [not found]     ` <20081013092548.3d58a320-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
@ 2008-10-13 11:11       ` Jonathan Cameron
       [not found]         ` <48F32CE9.8000109-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
  2008-10-15  1:01       ` Andreas Seidler
  1 sibling, 1 reply; 14+ messages in thread
From: Jonathan Cameron @ 2008-10-13 11:11 UTC (permalink / raw)
  To: Jean Delvare; +Cc: i2c-GZX6beZjE8VD60Wz+7aTrA




>>> root@OpenWrt:/# i2cdetect -y 0
>>>      0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
>>> 00:          -- -- -- -- -- -- -- -- -- -- -- -- --
>>> 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>>> 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>>> 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>>> 40: -- -- -- -- -- -- -- -- -- -- -- -- 4c -- -- --
>>> 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>>> 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>>> 70: -- -- -- -- -- -- -- --    
>> but i cant access the MAX1236 on slave address 0x34.
>> (0x4c is the onbard LM90)
> 
> Maybe it's not wired properly?
> 
> If it is wired properly, then another possibility is that the MAX1236
> is doing clock stretching beyond what the CS5536 supports...
> 
>> Does "I2C no" means the CS5536 is a plain smbus without i2c support?
> 
> Yes and no. It means that the scx200_acb driver runs the CS5536 in
> SMBus mode without plain I2C support. But there is also the scx200_i2c
> driver (which I would love to see go away in favor of i2c-gpio but
> that's another story) which can use the same pins as GPIO to do plain
> I2C. If I read the MAX1236 datasheet properly, it uses transactions
> which aren't part of the SMBus set, so you may need to use the
> scx200_i2c driver, depending on what exactly you need to do with the
> MAX1236. There are still a few SMBus transactions which should work
> though, and that may be enough.
 

Hi,

A driver that should work with this chip is part of the
iio subsystem, so I have a fair bit of familiarity (though
only via 1238 rather than this exact model)

Done a bit of digging around and my original test code was

#include <fcntl.h>

#include "i2c-dev.h"

int main(int argc, char* argv[])
{
  
  struct i2c_smbus_ioctl_data arg;
  union i2c_smbus_data data;
  int adaptor_nr=atoi(argv[1]); //check this
  char filename[20];
  sprintf(filename,"/dev/i2c-%d",adaptor_nr);

  int file;
  if((file = open(filename, O_RDWR))<0)
    {
      printf("could not open /dev/i2c-%u\n", adaptor_nr);
      exit(-1);
    }
  if(ioctl(file,I2C_SLAVE, 0x34) < 0)
    {
      printf("could not set slave address \n");
      return -1;
    }
  
  arg.size = I2C_SMBUS_BYTE;
  arg.read_write = I2C_SMBUS_WRITE;
  arg.command = I2C_SMBUS_BYTE;
  
  data.byte = 8;
  arg.data = &data;
  
  char buf[2] = {0x79, 0x92};
  write(file,  buf,2);
  int i;
  for(i = 0; i < 20; i++)
    {
      read(file,buf,2);
      
      unsigned int a =0;
      a = (buf[0] & 0xF) << 8 | buf[1] ;
      printf("reading %u\n",a);

        sleep(1);
    }

}

No idea why I did it without using the smbus_write commands
though. The iio driver is i2c_transfers I'm afraid.

as for i2c detect, I've just blugeoned it into building for
the pxa271 board I'm using and it picks up a max1239 just fine.

Good luck!

Jonathan


_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: MAX1236 with smbus (CS5536 ACB0)
       [not found]     ` <20081013092548.3d58a320-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
  2008-10-13 11:11       ` Jonathan Cameron
@ 2008-10-15  1:01       ` Andreas Seidler
  2008-10-15  8:17         ` Jean Delvare
  2008-10-28 20:27         ` Michelle Konzack
  1 sibling, 2 replies; 14+ messages in thread
From: Andreas Seidler @ 2008-10-15  1:01 UTC (permalink / raw)
  To: i2c-GZX6beZjE8VD60Wz+7aTrA

Jean Delvare schrieb:
> Hi Andreas,
> 
> On Mon, 13 Oct 2008 03:20:48 +0200, Andreas Seidler wrote:
>> I want to connect a MAX1236 (ADC) [1] to a I2C/SMBus in a
>> PC-Engines/ALIX board to monitor some voltages.
>> This board have a AMD geode CPU with an an I2C companion (scx200_acb.c).
>>
>>[...]
>> but i cant access the MAX1236 on slave address 0x34.
>> (0x4c is the onbard LM90)
> 
> Maybe it's not wired properly?

I can access this ADC wired to a i2c-ibm_iic (build-in IBM PPC_P405)


> If it is wired properly, then another possibility is that the MAX1236
> is doing clock stretching beyond what the CS5536 supports...

and this is my second problem: i cant read the A/D-converted values from
userspace (eg. with i2cget) without spezial code or kernel module?


>> Does "I2C no" means the CS5536 is a plain smbus without i2c support?
> 
> Yes and no. It means that the scx200_acb driver runs the CS5536 in
> SMBus mode without plain I2C support. But there is also the scx200_i2c
> driver (which I would love to see go away in favor of i2c-gpio but
> that's another story) which can use the same pins as GPIO to do plain
> I2C. 

Thank you for this info!
Know i found "the story" in this thread too (http://lkml.org/lkml/2007/4/14/59)
with more infos.

now i tested scx200_i2c:
root@OpenWrt:/# insmod scx200_gpio
scx200_gpio: no SCx200 gpio present
root@OpenWrt:/# insmod scx200_i2c
scx200_i2c: no SCx200 gpio pins available

(i hope thats no problem of the openwrt-distro...)


are SCx200 GPIO pins supported by i2c_gpio?
(http://lkml.org/lkml/2007/4/19/22)

should it work with my Geode/LX800 companion?


> If I read the MAX1236 datasheet properly, it uses transactions
> which aren't part of the SMBus set, so you may need to use the
> scx200_i2c driver, depending on what exactly you need to do with the
> MAX1236.

I only want to monitor some voltages in my wind-/solarpower system and draw some
nice charts - nothing spezial.



Regards
Andreas


_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: MAX1236 with smbus (CS5536 ACB0)
       [not found]         ` <48F32CE9.8000109-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
@ 2008-10-15  1:13           ` Andreas Seidler
  2008-10-15 11:10             ` Jonathan Cameron
  0 siblings, 1 reply; 14+ messages in thread
From: Andreas Seidler @ 2008-10-15  1:13 UTC (permalink / raw)
  To: i2c-GZX6beZjE8VD60Wz+7aTrA

Jonathan Cameron schrieb:
> A driver that should work with this chip is part of the
> iio subsystem, so I have a fair bit of familiarity (though
> only via 1238 rather than this exact model)

I found this subsystem too and its promising, but it depends on RTC with
periodic Interupts - and most of embedded hardware lacks of such RTCs.

is it possible to attach a ds1307 for this reason?


> Done a bit of digging around and my original test code was
> 
> #include <fcntl.h>
> 
> #include "i2c-dev.h"
> 
> int main(int argc, char* argv[])
> {
>   
>   struct i2c_smbus_ioctl_data arg;
>   union i2c_smbus_data data;
>   int adaptor_nr=atoi(argv[1]); //check this
>   char filename[20];
>   sprintf(filename,"/dev/i2c-%d",adaptor_nr);
> 
>   int file;
>   if((file = open(filename, O_RDWR))<0)
>     {
>       printf("could not open /dev/i2c-%u\n", adaptor_nr);
>       exit(-1);
>     }
>   if(ioctl(file,I2C_SLAVE, 0x34) < 0)
>     {
>       printf("could not set slave address \n");
>       return -1;
>     }
>   
>   arg.size = I2C_SMBUS_BYTE;
>   arg.read_write = I2C_SMBUS_WRITE;
>   arg.command = I2C_SMBUS_BYTE;
>   
>   data.byte = 8;
>   arg.data = &data;
>   
>   char buf[2] = {0x79, 0x92};
>   write(file,  buf,2);
>   int i;
>   for(i = 0; i < 20; i++)
>     {
>       read(file,buf,2);
>       
>       unsigned int a =0;
>       a = (buf[0] & 0xF) << 8 | buf[1] ;
>       printf("reading %u\n",a);
> 
>         sleep(1);
>     }
> 
> }
> 
> No idea why I did it without using the smbus_write commands
> though. The iio driver is i2c_transfers I'm afraid.
> 
> as for i2c detect, I've just blugeoned it into building for
> the pxa271 board I'm using and it picks up a max1239 just fine.

can i access the ringbuffer of this driver via sysfs or how userspace side
should work?


Regards
Andreas


_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: MAX1236 with smbus (CS5536 ACB0)
  2008-10-15  1:01       ` Andreas Seidler
@ 2008-10-15  8:17         ` Jean Delvare
       [not found]           ` <20081015101736.34e1c11e-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
  2008-10-28 20:27         ` Michelle Konzack
  1 sibling, 1 reply; 14+ messages in thread
From: Jean Delvare @ 2008-10-15  8:17 UTC (permalink / raw)
  To: Andreas Seidler; +Cc: Jordan Crouse, i2c-GZX6beZjE8VD60Wz+7aTrA

Hi Andreas,

On Wed, 15 Oct 2008 03:01:56 +0200, Andreas Seidler wrote:
> Jean Delvare schrieb:
> > Hi Andreas,
> > 
> > On Mon, 13 Oct 2008 03:20:48 +0200, Andreas Seidler wrote:
> >> I want to connect a MAX1236 (ADC) [1] to a I2C/SMBus in a
> >> PC-Engines/ALIX board to monitor some voltages.
> >> This board have a AMD geode CPU with an an I2C companion (scx200_acb.c).
> >>
> >>[...]
> >> but i cant access the MAX1236 on slave address 0x34.
> >> (0x4c is the onbard LM90)
> > 
> > Maybe it's not wired properly?
> 
> I can access this ADC wired to a i2c-ibm_iic (build-in IBM PPC_P405)

That's not the question. Maybe the chip was wired properly on that
system and not on the CS5563 system.

You can also try i2cdetect -r and see if it makes a difference.

> > If it is wired properly, then another possibility is that the MAX1236
> > is doing clock stretching beyond what the CS5536 supports...
> 
> and this is my second problem: i cant read the A/D-converted values from
> userspace (eg. with i2cget) without spezial code or kernel module?

I'm not sure if i2cget can work with this device. The transactions used
by the MAX1236 are raw reads and writes which aren't too
SMBus-friendly, but it you don't care too much about performance,
i2cget may still work depending on how you read the datasheet. I
suggest that you give it a try on the IBM PPC system where you know the
chip is properly wired.

i2cget 0 0x34 0x81 w

should give you the raw value of the 1st ADC channel. You'll have to
byte-swap it because SMBus specifies that words go on the wire LSB
first.

i2cget 0 0x34 0x83 w

should give the value of the 2nd ADC channel, and so on. Check the
datasheet for details on the configuration byte format.

> >> Does "I2C no" means the CS5536 is a plain smbus without i2c support?
> > 
> > Yes and no. It means that the scx200_acb driver runs the CS5536 in
> > SMBus mode without plain I2C support. But there is also the scx200_i2c
> > driver (which I would love to see go away in favor of i2c-gpio but
> > that's another story) which can use the same pins as GPIO to do plain
> > I2C. 
> 
> Thank you for this info!
> Know i found "the story" in this thread too (http://lkml.org/lkml/2007/4/14/59)
> with more infos.
> 
> now i tested scx200_i2c:
> root@OpenWrt:/# insmod scx200_gpio
> scx200_gpio: no SCx200 gpio present
> root@OpenWrt:/# insmod scx200_i2c
> scx200_i2c: no SCx200 gpio pins available
> 
> (i hope thats no problem of the openwrt-distro...)

Hmm, I think I incorrectly assumed that scx200_i2c supported the same
devices as scx200_acb, but probably the former only supports the SCx200
CPUs and not the CS553x companion chips, sorry.

> are SCx200 GPIO pins supported by i2c_gpio?
> (http://lkml.org/lkml/2007/4/19/22)
>
> should it work with my Geode/LX800 companion?

Last time I checked the answer was no, I don't know if things have
changed since then.

> > If I read the MAX1236 datasheet properly, it uses transactions
> > which aren't part of the SMBus set, so you may need to use the
> > scx200_i2c driver, depending on what exactly you need to do with the
> > MAX1236.
> 
> I only want to monitor some voltages in my wind-/solarpower system and draw some
> nice charts - nothing spezial.

"Special" doesn't mean anything, as it depends on what you consider to
be the normal thing in the first place.

-- 
Jean Delvare

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: MAX1236 with smbus (CS5536 ACB0)
  2008-10-15  1:13           ` Andreas Seidler
@ 2008-10-15 11:10             ` Jonathan Cameron
       [not found]               ` <48F5CF88.2030500-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Jonathan Cameron @ 2008-10-15 11:10 UTC (permalink / raw)
  To: Andreas Seidler; +Cc: i2c-GZX6beZjE8VD60Wz+7aTrA

Andreas Seidler wrote:
> Jonathan Cameron schrieb:
>> A driver that should work with this chip is part of the
>> iio subsystem, so I have a fair bit of familiarity (though
>> only via 1238 rather than this exact model)
> 
> I found this subsystem too and its promising, but it depends on RTC with
> periodic Interupts - and most of embedded hardware lacks of such RTCs.
In current code periodic interrupts are only required if you want to use
a polled ring buffer.  This is now a Kconfig option and if you turn it off
you'll still have sysfs type interfaces for reading directly from the
device.  A direct chrdev access to 'scan' the device is on the todo list,
but isn't there yet.

Hopefully (after fighting with git this afternoon) I should shortly have
a repository up so its easier for people to get the current code and to
send patches against it.

Jonathan
> 
> is it possible to attach a ds1307 for this reason?
You could, but I'd imagine this is unnecessary. 
The reason for using periodic interrupts from an rtc as an initial means
of performing periodic sampling was that I had one to hand (pxa27x)
and was being lazy.  There are lots of other ways of achieving a similar
result not requiring specialist hardware and at least one other option
will need to be available before the code is ready to go into mainline.

Jonathan
 
> 
>> Done a bit of digging around and my original test code was
>>
>> #include <fcntl.h>
>>
>> #include "i2c-dev.h"
>>
>> int main(int argc, char* argv[])
>> {
>>   
>>   struct i2c_smbus_ioctl_data arg;
>>   union i2c_smbus_data data;
>>   int adaptor_nr=atoi(argv[1]); //check this
>>   char filename[20];
>>   sprintf(filename,"/dev/i2c-%d",adaptor_nr);
>>
>>   int file;
>>   if((file = open(filename, O_RDWR))<0)
>>     {
>>       printf("could not open /dev/i2c-%u\n", adaptor_nr);
>>       exit(-1);
>>     }
>>   if(ioctl(file,I2C_SLAVE, 0x34) < 0)
>>     {
>>       printf("could not set slave address \n");
>>       return -1;
>>     }
>>   
>>   arg.size = I2C_SMBUS_BYTE;
>>   arg.read_write = I2C_SMBUS_WRITE;
>>   arg.command = I2C_SMBUS_BYTE;
>>   
>>   data.byte = 8;
>>   arg.data = &data;
>>   
>>   char buf[2] = {0x79, 0x92};
>>   write(file,  buf,2);
>>   int i;
>>   for(i = 0; i < 20; i++)
>>     {
>>       read(file,buf,2);
>>       
>>       unsigned int a =0;
>>       a = (buf[0] & 0xF) << 8 | buf[1] ;
>>       printf("reading %u\n",a);
>>
>>         sleep(1);
>>     }
>>
>> }
>>
>> No idea why I did it without using the smbus_write commands
>> though. The iio driver is i2c_transfers I'm afraid.
>>
>> as for i2c detect, I've just blugeoned it into building for
>> the pxa271 board I'm using and it picks up a max1239 just fine.
> 
> can i access the ringbuffer of this driver via sysfs or how userspace side
> should work?
> 
> 
> Regards
> Andreas
> 
> 
> _______________________________________________
> i2c mailing list
> i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
> http://lists.lm-sensors.org/mailman/listinfo/i2c
> 


_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: MAX1236 with smbus (CS5536 ACB0)
       [not found]               ` <48F5CF88.2030500-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
@ 2008-10-15 13:06                 ` Andreas Seidler
  2008-10-15 15:14                   ` Jonathan Cameron
  0 siblings, 1 reply; 14+ messages in thread
From: Andreas Seidler @ 2008-10-15 13:06 UTC (permalink / raw)
  To: i2c-GZX6beZjE8VD60Wz+7aTrA

Jonathan Cameron schrieb:
> Andreas Seidler wrote:
>> Jonathan Cameron schrieb:
>>> A driver that should work with this chip is part of the
>>> iio subsystem, so I have a fair bit of familiarity (though
>>> only via 1238 rather than this exact model)
>> I found this subsystem too and its promising, but it depends on RTC with
>> periodic Interupts - and most of embedded hardware lacks of such RTCs.
> In current code periodic interrupts are only required if you want to use
> a polled ring buffer.  This is now a Kconfig option and if you turn it off
> you'll still have sysfs type interfaces for reading directly from the
> device.

if i disable "timer support within iio" and RTC-support in kernel i get
ERROR: "rtc_irq_set_state" [drivers/industrialio/industrialio.ko] undefined!
ERROR: "rtc_class_open" [drivers/industrialio/industrialio.ko] undefined!
ERROR: "rtc_irq_unregister" [drivers/industrialio/industrialio.ko] undefined!
ERROR: "rtc_irq_register" [drivers/industrialio/industrialio.ko] undefined!
ERROR: "rtc_irq_set_freq" [drivers/industrialio/industrialio.ko] undefined!
ERROR: "rtc_class_close" [drivers/industrialio/industrialio.ko] undefined!

my .config:
CONFIG_INDUSTRIALIO=m
CONFIG_INDUSTRIALIO_PTIMER_BOARDINFO=y
CONFIG_IIO_RING_BUFFER=y
# CONFIG_IIO_TIMERS is not set
CONFIG_IIO_SW_RING=m
#
# Accelerometers
#
CONFIG_LIS3L02DQ=m
#
# Analog to digital convertors
#
CONFIG_MAX1363=m
#
# Inertial Measurement Units
#
# CONFIG_ADIS16350 is not set

or do i get something wrong?


> A direct chrdev access to 'scan' the device is on the todo list,
> but isn't there yet.
> 
> Hopefully (after fighting with git this afternoon) I should shortly have
> a repository up so its easier for people to get the current code and to
> send patches against it.

sounds good!


Regards
Andreas


_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: MAX1236 with smbus (CS5536 ACB0)
  2008-10-15 13:06                 ` Andreas Seidler
@ 2008-10-15 15:14                   ` Jonathan Cameron
       [not found]                     ` <48F608E7.9040309-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Jonathan Cameron @ 2008-10-15 15:14 UTC (permalink / raw)
  To: Andreas Seidler; +Cc: i2c-GZX6beZjE8VD60Wz+7aTrA

Andreas Seidler wrote:

> 
> if i disable "timer support within iio" and RTC-support in kernel i get
> ERROR: "rtc_irq_set_state" [drivers/industrialio/industrialio.ko] undefined!
> ERROR: "rtc_class_open" [drivers/industrialio/industrialio.ko] undefined!
> ERROR: "rtc_irq_unregister" [drivers/industrialio/industrialio.ko] undefined!
> ERROR: "rtc_irq_register" [drivers/industrialio/industrialio.ko] undefined!
> ERROR: "rtc_irq_set_freq" [drivers/industrialio/industrialio.ko] undefined!
> ERROR: "rtc_class_close" [drivers/industrialio/industrialio.ko] undefined!
> 

As I'm a bit pushed for time today, there is a temporary git repos at

git://www.srcf.ucam.org/jic23-git

with an iio-devel branch that is the current state of the industrialio subsystem
(complete with bug fix for the compile bug you found!)

As the subsystem is still in somewhat of a state of flux the git history is a bit
bare (only one commit and that includes all the drivers etc)

Feel free to have a play. I've compile tested this set no x86 but not arm
as yet, so weird stuff may occur ;)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: MAX1236 with smbus (CS5536 ACB0)
       [not found]                     ` <48F608E7.9040309-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
@ 2008-10-15 17:23                       ` Andreas Seidler
  0 siblings, 0 replies; 14+ messages in thread
From: Andreas Seidler @ 2008-10-15 17:23 UTC (permalink / raw)
  To: i2c-GZX6beZjE8VD60Wz+7aTrA

Jonathan Cameron schrieb:
> Andreas Seidler wrote:
> 
>> if i disable "timer support within iio" and RTC-support in kernel i get
>> ERROR: "rtc_irq_set_state" [drivers/industrialio/industrialio.ko] undefined!
>> ERROR: "rtc_class_open" [drivers/industrialio/industrialio.ko] undefined!
>> ERROR: "rtc_irq_unregister" [drivers/industrialio/industrialio.ko] undefined!
>> ERROR: "rtc_irq_register" [drivers/industrialio/industrialio.ko] undefined!
>> ERROR: "rtc_irq_set_freq" [drivers/industrialio/industrialio.ko] undefined!
>> ERROR: "rtc_class_close" [drivers/industrialio/industrialio.ko] undefined!
>>
> 
> As I'm a bit pushed for time today, there is a temporary git repos at
> 
> git://www.srcf.ucam.org/jic23-git
> 
> with an iio-devel branch that is the current state of the industrialio subsystem
> (complete with bug fix for the compile bug you found!)

thank you - i cloned your repo but i dont find the expected
./drivers/industrialio subdir in your kernel tree...?


> As the subsystem is still in somewhat of a state of flux the git history is a bit
> bare (only one commit and that includes all the drivers etc)
> 
> Feel free to have a play. I've compile tested this set no x86 but not arm
> as yet, so weird stuff may occur ;)


Regards
Andreas



_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: MAX1236 with smbus (CS5536 ACB0)
       [not found]           ` <20081015101736.34e1c11e-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
@ 2008-10-16 18:12             ` Andreas Seidler
  2008-10-16 18:29               ` Marco Costa
  2008-10-16 21:25             ` Jordan Crouse
  1 sibling, 1 reply; 14+ messages in thread
From: Andreas Seidler @ 2008-10-16 18:12 UTC (permalink / raw)
  To: i2c-GZX6beZjE8VD60Wz+7aTrA

Jean Delvare schrieb:
> On Wed, 15 Oct 2008 03:01:56 +0200, Andreas Seidler wrote:
>> I can access this ADC wired to a i2c-ibm_iic (build-in IBM PPC_P405)
> 
> That's not the question. Maybe the chip was wired properly on that
> system and not on the CS5563 system.
> 
> You can also try i2cdetect -r and see if it makes a difference.

I'm afraid not.


>>> If it is wired properly, then another possibility is that the MAX1236
>>> is doing clock stretching beyond what the CS5536 supports...
>> and this is my second problem: i cant read the A/D-converted values from
>> userspace (eg. with i2cget) without spezial code or kernel module?
> 
> I'm not sure if i2cget can work with this device. The transactions used
> by the MAX1236 are raw reads and writes which aren't too
> SMBus-friendly, but it you don't care too much about performance,
> i2cget may still work depending on how you read the datasheet. I
> suggest that you give it a try on the IBM PPC system where you know the
> chip is properly wired.
> 
> i2cget 0 0x34 0x81 w
> 
> should give you the raw value of the 1st ADC channel. You'll have to
> byte-swap it because SMBus specifies that words go on the wire LSB
> first.

good to know about the byte-swap with smbus!


btw:I played around with this ADC on my i2c-ibm_iic:

root@OpenWrt:/# i2cget -y 0 0x34 0x21 w

i get this values of channel 0:

OV:	0x00f0 (11110000)
1,6V:	0xaef5 (1010111011110101)
3,2V:	0x5efb (101110111111011)

but how to get the converted 12 bit value?



Regards
Andreas


_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: MAX1236 with smbus (CS5536 ACB0)
  2008-10-16 18:12             ` Andreas Seidler
@ 2008-10-16 18:29               ` Marco Costa
  0 siblings, 0 replies; 14+ messages in thread
From: Marco Costa @ 2008-10-16 18:29 UTC (permalink / raw)
  To: i2c-GZX6beZjE8VD60Wz+7aTrA

Hi,

Sorry to intrude, but it seems that it is byte swapped.

> i get this values of channel 0:
>
> OV:	0x00f0 (11110000)
Correct: 0xF000 & ~0xF000 = 0x0000
> 1,6V:	0xaef5 (1010111011110101)
Correct: 0xf5ae & ~0xF000 = 0x05ae
> 3,2V:	0x5efb (101110111111011)
Correct: 0xfb5e & ~0xF000 = 0x0b5e

the second value is almost 2x the first, as I would expect

Regards,

Marco Costa

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: MAX1236 with smbus (CS5536 ACB0)
       [not found]           ` <20081015101736.34e1c11e-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
  2008-10-16 18:12             ` Andreas Seidler
@ 2008-10-16 21:25             ` Jordan Crouse
  1 sibling, 0 replies; 14+ messages in thread
From: Jordan Crouse @ 2008-10-16 21:25 UTC (permalink / raw)
  To: Jean Delvare; +Cc: i2c-GZX6beZjE8VD60Wz+7aTrA

On 15/10/08 10:17 +0200, Jean Delvare wrote:
> Hi Andreas,
> 
> On Wed, 15 Oct 2008 03:01:56 +0200, Andreas Seidler wrote:
> > Jean Delvare schrieb:
> > > Hi Andreas,
> > > 
> > > On Mon, 13 Oct 2008 03:20:48 +0200, Andreas Seidler wrote:
> > >> I want to connect a MAX1236 (ADC) [1] to a I2C/SMBus in a
> > >> PC-Engines/ALIX board to monitor some voltages.
> > >> This board have a AMD geode CPU with an an I2C companion (scx200_acb.c).
> > >>
> > >>[...]
> > >> but i cant access the MAX1236 on slave address 0x34.
> > >> (0x4c is the onbard LM90)
> > > 
> > > Maybe it's not wired properly?
> > 
> > I can access this ADC wired to a i2c-ibm_iic (build-in IBM PPC_P405)
> 
> That's not the question. Maybe the chip was wired properly on that
> system and not on the CS5563 system.
> 
> You can also try i2cdetect -r and see if it makes a difference.
> 
> > > If it is wired properly, then another possibility is that the MAX1236
> > > is doing clock stretching beyond what the CS5536 supports...

Its possible, but that would be a first - I haven't yet seen a 
well behaving chip that the 5536 can't understand.

> > and this is my second problem: i cant read the A/D-converted values from
> > userspace (eg. with i2cget) without spezial code or kernel module?
> 
> I'm not sure if i2cget can work with this device. The transactions used
> by the MAX1236 are raw reads and writes which aren't too
> SMBus-friendly, but it you don't care too much about performance,
> i2cget may still work depending on how you read the datasheet. I
> suggest that you give it a try on the IBM PPC system where you know the
> chip is properly wired.
> 
> i2cget 0 0x34 0x81 w
> 
> should give you the raw value of the 1st ADC channel. You'll have to
> byte-swap it because SMBus specifies that words go on the wire LSB
> first.
> 
> i2cget 0 0x34 0x83 w
> 
> should give the value of the 2nd ADC channel, and so on. Check the
> datasheet for details on the configuration byte format.
> 
> > >> Does "I2C no" means the CS5536 is a plain smbus without i2c support?
> > > 
> > > Yes and no. It means that the scx200_acb driver runs the CS5536 in
> > > SMBus mode without plain I2C support. But there is also the scx200_i2c
> > > driver (which I would love to see go away in favor of i2c-gpio but
> > > that's another story) which can use the same pins as GPIO to do plain
> > > I2C. 

> > Thank you for this info!
> > Know i found "the story" in this thread too (http://lkml.org/lkml/2007/4/14/59)
> > with more infos.
> > 
> > now i tested scx200_i2c:
> > root@OpenWrt:/# insmod scx200_gpio
> > scx200_gpio: no SCx200 gpio present
> > root@OpenWrt:/# insmod scx200_i2c
> > scx200_i2c: no SCx200 gpio pins available
> > 
> > (i hope thats no problem of the openwrt-distro...)
> 
> Hmm, I think I incorrectly assumed that scx200_i2c supported the same
> devices as scx200_acb, but probably the former only supports the SCx200
> CPUs and not the CS553x companion chips, sorry.

I think thats right.

> > are SCx200 GPIO pins supported by i2c_gpio?
> > (http://lkml.org/lkml/2007/4/19/22)
> >
> > should it work with my Geode/LX800 companion?
> 
> Last time I checked the answer was no, I don't know if things have
> changed since then.

No - I don't think this will work.  Not because it can't, but because
nobody has made the code changes.  Access to the GPIO pins is trivial,
so typically one would be able to make this go pretty quickly.

Jordan

-- 
Jordan Crouse
Systems Software Development Engineer 
Advanced Micro Devices, Inc.


_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: MAX1236 with smbus (CS5536 ACB0)
  2008-10-15  1:01       ` Andreas Seidler
  2008-10-15  8:17         ` Jean Delvare
@ 2008-10-28 20:27         ` Michelle Konzack
  1 sibling, 0 replies; 14+ messages in thread
From: Michelle Konzack @ 2008-10-28 20:27 UTC (permalink / raw)
  To: i2c-GZX6beZjE8VD60Wz+7aTrA


[-- Attachment #1.1: Type: text/plain, Size: 1365 bytes --]

Hallo Andreas und Hello *,

Am 2008-10-15 03:01:56, schrieb Andreas Seidler:
> I only want to monitor some voltages in my wind-/solarpower system and draw some
> nice charts - nothing spezial.

Why not use a much more cheaper

    Dallas 1-Wire chip DS2450
        Quad A/D Converter
        with user programmable input range (2.56V/5.12V)
        resolution  (1 to 16 bits) and alarm

I use it on my Solar-Power-Plant in Morocco with 1300 modules of  130 Wp
too...

And of course you can use the Kernel Bitbanging-Interface if your Micro-
controller does not have a 1-Wire port.

Note: I was ongoing to use only I²C but now I am using  a  mix  between
      SPI, I²C and 1-Wire since I have realized that it is definitively
      impossibel to get the needed µChips form one system  and  in  the
      same time cheap...

Thanks, Greetings and nice Day/Evening
    Michelle Konzack
    Systemadministrator
    24V Electronic Engineer
    Tamay Dogan Network
    Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack   Apt. 917                  ICQ #328449886
+49/177/9351947    50, rue de Soultz         MSN LinuxMichi
+33/6/61925193     67100 Strasbourg/France   IRC #Debian (irc.icq.com)

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2008-10-28 20:27 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-13  1:20 MAX1236 with smbus (CS5536 ACB0) Andreas Seidler
     [not found] ` <48F2A270.8060307-bXdiauyh1GQ7K2kJdssfr+TW4wlIGRCZ@public.gmane.org>
2008-10-13  7:25   ` Jean Delvare
     [not found]     ` <20081013092548.3d58a320-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-10-13 11:11       ` Jonathan Cameron
     [not found]         ` <48F32CE9.8000109-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
2008-10-15  1:13           ` Andreas Seidler
2008-10-15 11:10             ` Jonathan Cameron
     [not found]               ` <48F5CF88.2030500-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
2008-10-15 13:06                 ` Andreas Seidler
2008-10-15 15:14                   ` Jonathan Cameron
     [not found]                     ` <48F608E7.9040309-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
2008-10-15 17:23                       ` Andreas Seidler
2008-10-15  1:01       ` Andreas Seidler
2008-10-15  8:17         ` Jean Delvare
     [not found]           ` <20081015101736.34e1c11e-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-10-16 18:12             ` Andreas Seidler
2008-10-16 18:29               ` Marco Costa
2008-10-16 21:25             ` Jordan Crouse
2008-10-28 20:27         ` Michelle Konzack

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox