Question from the Customer:
I am using the Aardvark I2C/SPI Host Adapter and Control Center Serial Software with an SMBus Smart Battery NH2054 and a Smart Battery Charger. With the results that I see, I am uncertain which device is the master and which devices are slaves.
Here is what I see:
- In the Slave tab, only addresses 8 and 9 give me back some data. Does that indicate the battery is acting as the master device?
- It looks like address 9 is the 7-bit address for the charger (0x12) and address 8 is the 7-bit address for the Aardvark adapter.
- When I select address 9, I see current and voltage. As best as I can tell, 14 and 15 are commands that are sent to the battery charger.
- When I select address 8, the Battery status word comes up and indicates Read and Slave. It seems the command 16 was sent to the host. In this case – which device is the slave?
Response from Technical Support:
Thanks for your question! We have two solutions for you. The first solution is to use a basic way to set up and verify the host adapter on an SMBus. This will help you understand and identify master and slave devices. The other information is reading and writing to an SMBus register.
Set up and Verify I2C Host Adapter for SMBus
The following instructions include reading and writing to a register. You can modify the steps as needed to read and write to your Smart Battery slave device.
- Follow the instructions in the Aardvark I2C/SPI Host Adapter Quick Start Guide.
- Connect the Aardvark I2C/SPI Host Adapter to computer. Connect Aardvark I2C connector to SMBus. Remove any other devices from the adapter. Uninstall, re-download and re-install the latest USB drivers for Windows. The Aardvark adapter should show up in Windows Device Manager under the USB section and other devices section.
- Launch Control Center Serial Software and transfer data between Aardvark adapter and SMBus:
- Click Configure Aardvark Adapter and choose Aardvark Adapter.
- Click Aardvark, select I2C + SPI, and enable I2C Pulls-Ups and Target Power (if needed).
- Perform Write
- Click Master.
- Enter 100 in Bitrate rectangular and click Set.
- Enter 0x2C in Slave Address rectangular {Selecting target address 0x58/0x59}.
- Disable 10-Bit Addr and No Stop.
- Enter 0x01 0x03 0x0A 0x0B 0x0C in the Message rectangular.
- Click Master Write. {writing to register address 0x01: byte count: 0x3, data: 0x0A 0x0B 0x0C}.
- Perform Register Read
- Enter 0x01 in the Register Address rectangular.
- Enter 4 in Number of Bytes rectangle.
- Choose Address Width to 2 bytes.
- Click Master Register Read
- Verify that the read data is 0x03 0x0A 0xB 0x0C. {reading from register address 0x01: byte count: 0x3, data: 0x0A 0x0B 0x0C}.
How to Write to and Read from an SMBus Register
The steps to write and read to register are very simple.
Writing to SMBus Register
The register write can be done by a single write command. The Aardvark adapter is setup as the master device. To send the data “04 19” to the register location “0x12”, send the following in the message window of the Control Center Serial Software:
12 04 19
Please note, the master Aardvark adapter only expects acknowledgement from the slave device.
Reading an SMBus Register
Reading an SMBus register requires two operations:
- Write the desired register address, which lets the slave device know which address to read.
- Afterwards, the slave responds with the data from the requested register address.
For additional information about Register Read and Master Read, take a look at this article: What is the Difference between Master Register Read and Master Read, and How Can I Best Implement those Commands?
We hope this answers your questions. Additional resources that you may find helpful include the following:
If you want more information, feel free to contact us with your questions, or request a demo that applies to your application.