View previous topic :: View next topic |
Author |
Message |
mazen82
Joined: 10 Sep 2009 Posts: 22
|
Smart Battery Comm. using SMBus |
Posted: Wed Jan 12, 2011 3:28 pm |
|
|
Hi,
I am trying to communicate to a smart battery BB-2590 using the smbus.
I am using the pic18f97j60 connecting to one of the comm ports on the battery.
I have the i2c setup as:
Code: | #use i2c(Master,Slow,sda=PIN_D5,scl=PIN_D6,restart_wdt) |
and my command lines are:
Code: |
i2c_start();
i2c_write(0x16); // Device address 0001011 0
i2c_write(0x08); // Device Command Code for Temperature
i2c_start(); // Restart
i2c_write(0x17); // Device address 0001011 1
data1=i2c_read(1); // Now read from slave
data2=i2c_read(0);
i2c_stop(); |
My data keeps coming as FF. Is there something missing? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Jan 12, 2011 5:11 pm |
|
|
Post a link to the data sheet for the smart battery. Hopefully the data
sheet has a description of the SMBus interface protocol.
Also, what is the voltage used for the SMBus with this battery ?
Is is +5v or +3.3v ? Hopefully the data sheet has this info.
Does the battery have built-in pull-ups on SCL and SDA, or do you have
to supply them externally ? If you have already added external pull-ups,
what is the resistor value that you used ?
Appnote on the differences between the i2c bus and the SMBus:
http://www.maxim-ic.com/app-notes/index.mvp/id/476
Also, it's possible that your Smart Battery slave addresses are wrong
or are shifted-by-1. Run this program which will scan the i2c bus
(or SMbus) and report all slave devices that it finds on the bus:
http://www.ccsinfo.com/forum/viewtopic.php?t=42368&start=4 |
|
|
joshirupesh1989
Joined: 19 Apr 2017 Posts: 1
|
Need source code of smart battery |
Posted: Wed Apr 19, 2017 7:48 am |
|
|
Dear sir, i am also facing same problem.
Can you please send me source code for smart battery +PIC microcontroller on my email address.
[email protected]
thanks |
|
|
|