Rapid prototyping function based on I2C/SMBus
This module provides step-by-step prototyping functionality (with demonstrations) based on the i2C/SMBus interface to a BQ battery charger device. |
Resources
So you're probably saying, seriously? You just showed me a demo of a high voltage and a low voltage. I think the key factor here is that you're able to read an ATD value and get it on a funny screen, and then take that value and do something with it. Too simple? Well, if you think so, please bear with me again and hold that thought, because in the next demo, we're going to do some serious hardware prototyping.
A very serious hardware prototyping function, which is I square C, or in this case SMBus. We're going to actually talk to a real TI battery-charging device, which happens to be a SMBus, which is very similar to I square C.
So I ask you, don't you got a sense of my square C commands at some point talking to various devices? I know there's a lot of great TI tools out there, a nice GUI tool that connects to your PC, and it's great for evaluating various TI devices. But it doesn't help too much when it comes to prototyping. And that's what we're going to explore here.
So not only are you going to get scope traces, but we're also going to show you a real I square C bus analyzer and show the data values that are getting read and write to.
So as with the previous demos, let's look at the pin map. In the case of I square C, we've got two GPIO pins, 1-6 and 1-7, which are multiplex I square C. As you can see, 1-6 is the I square C clock. 1-7 is I square C data, respectively. Now, if we're going LaunchPad to LaunchPad, we would need some pull-up resistors for the I square C bus, but we'll see the next slide why that's not necessary in this case.
And another thing to watch out for, too, is that pin 1.6 multiplexes many things, and one of them happens to be a GPIO that goes to the green LED, which I did not realize for half an afternoon when I first started running on this LaunchPad. So it turns out, and I'll show you when we do the demo, that I had to un-jumper the green LED because the analog circuit there was messing up the I square C clock, but something that's easily fixable from that standpoint.
So jumping to the demo, as always, we have a PC that's USB bus-powering our MSP430 LaunchPad. And the I square C controller is talking in this technically SMBus to the BQ controller. We'll talk about how the BQ device's EVM is actually getting powered through 3.3 volt by the LaunchPad. But it turns out, to enable the BQ device, we actually need an external power supply running about 20 volts DC. And you'll see that, also, when we get to the demo.
And again, as we mentioned, we'll have an actual bus analyzer. And what we're going to be looking at is the SMBus interface of the particular BQ24725 part. They are basically a write word format, but what we're going to do, actually, is a write-read. And what the write-read means is you're basically writing a command byte, which is either the device ID or the manufacturer ID. You can see what their hex values are-- FF and FE, respectively.
And then once you write the command, which is the device ID or manufacturer ID readback, you actually read it back. So we're going to basically do a write-read. Write-writes also do work, but this was a bit more interesting.
And one other thing to note is there are actual pull-up resistors on the BQ24725 AEVM, so that we didn't need to actually put pull-up resistors here on the MSP430 LaunchPad, as we often do when we're going LaunchPad to LaunchPad. Of course, you can't really blame the LaunchPad, because those pins can be multiple functions.
And so here on the scope, we'll see a single I square C rate. And I'm zooming out here to see I square C, the write and the read. And again, we'll see that closer live on the bus analyzer.
So our demo space has gotten quite busy since our last demo. As usual, we have our MSP430 LaunchPad, USB bus-powered is always off a PC. And joining as a guest, we have a BQ24725 AEVM, which is basically a battery-charging device. And as you can see, there is a power and ground going-- the black wire and the red wire-- from the LaunchPad to the BQ EVM to power the 3.3 volt part of it.
And I guess while we're at it, we've got, of course, our MSP430 I square C pins. SCL is the blue, and SDA, which is the data, is the white, also going to the 3.3 volt area of the BQ device. As mentioned, to enable the BQ device, we need an external power supply that you see here-- 20 volt DC, approximately, is what we're running. And you can see that that's getting power here-- the red power, and of course a black ground.
And then, as we mentioned before, don't need pull-up resistors because the pull-up resistors themselves are on the BQ device itself. And we do have a rat's nest of wires that you see down here, which are basically allowing us to use the scope and the bus analyzer. Bus analyzer is here. It's also USB going to the PC, which we'll show you a live shot of that.
So we mentioned the write-read is what we're going to be doing. Here's the write and here's the read of FF to get the device ID, and then reading back the manufacturer ID, which is FE. So all this time, we've actually been running the I square C SMBus. And you can see on the scope, this is basically the write that's going on. It's actually auto-triggered right now, and basically triggered on the channel 1.
So channel 1 is the other SCL, the clock bits. For those of you that are sticklers, you can look and see the cursor is here. The clock is about 83 kilohertz, so around 100 kilohertz. You'll notice our BQ parts can be very forgiving when it comes to frequencies, but the edges are quite clean coming from the LaunchPad. We're actually triggering on SDA, on the data stop bit-- I mean a start bit, which is this low here.
And so this is basically the write. If we zoom out, we're able to see-- I have to do this twice, I guess-- the write and the read on the scope itself.
So a quick review of the data sheet and what we're going to see on the bus analyzer. The SMBus slave device address is 12 hex. As the analog BQ part defines it, it's a 7-bit address. Depending how you bit shift, it ends up being a 9 hex when you look at it digitally. I'm not going to argue. The pattern works for that particular slave address.
The two registers we're going to read, we mentioned, were FF and FE, one being the ID register and one being the manufacturing ID register. Just a quick note. Here's the 10K pull-up resistors that are needed if you were just going LaunchPad to LaunchPad. But again, since the beaker device has it onboard, didn't need to actually put those on there.
Here's the write that we mentioned, and of course, the write-read is what we're doing. The device ID and the manufacturer ID is what we're going to read back. Be sure to mention, too, that when the power was off, you don't see this ack back on the BQ device. And that's one of the things where you need the 20 volt.
So I promised you a live bus analyzer trace. This actually has been running all this time. I can just capture it and stop it. It's going continuous. I'll just show you here. Here's the write transaction we mentioned, FF. You can see the data FF here, the write to address 9, and then the read back. I'll click on here. Becomes the B, which is the value that you see returned back. So that's another sheet. But and then the value that you see back on the data sheet for FE is 40, and that value is also coming back.
This video is part of a series
-
Rapid prototyping - getting started with our solutions
video-playlist (19 videos)