from tech specs: 22 19 SCL Serial clock line. *Connect to VCC through a pullup resistor* 23 20 SDA Serial data line. *Connect to VCC through a pullup resistor.*
should work On Tuesday, December 16, 2014 5:22:04 AM UTC+1, [email protected] wrote: > > Good morning everyone, > > My slave board consists of 16 bit I/O expander IC-- PCF8575. It has two > PCF8575. According to the datasheet the address of PCF is 0x0100A2A1A0R/W. > In the board for first PCF which i am interested, the A2 is ground, A1 is > ground and A0 is connected to Vcc. I want to read from PCF, so i used > R/W=1. Thus my address is 0x43. > The board is powered with two supply, 12V and 5V. But when checked the SDA > and SCL voltage using a digital multimeter, i found they are at 3.3V. So i > didn't go for a level shifter. > > I will try with pull up resistors and tell the results. > > > > On Thursday, December 11, 2014 11:39:35 AM UTC+5:30, [email protected] > wrote: >> >> Hi, >> >> I am trying to read two bytes of data from a board(slave) using >> BBB(master) through i2c interface. >> >> I connected my board's SDA and SCL lines to P9_18 and P9_17 of BBB >> respectively. >> >> My code is >> >> #include <stdio.h> >> #include <errno.h> >> #include <string.h> >> #include <fcntl.h> >> #include <stdlib.h> >> #include <unistd.h> >> #include <linux/i2c-dev.h> >> #include <sys/ioctl.h> >> >> >> int main() >> { >> int fd,i; >> int addr = 0x43; >> char buffer[10] = {0}; >> >> fd = open("/dev/i2c-1", O_RDWR); // opening i2c-1 file. returns a file >> descriptor used by read >> if(fd < 0) >> { >> printf("i2c failed to open\n"); >> } >> >> if(ioctl(fd, I2C_SLAVE, addr) < 0) >> printf("failed to acquire bus\n"); >> >> if(read(fd,buffer,2) != 2) //reading 2 bytes of data >> { >> printf("i2c read failed\n"); >> >> } >> else >> { >> for(i=0;i<2;i++) >> printf("the data is %d \n",buffer[i]); >> } >> >> >> return 0; >> } >> >> >> >> >> >> >> I got output --- "i2c read failed" >> >> What is the problem in my code? Or any problem in hardware? When I >> checked the following command, I got output like >> >> root@beaglebone:~# i2cdetect -l >> i2c-0 i2c OMAP I2C adapter I2C >> adapter >> i2c-1 i2c OMAP I2C adapter I2C >> adapter >> root@beaglebone:~# ls -l /sys/bus/i2c/devices/i2c-* >> lrwxrwxrwx 1 root root 0 Jan 1 2000 /sys/bus/i2c/devices/i2c-0 -> >> ../../../devices/ocp.3/44e0b000.i2c/i2c-0 >> lrwxrwxrwx 1 root root 0 Jan 1 2000 /sys/bus/i2c/devices/i2c-1 -> >> ../../../devices/ocp.3/4819c000.i2c/i2c-1 >> >> >> Can anyone find problem? Please reply. >> > -- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups "BeagleBoard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
