A kind of battery detection method and device
Technical field
The present invention relates to communication technical field, particularly relate to a kind of battery detection method and device.
Background technology
In the use procedure of mobile terminal, battery is part and parcel very.In order to prevent that mobile terminal from being used illegal battery, generally all can detect the battery of mobile terminal.Battery on mobile terminal all can arrange one for detection of the ID pin of battery at present, one of them effect of this pin is when mobile terminal charges, to detect mobile terminal whether to use legal battery, and another effect is whether in when start, detect battery legal.
In prior art, when mobile terminal charges, the baseband chip of mobile terminal can detect the ID pin of battery always, avoids user in charging process to pull up battery.And while not charging, the general ID pin that only need to detect battery in start process, need not continue after start to detect again.This is that mobile terminal also will shut down because user pulls up after battery, follow-up after battery insertion charger, just needs to detect the ID pin of battery again.
As shown in Figure 1, be the testing circuit schematic diagram of prior art.In this detection method, the power supply AVDD (analog operation voltage) of power management chip output can not close, after mobile terminal-opening, AVDD is by resistance R 1, through the ID resistance R in battery, be transferred to underground again, therefore AVDD is by this path generation current, and this size of current depends on the size of R1, R.Whether the baseband chip of mobile terminal detects the magnitude of voltage in resistance R by ADC_ID and is input to ADC (mould/number conversion) module of baseband chip, according to this battery that relatively comes to determine of this magnitude of voltage and threshold value, be legal battery.Threshold value is generally arranged by each producer oneself.
Inventor's discovery, the ID pin that really need to detect battery is that other times do not need to detect when charging and start.Owing to not needing to detect, AVDD still equally can pass through R1, R and form unnecessary electric current, has produced power consumption, although only less than the power consumption of 0.2mA, but during for mobile terminal standby, only there is the average current of 1.5mA left and right, for the minimum current of 0.8mA, be very large electric leakage.
Therefore, existing detection method is brought the defect of unnecessary power consumption.
Summary of the invention
The technical matters that the present invention mainly solves is to provide a kind of battery detection method and device, can when completing battery detecting, realize the effect of power saving.
The invention provides a kind of battery detection method, comprising:
When mobile terminal-opening or when charging, the magnitude of voltage that when universal input/efferent GPIO that the ID pin by battery obtains at baseband chip is high level, the internal resistance of battery produces;
Whether according to the comparative result of the described magnitude of voltage obtaining and predetermined threshold value, detect described battery is legal battery;
After described detection completes, described universal input/efferent is set to low level.
Preferably, the described ID pin by battery obtains the magnitude of voltage that the resistance in battery produces when universal input/efferent GPIO is high level and is specially:
Described universal input/efferent output high level provides power supply;
Between described universal input/efferent and battery, have the first resistance, the voltage that the internal resistance of described battery and described the first resistance produce the electric current between described universal input/efferent and ground carries out dividing potential drop;
ID pin by battery obtains the magnitude of voltage that the internal resistance of described battery produces.
Preferably, specifically by the baseband chip of mobile terminal, the ID pin by battery obtains the magnitude of voltage that the internal resistance of battery when universal input/efferent GPIO is high level produces.
Preferably, described universal input/efferent GPIO is the GPIO that one of them acquiescence in described baseband chip is output as high level
Preferably, describedly described universal input/efferent be set to low level comprise:
By being set, the register realization that described universal input/efferent is corresponding is set to low level.
The present invention also provides a kind of battery check device, comprising:
Universal input/the efferent of baseband chip, for exporting high level;
Test section, for when mobile terminal-opening or when charging, the ID pin by battery obtains the magnitude of voltage that the internal resistance of battery when universal input/efferent GPIO is high level produces; Whether according to the comparative result of the described magnitude of voltage obtaining and predetermined threshold value, detect described battery is legal battery;
Control part, after completing when described detection, is set to low level by described universal input/efferent.
Preferably, have the first resistance between described universal input/efferent and battery, the voltage that the internal resistance of described battery and described the first resistance produce the electric current between described universal input/efferent and ground carries out dividing potential drop;
The ID pin of described test section by battery obtains the magnitude of voltage that the internal resistance of described battery produces.
Preferably, described universal input/efferent GPIO is the GPIO that one of them acquiescence in baseband chip is output as high level.
Preferably, described control part is set to low level by the register realization that described universal input/efferent is corresponding is set.
Technique scheme can find out, the present invention has following beneficial effect:
The present invention is by adopting universal input/efferent GPIO to replace AVDD of the prior art to export high level as power supply, so after having detected, for example, while not needing to detect battery ID again after start, by universal input/efferent is set to low level, just can be so that generation current no longer in testing circuit, thereby can not produce power consumption, realize the object of power saving, and not increase cost.
Accompanying drawing explanation
Fig. 1 is the testing circuit schematic diagram of prior art;
Fig. 2 is detection method process flow diagram of the present invention;
Fig. 3 is testing circuit schematic diagram of the present invention;
Fig. 4 is the concrete testing circuit schematic diagram of the present invention;
Fig. 5 is apparatus structure schematic diagram of the present invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the present invention's part embodiment, rather than whole embodiment.Embodiment based in the present invention, those of ordinary skills, not making all other embodiment that obtain under creative work prerequisite, belong to the scope of protection of the invention.
The invention provides a kind of battery detection method, can when completing battery detecting, realize the effect of power saving.
In prior art, the power supply AVDD of power management chip output does not close, by resistance R 1, ID resistance R (inside battery resistance) generation current.The current value that different mobile terminals produces is different, for example the general electric current that produces 0.1mA to 0.2mA on the mobile terminal of the MTK of MediaTek Inc. platform.Owing to not needing to detect battery ID, AVDD still equally can pass through R1, R and produce unnecessary electric current, has caused power consumption.
In order to address this problem, the way that the present invention considers is this power supply AVDD to be closed while not needing to detect, and opens this power supply while needing again.Yet this power supply is can not be pent on mobile terminal, because this power supply is the power supply that acquiescence is opened, closing rear mobile terminal can shut down, and this power supply need select power management chip to give tacit consent to the power supply of opening, if select one not to be the power supply that acquiescence is opened, that ID that cannot carry out battery when just startup and shutdown charging detects.Therefore, the present invention considers the power supply of selecting universal input/efferent GPIO (General Purpose Input Output) to replace AVDD to detect as battery ID, thereby overcomes the defect of prior art.
Fig. 2 is detection method process flow diagram of the present invention.
As shown in Figure 2, detection method of the present invention comprises:
Step 201, when mobile terminal-opening or when charging, the ID pin by battery obtains the magnitude of voltage that the internal resistance of battery when universal input/efferent GPIO is high level produces;
This step is specially:
Universal input/efferent output high level provides power supply;
Between universal input/efferent and battery, have the first resistance, the voltage that the internal resistance of described battery and described the first resistance produce the electric current between described universal input/efferent and ground carries out dividing potential drop;
ID pin by battery obtains the magnitude of voltage that the internal resistance of described battery produces.
Concrete, this step is the baseband chip by mobile terminal, and the ID pin by battery obtains the magnitude of voltage that the internal resistance of battery when universal input/efferent GPIO is high level produces.
In addition, universal input/efferent GPIO is the GPIO that one of them acquiescence in described baseband chip is output as high level.
Whether the magnitude of voltage obtaining described in step 202, basis and the comparative result of predetermined threshold value detect described battery is legal battery;
Predetermined threshold value in this step, is according to circumstances arranged by producer.
Step 203, after described detection completes, described universal input/efferent is set to low level.
This step is specially: by the register realization that described universal input/efferent is corresponding is set, be set to low level.
Can find, the present invention is by adopting universal input/efferent GPIO to replace AVDD of the prior art to export high level as power supply, so after having detected, for example, while not needing to detect battery ID again after start, by universal input/efferent is set to low level, just can be so that generation current no longer in testing circuit, thus can not produce power consumption, realize the object of power saving, and do not increase cost.
Referring to Fig. 3, is testing circuit schematic diagram of the present invention.
As shown in Figure 3, figure comprises that battery connector, GPIO, resistance R 1, inside battery resistance are ID resistance R, ADC_ID.From GPIO, through resistance R 1, resistance R, be connected to ground, form a path, when GPIO is high level, generation current in path, resistance R produces dividing potential drop to voltage, whether by ADC_ID, can detect the magnitude of voltage in resistance R, be legal battery according to this battery of relatively can determining of this magnitude of voltage and threshold value.
Compare with Fig. 1 scheme of prior art, the present invention adopts GPIO to replace AVDD as power supply, and is all high level.
Because the electric current that in prior art, AVDD provides at testing circuit is also little, the electric current that is less than 1mA, and the GPIO of baseband chip generally can provide the electric current of 8mA, therefore from the ability of source current, consider, can consider the power supply that adopts GPIO to replace AVDD to detect as battery ID.
In baseband chip due to mobile terminal, there is the high level voltage of a lot of GPIO the same with the voltage of AVDD, and for the power supply of GPIO power supply is also the power supply that power management chip acquiescence is opened, therefore can consider for replacing AVDD, just when selecting, need to select acquiescence to be output as the GPIO of high level.That is to say, during just startup and shutdown charging, the GPIO that is output as high level can provide an effective Power supply pond ID to detect and use, and in fact such GPIO has much available in most baseband chip, MTK6235 for example, the MTK platform baseband chip of MTK6516 model etc.
The GPIO that the present invention adopts acquiescence to be output as high level replaces AVDD power supply, while not needing to detect battery ID more so after start, only GPIO need to be output as to low level.Concrete, by software, the register that this GPIO is corresponding is set and just can realizes and be set to low level.Processing through such, just makes just to no longer include current drain on resistance R 1, R, also just reduces power consumption, realizes power saving.
Fig. 4 is the concrete testing circuit schematic diagram of the present invention.
Fig. 4 compares with Fig. 3, has increased the connection of base chip.In figure, AUX_IN is the ADC input pin of baseband chip.The GPIO of baseband chip selects an acquiescence to be output as the GPIO of high level, and its high level voltage and AVDD have same voltage.When mobile terminal inserts charger charging and start, the power supply opening that the power management chip of mobile terminal is opened acquiescence, after having power supply output, GPIO has also exported high level, for battery ID detects, provides power supply.
Baseband chip detects the magnitude of voltage in resistance R by ADC_ID, according to this magnitude of voltage and predefined threshold value, just can judge whether this battery is legal battery.For example, when this magnitude of voltage is greater than threshold value, think that this battery is illegal battery.If while there is no battery, the magnitude of voltage detecting by ADC_ID is by the magnitude of voltage that is GPIO.
It should be noted that, said threshold value, is generally that each producer oneself arranges here, and the battery of mobile terminal generally all unifies there is ID resistance, but the value of this resistance also can be arranged by each producer.
When not needing to detect battery ID again, by software, the register that this GPIO is corresponding is set, GPIO is output as to low level, make no longer generation current of testing circuit, thereby realize power saving.
Above-mentionedly describe method of the present invention in detail, corresponding, the invention provides a kind of battery check device.
Fig. 5 is apparatus structure schematic diagram of the present invention.
As shown in Figure 5, battery check device comprises: universal input/efferent 501, test section 502, control part 503.
Universal input/efferent 501, for exporting high level;
Test section 502, for when mobile terminal-opening or when charging, the ID pin by battery obtains the magnitude of voltage that the internal resistance of battery when universal input/efferent 501GPIO is high level produces; Whether according to the comparative result of the described magnitude of voltage obtaining and predetermined threshold value, detect described battery is legal battery;
Control part 503, after completing when described detection, is set to low level by described universal input/efferent 501.
Between described universal input/efferent 501 and battery, have the first resistance, the voltage that the internal resistance of described battery and described the first resistance produce the electric current between described universal input/efferent 501 and ground carries out dividing potential drop;
The ID pin of described test section 502 by battery obtains the magnitude of voltage that the internal resistance of described battery produces.
Described universal input/efferent 501GPIO is the GPIO that one of them acquiescence in baseband chip is output as high level.
Described control part 503 is set to low level by the register realization of described universal input/efferent 501 correspondences is set.
In sum, the present invention is by adopting universal input/efferent GPIO to replace AVDD of the prior art to export high level as power supply, so after having detected, for example, while not needing to detect battery ID again after start, by universal input/efferent is set to low level, just can be so that generation current no longer in testing circuit, thus can not produce power consumption, realize the object of power saving, and do not increase cost.
The foregoing is only embodiments of the invention; not thereby limit the scope of the claims of the present invention; every equivalent structure or conversion of equivalent flow process that utilizes instructions of the present invention and accompanying drawing content to do; or be directly or indirectly used in other relevant technical fields, be all in like manner included in scope of patent protection of the present invention.