I am designing a USB based charger for a Li ion battery. Now, the charging could be from a simple USB connected to a PC (that sources about 500mAmps) or from a DCD USB charger adapter.
Now, I am using a detector IC to check if it is DCD or any simple USB (Detector IC). This is followed by the charger IC. Now, this charger IC can supply about 2Amps. To configure this charger IC to give me higher ccurrent(greater than 500mAps) I connect the CHG_AL_N and CHG_DET to the M0 and M1 pins of the IC.
now, these pins can be used in conjunction with the BAT_GOODpin to work up the whole system. To supply to the BAT_GOOD, I was considering using a voltage dividor from the Battery voltage rail directly to the BAT_GOODpin.
Now,iyt will register it as a good battery if BAT_GOOD >=1.1 and a bad battery if < 0.5V.
A voltage divider wont suffice. How can I go ahead. Also, is my working of these 2 ICs correct please ?
I think you basically have it. I have not carefully checked every detail (for example I didn't double-check current limits based on M0 and M1) but the basic idea is right.
GOOD_BAT is kind of hard to explain. You should seek out the USB charging specification, version 1.2. But I will try.
When a USB device connects to a host (a PC, for example) it is supposed to keep USB current draw within some limit until a configuration is received from host allowing a higher limit (typically 500 mA). This requires the device to have some intelligence and be able to communicate over USB data lines.
But if you have a device with a very low battery, it may not be able to fully boot up. So it cannot see to these USB details. So the USB charging specification created a provision for this "dead battery" condition. This is called the Dead Battery Provision (DBP).
According to the DBP, if a device with dead battery is plugged in, the device is allowed to draw current for a while without communicating over the USB data bus and without receiving a configuration from the host. But this is only allowed for a short time (I think 30 minutes). The BQ24392 helps implement this by running a timer and monitoring GOOD_BAT.
Basically, if GOOD_BAT does not transition high within the DBP timer period in the BQ24392, it will disconnect the USB power and data from the rest of the board. This is something that is mainly only required for strict compliance with USB.
Many devices do not need this functionality and can just always set GOOD_BAT high. If you need to use USB logos on your product and packaging, you may need to have strict compliance with all USB provisions, and will need to verify that through testing. Otherwise, in my opinion, strict compliance is not really needed. In that case, make sure you draw 500mA or less UNTIL you are sure that the you are connected to a DCP or host which can supply more than that. THEN enable the higher limit based on charger type detection result. If all of these things are true, you can just set GOOD_BAT high all the time.
If you do want to support GOOD_BAT, the easiest way is probably to put a comparator on VBATT. The comparator would be powered by USB_VBUS. You could also possibly use the processor to do this. It could sample VBATT during boot up and drive GOOD_BAT high if VBATT is > than 3V (or whatever). There are a lot of details I am not covering here, such as drawing power from VBATT all the time, and failure mode of comparator which could allow uncontrolled charging of battery when VBUS is high. You would only worry about such things if you go this route.
Good luck and have fun!
The task is quite challenging. Are you sure you did examine your M0/M1 truth table carefully? If any charger is detected by BQ24392, M0 will be LOW, and the charge taken by MP2617 will not exceed regular USB levels, per your current connection. I am afraid you need to consider a micro-controller, and write proper firmware for it to interpret BQ24392 outputs and translate them into MP2617 controls. To detect whether the port is USB2 or USB3, you would need much more sophisticated micro-controller.