Skip to contentSkip to conversation

MAX1236 with smbus (CS5536 ACB0)

DISCUSSION Andreas Seidler 6 participants 14 messages Oct 13, 2008 – Oct 28, 2008 6 messages not in the archive I2C subsystem host drivers

lore
Share & tools
lore
#0 lore raw

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).

Quoted 21 lines

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
Quoted 8 lines
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
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

A message that is not in the archive (sent off-list or not yet received): 48F2A270.8060307-bXdiauyh1GQ7K2kJdssfr+TW4wlIGRCZ@public.gmane.org

#2 lore raw

Hi Andreas,

Quoted 34 lines · Andreas Seidler

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).

Quoted 21 lines

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
Quoted 8 lines
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- 4c -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --    
Quoted 2 lines

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...

Quoted 1 line

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.

Signature · 6 lines
Jean Delvare

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 23 lines
Quoted 13 lines
Quoted 13 lines


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: -- -- -- -- -- -- -- --    
Quoted 2 lines

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...

Quoted 1 line

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

Quoted 9 lines

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
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

A message that is not in the archive (sent off-list or not yet received): 48F32CE9.8000109-KWPb1pKIrIJaa/[email protected]

#6 lore raw
Quoted 3 lines · Jonathan Cameron

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?

Quoted 48 lines

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);
    }
Quoted 7 lines

}

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
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

#7 lore raw
Quoted 7 lines · Andreas Seidler
Quoted 3 lines · Jonathan Cameron

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

Quoted 2 lines

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

Quoted 61 lines
Quoted 49 lines

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);
    }
Quoted 7 lines

}

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?

Quoted 9 lines

Regards
Andreas

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

A message that is not in the archive (sent off-list or not yet received): 48F5CF88.2030500-KWPb1pKIrIJaa/[email protected]

#9 lore raw
Quoted 11 lines · Jonathan Cameron
Quoted 6 lines · Andreas Seidler
Quoted 3 lines · Jonathan Cameron

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?

Quoted 6 lines

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
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

#10 lore raw
Quoted 9 lines · Andreas Seidler

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 ;)

A message that is not in the archive (sent off-list or not yet received): 48F608E7.9040309-KWPb1pKIrIJaa/[email protected]

#12 lore raw
Quoted 11 lines · Jonathan Cameron
Quoted 8 lines · Andreas Seidler

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!

Quoted 6 lines

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...?

Quoted 5 lines

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
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

#13 lore raw
In reply to a message not in the archive
Quoted 7 lines · Jean Delvare

Hi Andreas,

Quoted 4 lines · Andreas Seidler

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).

Quoted 5 lines
Quoted 3 lines

[...]
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)

Quoted 2 lines

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?

Quoted 7 lines
Quoted 1 line

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?

Quoted 4 lines

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
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

#14 lore raw

Hi Andreas,

Quoted 8 lines · Andreas Seidler
Quoted 7 lines · Jean Delvare

Hi Andreas,

Quoted 4 lines · Andreas Seidler

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).

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

[...]
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.

Quoted 5 lines
Quoted 2 lines

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.

Quoted 12 lines
Quoted 7 lines
Quoted 1 line

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.

Quoted 7 lines

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.

Quoted 4 lines

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.

Quoted 7 lines
Quoted 4 lines

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.

Signature · 6 lines
Jean Delvare

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

A message that is not in the archive (sent off-list or not yet received): [email protected]

#16 lore raw
Quoted 7 lines · Jean Delvare
Quoted 1 line · Andreas Seidler

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.

Quoted 12 lines
Quoted 4 lines
Quoted 2 lines

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.

Quoted 5 lines

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
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

#17 lore raw

Hi,

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

Quoted 3 lines

i get this values of channel 0:

OV: 0x00f0 (11110000)

Correct: 0xF000 & ~0xF000 = 0x0000

Quoted 1 line

1,6V: 0xaef5 (1010111011110101)

Correct: 0xf5ae & ~0xF000 = 0x05ae

Quoted 1 line

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
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

#18 lore raw
In reply to a message not in the archive
Quoted 15 lines · Jean Delvare

Hi Andreas,

Quoted 12 lines · Andreas Seidler
Quoted 11 lines · Jean Delvare

Hi Andreas,

Quoted 7 lines · Andreas Seidler

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)

Quoted 11 lines
Quoted 3 lines
Quoted 1 line

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.

Quoted 2 lines
Quoted 2 lines

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.

Quoted 39 lines
Quoted 2 lines

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.

Quoted 18 lines
Quoted 7 lines
Quoted 1 line

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
Quoted 5 lines
Quoted 1 line

(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.

Quoted 7 lines
Quoted 4 lines

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

Signature · 9 lines
Jordan Crouse
Systems Software Development Engineer 
Advanced Micro Devices, Inc.


_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c
#19 lore raw
In reply to Andreas Seidler

Hallo Andreas und Hello *,

Am 2008-10-15 03:01:56, schrieb Andreas Seidler:

Quoted 2 lines

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

Signature · 5 lines
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)

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c