Hi Jinsuk, Thank you for the support. I am a beginner myself but I will try to understand the code. My problem is if you look at (code.png) it is the code that is providing me the error. The code2 is the output that I am getting(erroneous). And code 3 is the output I should be getting. Somehow, the program is skipping even values after 0. It would be a huge help to a beginner like me if you can glance at it and point me in the right direction.
Thanks On Mon, Jun 8, 2015 at 12:56 PM, Jinsuk Seo <jinsuk....@morgansolar.com> wrote: > Hi, > > I am not sure exactly what issue you are experiencing, but here is my > source code. Hope it helps. > > Regards, > Jinsuk > > --- > Jinsuk Seo > Embedded Device Engineer > Morgan Solar Inc. > 100 Symes Rd, Unit 100A Toronto, ON M6N 0A8, Canada > > Phone: (416) 203-1655 | Fax: (416) 203-2805 | *jinsuk....@morgansolar.com > <youremailaddr...@morgansolar.com>* > > > *NOTICE: *This message contains information that may be privileged and/or > confidential and is for the sole use of the intended recipients. If you are > not the intended recipient, you are not authorized to read, print, retain, > copy, disseminate, distribute or use any part of this message or its > attachments. If you received this message in error, please notify the > sender immediately and delete all copies of this message. > > On Mon, Jun 8, 2015 at 10:58 AM, <priyank...@gmail.com> wrote: > >> Hi Jin, >> I am looking at this post 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); >> printf("Part ID rx1: %x, %x\n", (int)rxBuffer[1], 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 you shed some light on my problem? >> Thanks big time. >> >> >> On Tuesday, November 6, 2012 at 6:26:54 PM UTC-5, Jin wrote: >>> >>> Hi all, >>> >>> I am trying to change some register settings for TPS6217 (power >>> management chip) through i2c on linux userspace. >>> >>> My hope is to configure the settings using c++. I am using the kernel >>> 3.2.33, and the i2c slave address is already binded to the driver. (seems >>> TPS65217 specific) >>> >>> I know how to use i2c drivers for general i2c, But I don know how to >>> include and use TPS65217 driver on my code. Any ideas? >>> >>> Best regards, >>> >> -- >> For more options, visit http://beagleboard.org/discuss >> --- >> You received this message because you are subscribed to a topic in the >> Google Groups "BeagleBoard" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/beagleboard/d_mgCENpj8s/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> beagleboard+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > > -- > For more options, visit http://beagleboard.org/discuss > --- > You received this message because you are subscribed to a topic in the > Google Groups "BeagleBoard" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/beagleboard/d_mgCENpj8s/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > beagleboard+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Regards, Priyank Shah -- 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 beagleboard+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.