If you are not a member your post will not be posted until it is moderated. You do not have to register to post, but pleased be ready to wait and stop double posting.
Gerald On Mon, Jun 8, 2015 at 10:03 AM, <[email protected]> wrote: > Hi community, > I am looking at this group for information and would like to ask you how > to read using i2c in c++. > I have the following code for write which works fine. > > txBuffer[0] = 0x2a; // location to write data > txBuffer[1] = 0xfe ; //data > opResult = write(i2cFD, txBuffer, 2); //write statement. > if (opResult !=2) printf("No ACK bit!\n"); > > I am having issues with read. I have the following code > opResult = read(i2cFD, (char*)rxBuffer, 6); > > printf("Part ID rx0: %x, %x\n", (int)rxBuffer[0], 0x00); > //print data at address 0x00 > printf("Part ID rx1: %x, %x\n", (int)rxBuffer[1], 0x01); > //print data at address 0x01 > printf("Part ID rx2: %x, %x\n", (int)rxBuffer[2], 0x02); > printf("Part ID rx3: %x, %x\n", (int)rxBuffer[3], 0x03); > printf("Part ID rx4: %x, %x\n", (int)rxBuffer[4], 0x04); > printf("Part ID rx5: %x, %x\n", (int)rxBuffer[5], 0x05); > > It prints out different values then what I expect using i2cdump > Can anyone shed some light on my problem? > > Thank you. > > -- > 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. > -- Gerald [email protected] http://beagleboard.org/ -- 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.
