From the previous logs, we can summarize the V3s power supply requirements to:
- SMPS for +3.3V / 1.2A for the I/O power supply
- LDO for +3.3V_AO / 30 mA for the Always-On power supply (RTC timer)
- LDO for +3.0V / 200 mA for the analog power supply
- SMPS for +1.8V / 1A for the DDR2 DRAM power supply
- SMPS for +1.25V / 1.6 A for the core power supply
On the LicheePi Zero board used in our FunKey Zero prototype, a triple SMPS EA3036 is used for generating these +3.3V, +1.8V and +1.2V voltages, with an additional XC6206 LDO for the +3.0V (the +3.3V Always On is connected directly to +3.3V). Although compact (the EA3036 is a tiny 3 mm x 3 mm QFN20 package), this solution is not ideal as it does not provide a battery charger and monitoring capability, which is a requirement for the FunKey device.
Sophisticated SoC requiring multiple voltages, high current and proper sequencing are common today and hopefully, all major manufacturers generally provide dedicated companion chips called PMICs (Power Management Integrated Circuits), in charge of these tasks. Allwinner is not an exception through its sister company X-Powers.
Their AXP20x products are highly-integrated PMICs that are optimized for applications requiring single-cell Li-battery (Li- Ion/Polymer) and multiple output DC-DC converters.and LDOs. Here is a block diagram:
The AXP20x features:
- A wide choice of input power source, the best source is chosen as IPSOUT inside the IPS (Intelligent Power Select) block :
- USB VBUS
- Battery BAT
- ACIN wall plug (not used in FunKey)
- BACKUP battery (not used in FunKey)
- A 1.8A fast PWM battery charger (also called DC/DC1) with battery voltage / current sense and programmable charge indication LED
- A soft key power-on/off logic with timer (just as in smartphones!)
- An I2C interface with interrupt signal to communicate with the CPU
- An optional battery temperature monitoring if the battery is equipped with an NTC resistor (not used in FunKey)
- A reference voltage
- A built-in 12-channel 12 bit ADC that measures various voltage and current data, as well as feeding an internal Coulomb counter and fuel gauge system (more on this later)
- A power OK output used to generate the global RESET signal in FunKey
- 5x GPIOs (not used in FunKey), GPIO0 can be programmed as LDO5 output
- 2x DC/DC SMPS DC-DC2 and DC-DC3
- 5x LDOs (only 2 are used in FunKey, LDO5 is optionnaly output to GPIO0)
Looking at their datasheets, it is difficult to tell the difference between the AXP202, AXP203 and AXP209 (any hint welcome!). In the FunKey design, we use an AXP209 because it is the one that comes along with the V3s when you buy it on AliExpress 😉
AXP20x Application Diagram
For complex dedicated chips like this, the best option is to follow as much as possible the application diagram and reference design given by the manufacturer, as the internals of the chips are seldom fully disclosed, so you need to take their word on some of the external component values to use.
The Allwinner V3s Reference Design contains on page 6 the schematics for using an AXP203 to supply the power to a V3s-based dashboard camera design. It follows closely the reference designs provided in the AXP20x datasheets:
More hints are provided in my self-translated V3s Hardware Design Guide (page 7) too.
FunKey PMIC Design Adaptation
The FunKey device uses all AXP209 integrated SMPS:
- the PWM charger DC-DC1
- the DC-DC2 for providing the +1.25 V / 1.6A for the core
- the DC-DC3 for providing the +3.3V / 1.2A for I/Os
But compared to the sophisticated reference designs, the FunKey device only uses 2 out of the 5 integrated LDOs:
- LDO1 supplies the +3.3V / 30 mA Always On for the RTC
- LDO2 provides the +3.0V / 200 mA for the analog power supply
- LDO3 / LDO4 / LDO5 are not used by FunKey
Here is the Funkey schematic block for the PMIC:
This schematic may look intimidating and complex, but it is in fact just a collection of simple basic elements, and it is actually very close to the manufacturer-recommended design.
The most noticeable difference is that the FunKey schematics use symbols and placement that are as close as possible to their corresponding physical package and layout, instead of defining symbols that are conveniently arranged by logical properties. Even if this makes schematics more complex at first sight, the benefit of this approach is that the step to go from the schematics to the physical layout become much easier, and so is the debugging of the physical board, which is then very close to the schematics too.
Another habit that is used everywhere in the FunKey schematics is that all signals (except power supplies and GND) are routed using explicit wires, rather than counting on invisible connection by net names and relying of the reader to search these names all over the place. This forces related components to be clustered in compact groups to shorten the wires, and put more focus on inter-cluster signals, with a natural inclination to unravel wire nests in the schematics before laying out the actual board.
And there are some “PWR_FLAG” symbols added here and there, which is the proper way in KiCAD to declare that a given net has a proper supply and thus prevent the ERC (Electrical Rule Check) to throw an error.
The end of this log details each PMIC function one by one:
Power Inputs (East side)
A wall-plug AC adapter input is not used in the FunKey device, so +VIN is just filtered using C75 on pins 32 and 33.
The USB power input +VUSB on pin 31 is filtered using C70, and the best (between +VUSB and +VBAT) available voltage is output to +VOUT on pins 34 and 35 and filtered using C78.
The BACKUP supply on pin 30 is not used and is left unconnected.
Internal Connections (All sides)
Some AXP20x signals are externally available and should be connected to external components:
- The +2.5V internal logic voltage VINT on pin 26 is filtered using the recommended value for C67
- The reference voltage VREF on pin 24 is decoupled with C64, and its BIAS connection on pin 23 is connected to a precision 200k 1% resistor R22, as recommended
Additionally, the AXP20x is actually made up of separate flexible blocks that require external interconnections to set their desired operation:
- All DC/DC inputs (VIN1 on pin 44, VIN2 on pin 7 and VIN3 on pin 14), as well as LDO3IN input on pin 40 are connected to the best available voltage +VOUT with filter capacitors C59, C23, C30, and C69, respectively
- LDO1SET on pin 27 is used to set the initial voltage of LDO1, and according to the datasheets, setting it to VINT sets its voltage to the desired +3.3V for the +3.3V Always On power supply
- OTOH, combined LDO 2 and 4 input LDOIN24 on pin 13 is instead connected to +3.3V in order to minimize the voltage drop for LDO2 to generate the +3.0V. Here too, there is a filter capacitor C34
- It is not clear what is the exact function of APS on pin 21 (it is described as “Internal Power Input”), but it is to be connected to +VOUT, too
DC-DC1 PWM Battery Charger (North East side)
The battery is connected to J5 (a 2-pin JST 1.0 mm pitch receptacle) and uses R21 as a precision current sense resistor, with C53/C56/C60 filter capacitors and L5 (a low-profile ferrite-core power inductor rated with a saturation current of 1.2A and low < 0.1 ohm resistance).
Please note that the battery is not protected on the board against reversing polarity, as the model used already contains a built-in protection.
R24 is mounted to simulate a battery NTC for measuring temperature, as the chosen LiPo battery does not feature this temperature sensor.
A user-programmable (through the I2C interface) charge LED D30 is provided, with its current-limiting resistor R26 (for which we need to raise the value as the LED is too bright!), as well as an TVS diode to prevent ESD, as the LED body will be accessible to to user.
DC-DC2 +1.25V / 1.6A (West side)
This SMPS is built around the ferrite core power inductor L3 and filter capacitors C26 and C29.
DC-DC3 +3.3V / 1.2A (South side)
This SMPS is built around the ferrite core power inductor L4 and filter capacitors C39 and C43.
LDO1 +3.3V Always On 30mA (South East side)
The LDO output on pin 28 is filtered with capacitor C72.
LDO2 +3.0V / 200mA (South West side)
The LDO output on pin 12 is filtered with capacitor C38.
LDO3 (North side)
This LDO is not used and its output on pin 41 is nevertheless filtered with a capacitor C63.
LDO4 (South West side)
This LDO is not used and its output on pin 11 is nevertheless filtered with a capacitor C38.
Power Key (North West side)
The AXP20x features a soft power key with internal short and long-press detection with user-programmable time settings, which enables turning power ON or OFF much like the way it is done in cellular phones.
Only a few external components are required: the tactile switch S13, its ESD protection TVS D29, and a low-pass filter R18 and C42 for debouncing the switch.
I2C Bus (North West side)
The AXP20x can be externally controlled by the main CPU using the I2C bus on pins 1 and 2. This bus has pull-up resistors to +3.3V R14 and R16, and the IRQ/WAKEUP signal on pin 48 enables warning or waking up the CPU on a selection of AXP20x-generated events, with a pull-up resistor R13 to +3.3V..
GPIOs (South and West sides)
GPIO0-3 on pins 19, 18, 5 and 3 are not used and are left unconnected.
PWROK (South West side)
The PWROK signal on pin 25 is used to generate the global RESET signal for the whole board, with a pull-up resistor R15 to the +3.3V Always On power supply.
Enable Signals (West side)
The global chip enable signal N_OE on pin 4 is always activated through a 2k resistor R17 to to GND.
The USB enable signal N_VBUSEN on pin 6 is directly tied to GND to always enable power from the USB bus.
Through the I2C bus and the numerous internal available registers, the AXP20x provides a very good control of its operation, including many threshold and timing settings, but also many voltage and curent monitoring values.
Coulomb Counters / Fuel Gauge
It is well known that battery discharge voltage curve over time is very flat, making it very difficult to estimate the real charge/discharge state of the battery. Moreover, these states will vary with temperature, load, and aging.
The only accurate way to monitor the battery status is to actually count the energy that is stored when charging, and the one that is consumed. This particularly important feature is achieved in the AXP20x using a dual Coulomb counter which continuously sums the current intensity over time for monitoring the battery accurate charge and discharge status, with user-defined alert thresholds.
This fuel gauge is providing the ability to precisely report the remaining battery capacity, just like people are used to with cellular phones.