Running Automatic fo A20

Started by akhal, January 09, 2014, 07:13:43 AM

Previous topic - Next topic

akhal

Hi everyone,
I have A20-OLinuXino-MICRO-4GB with Android OS.
The problem is my A20 not running automatic when I plug the power (I need press the power on button).
So, how to make running automatic for A20-OLinuXino-MICRO-4GB ?

Thank you.

dave-at-axon

I am trying to find a solution for this too as I have a system that will be located in a remote location and it needs to start when power is applied.

According to a poorly translated version of the AXP209 power management IC, this function can be enabled through configuration via the I2C bus. I am still trying to find a proper English manual for this device so no idea how to enabled this just yet. :(

The other option I may have is a secondary AVR Tiny microcontroller on my daughter board that will control the POWER switch. I need to solder wires to this anyway as there is no external connection for these on the A20.

There is also an IRQ/WAKEUP? input to the AXP209 that is available on the GPIO2 connector. I need to see what this does it might be useful to bring the device up??

akhal

Quote from: dave-at-axon on January 10, 2014, 02:11:25 AM
According to a poorly translated version of the AXP209 power management IC, this function can be enabled through configuration via the I2C bus. I am still trying to find a proper English manual for this device so no idea how to enabled this just yet. :(
I found datasheet for AXP202. May be compatible with AXP209.

http://linux-sunxi.org/AXP209
http://linux-sunxi.org/images/2/20/AXP202_Datasheet_v1.0_en.pdf

martinayotte

This thread just bring me the some questions ...

But, I've just verified with my own A20 if there was an issue with automatic power-on.
There is no issue, at least with Debian image : my A20 board is doing automatic power-on properly.

Is your scenario a bit different ? Do you have LiPo battery and do an "halt" for power-down and expect an automatic power-on when power comes back ?


dave-at-axon

Quote from: martinayotte on January 24, 2014, 04:44:30 AM
Is your scenario a bit different ? Do you have LiPo battery and do an "halt" for power-down and expect an automatic power-on when power comes back ?

I am running Android.

What I find is that if you have the LiPo connected and the board powered off, connecting the external supply does not power it up. I have to press the power switch for it to come on.

If you have no LiPo battery installed, it powers up on applying power to the unit.

In theory, my application will prevent the system going into sleep mode as I will have a wake lock applied. What I am testing now is what happens when the system is on battery power and the LiPo is discharged to the point where the board powers off. If I now reconnect external power, I need it to come back on without pressing the power button. It'll be a few hours until I know as the battery is currently at 93%.

If it does not, I need to add additional control to power it up.

dave-at-axon

After 6 1/2 hours I finally depleted the battery. The unit then powered off automatically.

I then re-applied DC power but the device remained off.

Pressing the power button did not bring it back on. The current drawn indicates that it appears to be powered up but the LCD remains off. The battery is charging as I can see this on the power supply current display.

I had to hold the power button in for about 5 seconds then release it. This appears to power down the unit. I could then power it up via the power button with a momentary press.

Looks like I am going to need some kind of logic controlling the power sequence. I am looking to fit an Atmel ATTiny13 on my main board to control the power switch. The issue will be how to detect a normal power up where the system was still running on battery power and a dead system that is now stuck!

Before I commit this to the PCB design I am going to try a few ideas out with a small Arduino based board.

dave-at-axon

I think I have figured this out and I am going to build a test circuit this week to see if it behaves as I think it should.

I will use a small 8 pin micro to handle the logic.

The external power switch is applied to 1 input.

The 3V3 from the A20 is connected to 1 input (to detect if the A20 is currently powered up or not)

An output is used to drive an NPN transistor that will pull the A20 power switch input low.

If on normal operation and DC power is removed, the unit is still powered up. If the DC power is applied, the micro checks the 3V3 from the A20 and as it's still there, assumes the system is already running and does nothing.

If there is no 3V3 after a short delay, it assumes the A20 is off and switches on the transistor long enough to power on the A20.

If the external power switch input is detected as active, the transistor output follows this state so that the A20 will either power up or power down.

The logic seems to be correct but until I connect it all up and write the code, I won't know if this will work as planned. The spanner in the works may be that the 3V3 is present on initial connection of the DC supply as I have noticed that the A20 does power up and then go to standby on applying power. It seems to do this to put the battery into a charge stage. Much the same as a phone does if switched off so I may have to include timing delays to detect this.

I'll post my findings after I get this tested.

dave-at-axon

Update. This is not quite working out as I was expecting. This testing is based on the system having run on battery for some time until it has no battery left and goes to sleep.

I can't get it out of standby with a short press. It keeps going back to sleep. It needs a longer press of about 1 second+.

The debug RS232 shows that the module wakes up and goes back to sleep. The 3V3 lines goes to zero as expected.

I now plug DC power back in. The battery starts to charge. I monitor the 3V3 and it rises and then drops to zero as the device powers up, does so work then goes back to sleep. This is seen in the debug output from the Linux kernel during bootup.


HELLO! BOOT0 is starting!
boot0 version : 2.0.0˜
read dram para.
dram driver version: 1.15
dram size =1024MB
0xffffffff
super_standby_flag = 0
Succeed in opening nand flash.
block from 2 to 6
deal block 2
Succeed in reading Boot1 file head.
The size of Boot1 is 0x00068000.
The file stored in 0x00000000 of block 2 is perfect.
Check is correct.
Ready to disable icache.
Succeed in loading Boot1.
Jump to Boot1.
[       0.146] boot1 version : 2.0.0
[       0.146] script installed early ok
[       0.147] pmu type = 3
[       0.251] bat vol = 3643 mv
[       0.266] axi:ahb:apb=4:2:2
[       0.266] set dcdc2=1400mv, clock=912M successed
[       0.269] key
[       0.281] no key found
[       0.281] flash init start
[       0.281] NB1 : enter NFB_Init
[       0.284] NB1 : enter phy init
[       0.287] [NAND] nand driver(b) version: 0x0x00000002, 0x0x00000012, data:0x20130627
[       0.295] get the good blk ratio from hwscan : 870
[       0.300] NB1 : nand phy init ok
[       0.344] NB1 : init ok
[       0.344] flash init finish
[       0.346] fs init ok
[       0.348] fattype FAT16
[       0.349] fs mount ok
[       0.353] nand good_block_ratio=870
[       0.355] storage_type=0
[       0.367] 0
[       0.368] set pc
[       0.368] usbdc_vol = 4000, usbdc_cur = 0
[       0.370] usbpc_vol = 4400, usbpc_cur = 0
[       0.374] init to usb pc
[       0.377] set pc
[       0.459] battery enough
[       0.460] power_start=0x00000000
[       0.460] power trigger
[       0.780] power start detect
[       0.780] power enter detect
[       0.781] usb start detect
[       0.783] usb enter detect
[       0.786] USB Device!!
[       0.915] base bat_cal = 8
[       1.186] usb set dc
[       1.186] set dc
[       5.250] extenal power low go high startup
[       5.250] power exit detect
[       5.252] usb exit detect
[       5.254] enter standby


This line is interesting.

[       0.460] power_start=0x00000000


I need to delve into the kernel to see where this is output and figure out what it means. In the fex file there is a line in the target setup like this:

[target]
power_start=1


I've looked at the FEX guide webpage but there is no reference to what this actual line means. Also the settings for the PMU don't have anything.

It may be that we can get the unit to power up and not go back to sleep but modiyfing the kernel code. I need to dig through it and find out what it needs.