TPS65217 chip i2c register setting

152 views
Skip to first unread message

Jin

unread,
Nov 6, 2012, 6:26:54 PM11/6/12
to beagl...@googlegroups.com
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,

priya...@gmail.com

unread,
Jun 8, 2015, 11:46:33 AM6/8/15
to beagl...@googlegroups.com
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.

Jinsuk Seo

unread,
Jun 8, 2015, 12:56:51 PM6/8/15
to beagl...@googlegroups.com
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 jinsu...@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.


--
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...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

batterygauge.cpp
batterygauge.h

Priyank Shah

unread,
Jun 8, 2015, 2:02:50 PM6/8/15
to beagl...@googlegroups.com
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
--
Regards,
Priyank Shah
code.png
code2.png
code3.png
Reply all
Reply to author
Forward
0 new messages